Argo Float store#

If you are familiar with Argo float WMO numbers, you may be interested in using directly the Argo float store ArgoFloat.

This store aims to facilitate all Argo netcdf file load/read operations for a specific float. Whatever the Argo netcdf file location, local or remote, you can now delegate to argopy the burden of transfer protocol and GDAC paths handling.

All float store methods and properties are documented in the ArgoFloat API page.

The simplest use case may look like this:

In [1]: from argopy import ArgoFloat

In [2]: WMO = 6903091 # Use any float

In [3]: ds = ArgoFloat(WMO).open_dataset('prof')

This will trigger download and opening of the https://data-argo.ifremer.fr/dac/coriolis/6903091/6903091_prof.nc file. You should notice that ArgoFloat automatically determined in which DAC folder to find this float and constructed the appropriate path toward the requested dataset prof.

Float store creation#

If a specific host is not provided, ArgoFloat will fetch float data from the gdac global option (which is set to the Ifremer http server by default), but you can use any valid GDAC host and possibly shortcuts as well:

In [4]: af = ArgoFloat(WMO)

# or:
# af = ArgoFloat(WMO, host='/home/ref-argo/gdac')  # Use your local GDAC copy
# af = ArgoFloat(WMO, host='https')  # Shortcut for https://data-argo.ifremer.fr
# af = ArgoFloat(WMO, host='ftp')    # shortcut for ftp://ftp.ifremer.fr/ifremer/argo
# af = ArgoFloat(WMO, host='s3')     # Shortcut for s3://argo-gdac-sandbox/pub

Note that in order to include dataset from the auxiliary GDAC folder, you need to specify it with the aux argument at the instantiation of the class:

In [5]: af = ArgoFloat(WMO, aux=True)

In [6]: af
Out[6]: 
<argofloat.6903091.http.online>
GDAC host: https://data-argo.ifremer.fr
DAC name: coriolis
Network(s): ['BGC']
Deployment date: 2021-03-05 22:55 [1490 days ago]
Float type and manufacturer: PROVOR_III [NKE]
Number of cycles: 330
Dashboard: https://fleetmonitoring.euro-argo.eu/float/6903091
Netcdf dataset available: ['Rtraj', 'Sprof', 'meta', 'meta_aux', 'prof', 'tech', 'tech_aux']

List dataset and loading#

Once you created an ArgoFloat instance, you can list all available dataset with:

In [7]: af.ls_dataset()
Out[7]: 
{'Rtraj': 'https://data-argo.ifremer.fr/dac/coriolis/6903091/6903091_Rtraj.nc',
 'Sprof': 'https://data-argo.ifremer.fr/dac/coriolis/6903091/6903091_Sprof.nc',
 'meta': 'https://data-argo.ifremer.fr/dac/coriolis/6903091/6903091_meta.nc',
 'meta_aux': 'https://data-argo.ifremer.fr/aux/coriolis/6903091/6903091_meta_aux.nc',
 'prof': 'https://data-argo.ifremer.fr/dac/coriolis/6903091/6903091_prof.nc',
 'tech': 'https://data-argo.ifremer.fr/dac/coriolis/6903091/6903091_tech.nc',
 'tech_aux': 'https://data-argo.ifremer.fr/aux/coriolis/6903091/6903091_tech_aux.nc'}

Note that dataset from the auxiliary GDAC folder are included in this store, and referenced with the _aux suffix.

So finally, you can open any of these dataset using their keyword:

In [8]: ds = af.open_dataset('meta') # load <WMO>_meta.nc

# or:
# ds = af.open_dataset('prof') # load <WMO>_prof.nc
# ds = af.open_dataset('tech') # load <WMO>_tech.nc
# ds = af.open_dataset('Rtraj') # load <WMO>_Rtraj.nc

Note that you can open a dataset lazily, this is explained in the Laziness with an ArgoFloat or gdacfs documentation page.

Integration within argopy#

The ArgoFloat class is further used in argopy in the ArgoIndex iterator.

In [9]: from argopy import ArgoIndex

# Make a search on Argo index of profiles:
In [10]: idx = ArgoIndex().search_lat_lon([-70, -55, 20, 30], nrows=100)

# Then iterate over floats matching the results:
In [11]: for float in idx.iterfloats():
   ....:     ds = float.open_dataset('meta')
   ....:     print(float.WMO, ds['LAUNCH_DATE'].data)
   ....: 
13857 1997-07-19T14:55:00.000000000