params.core

Classes

CFStandardName

Dataclass representing a single CF Standard Name

WHPName

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

Module Contents

class params.core.CFStandardName

Dataclass representing a single CF Standard Name

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

name: str
canonical_units: str | None
grib: str | None
amip: str | None
description: str | None
property cf

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

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.

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 = None
flag_w: Literal['woce_discrete', 'woce_ctd', 'no_flags', 'woce_bottle'] | None = None
cf_name: str | None = None
numeric_min: float | None = None
numeric_max: float | None = None
numeric_precision: int | None = None
description: str | None = None
note: str | None = None
warning: str | None = None
error_name: str | None = None
cf_unit: str | None = None
reference_scale: str | None = None
whp_number: int | None = None
scope: str = 'sample'
analytical_temperature_name: str | None = None
analytical_temperature_units: str | None = None
radiation_wavelength: float | None = None
scattering_angle: float | None = None
excitation_wavelength: float | None = None
emission_wavelength: float | None = None
alt_depth: int = 0
whp_name_alias: str | None = None
whp_unit_alias: str | None = None
error_col: bool = False
flag_col: bool = False
as_depth(depth)
Parameters:

depth (int) –

Return type:

WHPName

as_alias(param, unit)
Return type:

WHPName

as_error()
Return type:

WHPName

as_flag()
Return type:

WHPName

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

Return type:

str

property nc_name_flag: str

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

Return type:

str

property nc_name_error: str

The variable name of the uncertainty ancillary variable for this parameter

Return type:

str

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.

Return type:

CFStandardName | None

__eq__(other)

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

__hash__()
__lt__(other)

Sorts WHPNames based on their rank property

__repr__()
get_nc_attrs(error=False)

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

strfex(value, flag=False, numeric_precision_override=None, date_or_time=None)

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

  • date_or_time (Literal['date', 'time'] | None) –

Returns:

value as a string for printing in a WHP Exchange file

Return type:

str