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
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
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
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
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)
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')
# 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()
# 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]
# 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])
# 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
ValueErrorif not compliant.host (str, optional, default: OPTIONS['gdac']) –
Local or remote (http, ftp or s3) path where a
dacfolder is to be found (compliant with GDAC structure).This parameter takes values like:
a local absolute path
https://data-argo.ifremer.fr, shortcut withhttporhttpshttps://usgodae.org/pub/outgoing/argo, shortcut withus-httporus-httpsftp://ftp.ifremer.fr/ifremer/argo, shortcut withftps3://argo-gdac-sandbox/pub, shortcut withs3oraws
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.DataFramedescribing all profile filesload_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()List all available datasets as a dictionary
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
Return a
pandas.DataFramedescribing all profile filesAttributes
List of cycle numbers, according to the list of mono-profile files.
Number of cycles, according to the list of mono-profile files.
api_pointEuro-Argo fleet-monitoring API points
Name of the DAC responsible for this float
host_protocolProtocol of the GDAC host
host_sepHost path separator
A dictionary of float meta-data
Root path of float datasets
technicaldataA dictionary of float technical data