params.core#

Module Contents#

Classes#

CFStandardName

Dataclass representing a single CF Standard Name

WHPName

Dataclass representing a single exchange/WOCE style name + unit pair

class params.core.CFStandardName#

Dataclass representing a single CF Standard Name

This class captures the information in the standard name table as properties.

property cf#

Part of the cf interface, for CFStandardName instances, just returns self

name: str#
canonical_units: str | None#
grib: str | None#
amip: str | None#
description: str | None#
class params.core.WHPName#

Dataclass representing a single exchange/WOCE style name + unit pair

There is a ton of extra information that is meant for use in making CF/netCDF files.

property full_whp_name#
property full_nc_name#
property full_error_name#
property key#

WHPNames are uniquely identified by a tuple of their (whp_name, whp_unit) values

property odv_key: str#

An ODV style representation of the param in the form of “NAME [UNIT]”

Note that the “[UNIT]” part is omitted if there are no units

property nc_name_flag: str#

The variable name of the “flag” ancillary variable for this parameter

property nc_name_error: str#

The variable name of the uncertainty ancillary variable for this parameter

property data_type#

the actual python class for this WHPName’s dtype

This is useufl for parsing string values for this WHPName

property cf: CFStandardName | None#

The CFStandardName equivalent to this WHPName

Returns none if there does not exist an equivalent CFStandardName.

whp_name: str#
nc_name: str#
nc_group: str | None#
rank: float#
dtype: Literal[string, decimal, integer]#
in_erddap: bool#
field_width: int#
whp_unit: str | None#
flag_w: Literal[woce_discrete, woce_ctd, no_flags, woce_bottle] | None#
cf_name: str | None#
numeric_min: float | None#
numeric_max: float | None#
numeric_precision: int | None#
description: str | None#
note: str | None#
warning: str | None#
error_name: str | None#
cf_unit: str | None#
reference_scale: str | None#
whp_number: int | None#
scope: str#
analytical_temperature_name: str | None#
analytical_temperature_units: str | None#
radiation_wavelength: float | None#
scattering_angle: float | None#
excitation_wavelength: float | None#
emission_wavelength: float | None#
alt_depth: int#
whp_name_alias: str | None#
whp_unit_alias: str | None#
error_col: bool#
flag_col: bool#
as_depth(depth: int) WHPName#
as_alias(param, unit) WHPName#
as_error() WHPName#
as_flag() WHPName#
__eq__(other)#

:class:`WHPName`s are equivalent if their whp_name and whp_unit properties are equivalent

__hash__()#

Return hash(self).

__lt__(other)#

Sorts WHPNames based on their rank property

__repr__()#

Return repr(self).

get_nc_attrs(error=False)#

a dict containing the netCDF variable attributes needed for CF compliance for this variable

strfex(value, flag: bool = False, numeric_precision_override: int | None = None, date_or_time: Literal[datetime.date, datetime.time] | None = None) str#

Format a value using standard WHP Exchange conventions:

  • dates are formatted as %Y%m%d

  • times are formatted as %H%M

  • fill values are “-999” for data, 9 for flags

  • for floating points, only NaN values are considered to be “fill”, there are parameters which can have -999 as a real value

Parameters:
  • value – the value to format as a string, the accepted inputs depends on the WHPName.dtype, dates and times are expected to be real datetime.date and datetime.time objects

  • flag (boolean) – should value be interpreted as a WOCE flag

  • numeric_precision_override (int) – if not None, will overrride the builtin databases WHPName.numeric_precision when formatting floats

Returns:

value as a string for printing in a WHP Exchange file

Return type:

str