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.

Top-levels functions

argopy.DataFetcher alias of argopy.fetchers.ArgoDataFetcher
argopy.IndexFetcher alias of argopy.fetchers.ArgoIndexFetcher

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

I/O and 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
argopy.IndexFetcher.to_xarray(self, **kwargs) Fetch index and return xr.dataset
argopy.IndexFetcher.to_dataframe(self, **kwargs) Fetch index and return pandas.Dataframe
argopy.IndexFetcher.to_csv(self, file) Fetch index and return csv

Visualisation

argopy.IndexFetcher.plot(self[, ptype]) Create custom plots from index
argopy.dashboard([wmo, cyc, width, height, …]) Insert in a notebook the Euro-Argo dashboard page

Helpers

argopy.set_options(**kwargs) Set options for argopy.
argopy.clear_cache() Delete argopy cache folder
argopy.tutorial.open_dataset(name) Open a dataset from the argopy online data repository (requires internet).

Low-level functions

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.list_available_data_src() List all available data sources

Internals

File systems

argopy.stores.filestore(cache, cachedir, **kw) Wrapper around fsspec file stores
argopy.stores.httpstore(cache, cachedir, **kw) Wrapper around fsspec http file store
argopy.stores.memorystore(cache, cachedir, **kw)
argopy.stores.indexstore(cache, cachedir, …) ” Use to manage access to a local Argo index and searches
argopy.stores.indexfilter_wmo(WMO[, CYC]) Index filter based on WMO and/or CYCLE_NUMER
argopy.stores.indexfilter_box(BOX, **kwargs) Index filter based on LATITUDE, LONGITUDE, DATE

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.

interp_std_levels(self, std_lev)[source]

Returns a new dataset interpolated to new inputs levels

Parameters:
list or np.array

Standard levels used for interpolation

Returns:
xarray.Dataset
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