hydro.accessors

Attributes

Classes

Functions

write_or_return(data[, path_or_fobj])

normalize_fq(fq, *[, check_dupes])

fq_get_precisions(fq)

Module Contents

hydro.accessors.FLAG_NAME = 'cchdo.hydro._qc'[source]
hydro.accessors.ERROR_NAME = 'cchdo.hydro._error'[source]
hydro.accessors.PathType[source]
hydro.accessors.write_or_return(data, path_or_fobj=None)[source]
Parameters:
Return type:

bytes | None

class hydro.accessors.FQPointKey[source]

Bases: NamedTuple

expocode: str[source]
station: str[source]
cast: int[source]
sample: str[source]
class hydro.accessors.FQProfileKey[source]

Bases: NamedTuple

expocode: str[source]
station: str[source]
cast: int[source]
class hydro.accessors.WHPIndxer(obj)[source]
Parameters:

obj (xarray.Dataset)

n_prof[source]
n_level = [][source]
__getitem__(key)[source]
Parameters:

key (FQProfileKey | FQPointKey)

hydro.accessors.NormalizedFQ[source]
hydro.accessors.normalize_fq(fq, *, check_dupes=True)[source]
Parameters:

fq (list[dict[str, str | float]])

Return type:

NormalizedFQ

hydro.accessors.fq_get_precisions(fq)[source]
Parameters:

fq (NormalizedFQ)

Return type:

dict[str, int]

hydro.accessors.FTypeOptions[source]
class hydro.accessors.CCHDOAccessor(xarray_obj)[source]
Parameters:

xarray_obj (xarray.Dataset)

_obj[source]
jsonld()[source]
Return type:

dict

to_coards(path=None)[source]
to_woce(path=None)[source]
to_sum(path=None)[source]

NetCDF to WOCE sumfile maker.

This is missing some information that is not included anymore (wire out, height above bottom). It is especially lacking in including woce parameter IDs

property __geo_interface__[source]

The station positions as a MultiPoint geo interface.

See https://gist.github.com/sgillies/2217756

property track[source]

A dict which can be dumped to json which conforms to the expected structure for the CCHDO website.

static _gen_fname(expocode, station, cast, profile_type, profile_count=1, ftype='cf')[source]
Parameters:
  • expocode (str)

  • station (str)

  • cast (int)

  • profile_type (cchdo.hydro.types.FileType)

  • profile_count (int)

  • ftype (FTypeOptions)

Return type:

str

gen_fname(ftype='cf')[source]

Generate a human friendly netCDF (or other output type) filename for this object.

Parameters:

ftype (FTypeOptions)

Return type:

str

compact_profile()[source]

Drop the trailing empty data from a profile.

Because we use the incomplete multidimensional array representation of profiles there is often “wasted space” at the end of any profile that is not the longest one. This accessor drops that wasted space for xr.Dataset objects containing a single profile

date_names[source]
time_names[source]
elapsed_time_names[source]
property file_type[source]
static cchdo_c_format_precision(c_format)[source]
Parameters:

c_format (str)

Return type:

int | None

_make_params_units_line(params)[source]
Parameters:

params (dict[cchdo.params.WHPName, xarray.DataArray])

static _whpname_from_attrs(attrs)[source]
Return type:

list[cchdo.params.WHPName]

_make_ctd_headers(params)[source]
Return type:

list[str]

_make_data_block(params)[source]
Parameters:

params (dict[cchdo.params.WHPName, xarray.DataArray])

Return type:

list[str]

_get_comments()[source]
Return type:

list[str]

to_whp_columns(compact=False)[source]
Return type:

dict[cchdo.params.WHPName, xarray.DataArray]

to_exchange(path=None)[source]

Convert a CCHDO CF netCDF dataset to exchange.

merge_fq(fq, *, check_flags=True)[source]
Parameters:

fq (list[dict[str, str | float]])