hydro.accessors

Module Contents

Classes

Functions

write_or_return(data[, path_or_fobj])

normalize_fq(fq, *[, check_dupes])

fq_get_precisions(fq)

Attributes

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)

__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)

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.

property file_type[source]
date_names[source]
time_names[source]
to_mat(fname)[source]

Experimental Matlab .mat data file generator.

The support for netCDF files in Matlab is really bad. Matlab also has no built in support for the standards we are trying to follow (CF, ACDD), the most egregious lack of support is how to deal with times in netCDF files. This was an attempt to make a mat file which takes care of some of the things matlab won’t do for you. It requires scipy to function.

The file it produces is in no way stable.

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

static _gen_fname(expocode, station, cast, profile_type, profile_count=1, ftype='cf')[source]
Parameters:
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

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]
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]])