argopy.ArgoFloat

argopy.ArgoFloat#

class ArgoFloat(*args, **kwargs)[source]#

Argo float store

This store makes it easy to load/read/visualize data for a given float from any GDAC location and netcdf files.

Examples

Listing 19 Create a float store with a WMO number, and a host#
from argopy import ArgoFloat
af = ArgoFloat(WMO)  # Use argopy 'gdac' option by default
af = ArgoFloat(WMO, host='/home/ref-argo/gdac')  # Use your local GDAC copy
af = ArgoFloat(WMO, host='http')   # 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
Listing 20 Load GDAC netcdf files#
af.ls_datasets() # Return a dictionary with all available datasets for this float

ds = af.open_dataset('prof') # Use keys from .ls_datasets()
ds = af.open_dataset('meta')
ds = af.open_dataset('tech')
ds = af.open_dataset('Rtraj')
ds = af.open_dataset('Sprof')

ds = af.open_dataset('Sprof', netCDF4=True)  # Return a netCDF4 Dataset instead of an xarray
Listing 21 Load GDAC netcdf mono-cycle profile files#
af.ls_profiles() # Return a dictionary with all available mono-cycle profile files (everything under the 'profiles' sub-folder)

# To load one single file, use keys from af.ls_profiles():
ds = af.open_profile(12) # cycle number 12, core file
ds = af.open_profile('1D') # cycle number 1, descending core file
ds = af.open_profile('B15') # cycle number 15, BGC file
ds = af.open_profile('B1D') # cycle number 1, descending BGC file
ds = af.open_profile('S28') # cycle number 28, BGC synthetic file

# To load one or more files, provide cycle number(s) and other attributes:
ds_list = af.open_profiles([1,2,3])
ds_list = af.open_profiles([1,2,3], direction='D')
ds_list = af.open_profiles([1,2,3], dataset='B') # Return 'BGC' B files
ds_list = af.open_profiles([1,2,3], dataset='B', direction='D') # Return 'BGC' B files, descending
ds_list = af.open_profiles([1,2,3], dataset='S') # Return 'BGC' Synthetic files

# If you don't specify cycle numbers, all cycles are loaded:
ds_list = af.open_profiles(direction='D') # Return *all* core descending files

af.profiles_to_dataframe()  # Pandas DataFrame describing all available profile files
Listing 22 Other attributes and methods#
af.CYCLE_NUMBERS  # List of unique cycle numbers (as given by file names under 'profiles' GDAC folder)
af.N_CYCLES  # Number of cycles
af.path  # root path for all float datasets
af.dac   # name of the DAC this float belongs to
af.metadata  # a dictionary with all available metadata for this file (from netcdf or fleetmonitoring API)
Listing 23 Quick plotting methods#
af.plot.trajectory()
af.plot.trajectory(figsize=(18,18), padding=[1, 5])
af.plot.map('TEMP', pres=450, cmap='Spectral_r')
af.plot.map('DATA_MODE')
af.plot.scatter('TEMP')
af.plot.scatter('PSAL_QC')
af.plot.scatter('DOXY', ds='Sprof')
af.plot.scatter('MEASUREMENT_CODE', ds='Rtraj')
Listing 24 Launch configuration parameters#
# Total number and list of launch parameters:
af.launchconfig.n_params
af.launchconfig.parameters

# Read one parameter value, with explicit or implicit parameter name:
# ('CONFIG_' is not mandatory, but string is case-sensitive)
af.launchconfig['CONFIG_CycleTime_hours']
af.launchconfig['CycleTime_hours']

# Export to a DataFrame:
af.launchconfig.to_dataframe()
Listing 25 Configuration parameters and missions#
# Total number and list of configuration parameters:
af.config.n_params
af.config.parameters

# Total number and list of missions:
af.config.n_missions
af.config.missions

# Read one parameter value, with explicit or implicit parameter name:
# ('CONFIG_' is not mandatory, but string is case-sensitive)
af.config['CONFIG_CycleTime_hours']
af.config['CycleTime_hours']

# Read parameter value for one or more mission numbers:
# (! 2nd index is not 0-based, it's an integer key to look for in mission numbers)
af.config['CycleTime_hours', 1]
af.config['CycleTime_hours', 1:3]
Listing 26 Configuration parameters and cycle numbers#
# Get a dictionary mapping cycle on mission numbers:
af.config.cycles

# Read parameter value for one or more cycle numbers:
# (! 2nd index is not 0-based, it's an integer key to look for in cycle numbers)
af.config.for_cycles('CycleTime_hours', 1)
af.config.for_cycles('CycleTime_hours', [10, 11])
Listing 27 Export configuration parameters#
# Export to a DataFrame:
af.config.to_dataframe()
af.config.to_dataframe(missions=1)
af.config.to_dataframe(missions=[1, 2])
__init__(*args, **kwargs)[source]#

Create an Argo float store

Parameters:
  • wmo (int or str) – The float WMO number. It will be validated against the Argo convention and raise an ValueError if not compliant.

  • host (str, optional, default: OPTIONS['gdac']) –

    Local or remote (http, ftp or s3) path where a dac folder is to be found (compliant with GDAC structure).

    This parameter takes values like:

    • a local absolute path

    • https://data-argo.ifremer.fr, shortcut with http or https

    • https://usgodae.org/pub/outgoing/argo, shortcut with us-http or us-https

    • ftp://ftp.ifremer.fr/ifremer/argo, shortcut with ftp

    • s3://argo-gdac-sandbox/pub, shortcut with s3 or aws

  • aux (bool, default = False) – Should we include dataset from the auxiliary data folder. The ‘aux’ folder is expected to be at the same path level as the ‘dac’ folder on the GDAC host.

  • cache (bool, optional, default: False) – Use cache or not.

  • cachedir (str, optional, default: OPTIONS['cachedir']) – Folder where to store cached files.

  • timeout (int, optional, default: OPTIONS['api_timeout']) – Time out in seconds to connect to a remote host (ftp or http).

Methods

__init__(*args, **kwargs)

Create an Argo float store

dataset([name])

Open and decode a dataset file, once

describe_profiles()

Return a pandas.DataFrame describing all profile files

load_dac()

Load the DAC short name for this float

load_index()

Load the Argo full index in memory and trigger search for this float

load_metadata()

Load float metadata from Euro-Argo fleet-monitoring API

load_metadata_from_meta_file()

Load float meta-data from the netcdf file as a dictionary

load_technicaldata()

Load float technical data from Euro-Argo fleet-monitoring API

ls_dataset()

Deprecated, see ls_datasets()

ls_datasets()

List all available datasets as a dictionary

ls_profiles()

List all available profile files as a dictionary

lsprofiles()

Deprecated, see _lsp()

open_dataset([name, cast])

Open and decode a dataset file

open_profile(name[, cast])

Open and decode a single profile file

open_profiles([cycle_number, dataset, ...])

Open and decode one or more profile files

profile(name, **kwargs)

Open and decode a profile file, once

profiles_to_dataframe()

Return a pandas.DataFrame describing all profile files

Attributes

CYCLE_NUMBERS

List of cycle numbers, according to the list of mono-profile files.

N_CYCLES

Number of cycles, according to the list of mono-profile files.

api_point

Euro-Argo fleet-monitoring API points

dac

Name of the DAC responsible for this float

host_protocol

Protocol of the GDAC host

host_sep

Host path separator

metadata

A dictionary of float meta-data

path

Root path of float datasets

technicaldata

A dictionary of float technical data