API reference

This page provides an auto-generated summary of argopy’s API. For more details and examples, refer to the relevant chapters in the main part of the documentation.

Data Fetchers

argopy.DataFetcher alias of argopy.fetchers.ArgoDataFetcher

Search entries

argopy.DataFetcher.region(self, box) Fetch data from a space/time domain
argopy.DataFetcher.float(self, wmo, \*\*kw) Fetch data from a float
argopy.DataFetcher.profile(self, wmo, cyc) Fetch data from a profile

Data formats

argopy.DataFetcher.to_xarray(self, \*\*kwargs) Fetch and return data as xarray.DataSet
argopy.DataFetcher.to_dataframe(self, \*\*kwargs) Fetch and return data as pandas.Dataframe

Index/meta-data fetchers

argopy.IndexFetcher alias of argopy.fetchers.ArgoIndexFetcher

Search entries

argopy.IndexFetcher.region(self, box) Load index for a rectangular space/time domain region
argopy.IndexFetcher.float(self, wmo) Load index for one or more WMOs

Data formats

argopy.IndexFetcher.to_xarray(self, \*\*kwargs) Fetch index and return xr.dataset
argopy.IndexFetcher.to_dataframe(self, …) Fetch index and return pandas.Dataframe
argopy.IndexFetcher.to_csv(self, file) Fetch index and return csv

Helpers

argopy.IndexFetcher.plot(self[, ptype]) Create custom plots from index

Low-level functions

argopy.tutorial.open_dataset(name) Open a dataset from the argopy online data repository (requires internet).
argopy.set_options(**kwargs) Set options for argopy.
argopy.show_versions([file]) Print the versions of argopy and its dependencies
argopy.utilities.open_etopo1(box[, res]) Download ETOPO for a box
argopy.utilities.urlopen(url) Load content from url or raise alarm on status with explicit information on the error
argopy.utilities.list_available_data_src() List all available data sources

Xarray argo name space

class ArgoAccessor[source]

Class registered under scope argo to access a xarray.Dataset object.

  • Ensure all variables are of the Argo required dtype with:

    ds.argo.cast_types()

  • Convert a collection of points into a collection of profiles:

    ds.argo.point2profile()

  • Convert a collection of profiles to a collection of points:

    ds.argo.profile2point()

cast_types(self)[source]

Make sure variables are of the appropriate types

This is hard coded, but should be retrieved from an API somewhere Should be able to handle all possible variables encountered in the Argo dataset

filter_data_mode(self, keep_error:bool=True, errors:str='raise')[source]

Filter variables according to their data mode

This applies to <PARAM> and <PARAM_QC>

For data mode ‘R’ and ‘A’: keep <PARAM> (eg: ‘PRES’, ‘TEMP’ and ‘PSAL’) For data mode ‘D’: keep <PARAM_ADJUSTED> (eg: ‘PRES_ADJUSTED’, ‘TEMP_ADJUSTED’ and ‘PSAL_ADJUSTED’)

Parameters:
keep_error: bool, optional

If true (default) keep the measurements error fields or not.

errors: {‘raise’,’ignore’}, optional

If ‘raise’ (default), raises a InvalidDatasetStructure error if any of the expected dataset variables is not found. If ‘ignore’, fails silently and return unmodified dataset.

Returns:
xarray.Dataset
filter_qc(self, QC_list=[1, 2], drop=True, mode='all', mask=False)[source]

Filter data set according to QC values

Mask the dataset for points where ‘all’ or ‘any’ of the QC fields has a value in the list of integer QC flags.

This method can return the filtered dataset or the filter mask.

point2profile(self)[source]

Transform a collection of points into a collection of profiles

profile2point(self)[source]

Convert a collection of profiles to a collection of points

uid(self, wmo_or_uid, cyc=None, direction=None)[source]

UID encoder/decoder

Parameters:
int

WMO number (to encode) or UID (to decode)

cyc: int, optional

Cycle number (to encode), not used to decode

direction: str, optional

Direction of the profile, must be ‘A’ (Ascending) or ‘D’ (Descending)

Returns:
int or tuple of int

Examples

unique_float_profile_id = uid(690024,13,’A’) # Encode wmo, cyc, drc = uid(unique_float_profile_id) # Decode