[2]:
import argopy
from argopy import DataFetcher as ArgoDataFetcher
/home/docs/checkouts/readthedocs.org/user_builds/argopy/checkouts/v0.1.4/argopy/plotters.py:33: UserWarning: argopy requires cartopy installed for full map plotting functionality
warnings.warn("argopy requires cartopy installed for full map plotting functionality")
Data sources¶
Selecting a source¶
argopy can get access to Argo data from different sources:
-
The erddap server database is updated daily and doesn’t require you to download anymore data than what you need.You can select this data source with the keyword
errdap
and methods described below. your local collection of Argo files, organised as in the GDAC ftp.
This is how you would use argopy with your data, as long as they are formated and organised the Argo way.You can select this data source with the keywordlocalftp
and methods described below.
You have several ways to specify which data source you want to use:
- using argopy global options:
[3]:
argopy.set_options(src='erddap')
[3]:
<argopy.options.set_options at 0x7f3d40ff0080>
- in a temporary context:
[4]:
with argopy.set_options(src='erddap'):
loader = ArgoDataFetcher().profile(6902746, 34)
- with an argument in the data fetcher:
[5]:
loader = ArgoDataFetcher(src='erddap').profile(6902746, 34)
Setting a local copy of the GDAC ftp¶
Data fetching with the localftp
data source will require you to specify the path toward your local copy of the GDAC ftp server with the local_ftp
option.
This is not an issue for expert users, but standard users may wonder how to set this up. The primary distribution point for Argo data, the only one with full support from data centers and with nearly a 100% time availability, is the GDAC ftp. Two mirror servers are available:
- France Coriolis: ftp://ftp.ifremer.fr/ifremer/argo
- US GODAE: ftp://usgodae.org/pub/outgoing/argo
If you want to get your own copy of the ftp server content, Ifremer provides a nice rsync service. The rsync server “vdmzrs.ifremer.fr” provides a synchronization service between the “dac” directory of the GDAC and a user mirror. The “dac” index files are also available from “argo-index”.
From the user side, the rsync service:
- Downloads the new files
- Downloads the updated files
- Removes the files that have been removed from the GDAC
- Compresses/uncompresses the files during the transfer
- Preserves the files creation/update dates
- Lists all the files that have been transferred (easy to use for a user side post-processing)
To synchronize the whole dac directory of the Argo GDAC:
rsync -avzh --delete vdmzrs.ifremer.fr::argo/ /home/mydirectory/...
To synchronize the index:
rsync -avzh --delete vdmzrs.ifremer.fr::argo-index/ /home/mydirectory/...
Note
The first synchronisation of the whole dac directory of the Argo GDAC (365Gb) can take quite a long time (several hours).
Comparing data sources¶
Let’s retrieve one float data from a local sample of the GDAC ftp (a sample GDAC ftp is downloaded automatically with the method argopy.tutorial.open_dataset()
):
[6]:
# Download ftp sample and get the ftp local path:
ftproot, flist = argopy.tutorial.open_dataset('localftp')
# then fetch data:
with argopy.set_options(src='localftp', local_ftp=ftproot):
ds = ArgoDataFetcher().float(1900857).to_xarray()
print(ds)
<xarray.Dataset>
Dimensions: (N_POINTS: 20966)
Coordinates:
* N_POINTS (N_POINTS) int64 0 1 2 3 4 ... 20962 20963 20964 20965
LONGITUDE (N_POINTS) float64 10.81 10.81 10.81 ... 92.65 92.65 92.65
TIME (N_POINTS) datetime64[ns] 2008-02-25T04:03:00 ... 2013-06-01T05:34:00
LATITUDE (N_POINTS) float64 -39.93 -39.93 -39.93 ... -44.16 -44.16
Data variables:
CYCLE_NUMBER (N_POINTS) int64 0 0 0 0 0 0 0 ... 192 192 192 192 192 192
DATA_MODE (N_POINTS) <U1 'D' 'D' 'D' 'D' 'D' ... 'D' 'D' 'D' 'D' 'D'
DIRECTION (N_POINTS) <U1 'D' 'D' 'D' 'D' 'D' ... 'A' 'A' 'A' 'A' 'A'
PLATFORM_NUMBER (N_POINTS) int64 1900857 1900857 ... 1900857 1900857
POSITION_QC (N_POINTS) int64 1 1 1 1 1 1 1 1 1 1 ... 1 1 1 1 1 1 1 1 1
PRES (N_POINTS) float64 17.0 25.0 35.0 ... 1.964e+03 1.987e+03
PRES_QC (N_POINTS) int64 1 1 1 1 1 1 1 1 1 1 ... 1 1 1 1 1 1 1 1 1
PSAL (N_POINTS) float64 34.68 34.68 34.69 ... 34.71 34.71 34.72
PSAL_QC (N_POINTS) int64 1 1 1 1 1 1 1 1 1 1 ... 1 1 1 1 1 1 1 1 1
TEMP (N_POINTS) float64 16.14 16.14 16.03 ... 2.431 2.422 2.413
TEMP_QC (N_POINTS) int64 1 1 1 1 1 1 1 1 1 1 ... 1 1 1 1 1 1 1 1 1
TIME_QC (N_POINTS) int64 1 1 1 1 1 1 1 1 1 1 ... 1 1 1 1 1 1 1 1 1
Attributes:
DATA_ID: ARGO
DOI: http://doi.org/10.17882/42182
Fetched_from: /home/docs/.argopy_tutorial_data/ftp
Fetched_by: docs
Fetched_date: 2020/06/24
Fetched_constraints: WMO1900857
Fetched_uri: /home/docs/.argopy_tutorial_data/ftp/dac/coriolis/1...
history: Variables filtered according to DATA_MODE; Variable...
Let’s now retrieve the latest data for this float from the erddap
:
[7]:
with argopy.set_options(src='erddap'):
ds = ArgoDataFetcher().float(1900857).to_xarray()
print(ds)
<xarray.Dataset>
Dimensions: (N_POINTS: 20966)
Coordinates:
* N_POINTS (N_POINTS) int64 0 1 2 3 4 ... 20962 20963 20964 20965
LONGITUDE (N_POINTS) float64 10.81 10.81 10.81 ... 92.65 92.65 92.65
TIME (N_POINTS) datetime64[ns] 2008-02-25T04:03:00 ... 2013-06-01T05:34:00
LATITUDE (N_POINTS) float64 -39.93 -39.93 -39.93 ... -44.16 -44.16
Data variables:
CYCLE_NUMBER (N_POINTS) int64 0 0 0 0 0 0 0 ... 192 192 192 192 192 192
DATA_MODE (N_POINTS) <U1 'D' 'D' 'D' 'D' 'D' ... 'D' 'D' 'D' 'D' 'D'
DIRECTION (N_POINTS) <U1 'D' 'D' 'D' 'D' 'D' ... 'A' 'A' 'A' 'A' 'A'
PLATFORM_NUMBER (N_POINTS) int64 1900857 1900857 ... 1900857 1900857
POSITION_QC (N_POINTS) int64 1 1 1 1 1 1 1 1 1 1 ... 1 1 1 1 1 1 1 1 1
PRES (N_POINTS) float64 17.0 25.0 35.0 ... 1.964e+03 1.987e+03
PRES_QC (N_POINTS) int64 1 1 1 1 1 1 1 1 1 1 ... 1 1 1 1 1 1 1 1 1
PSAL (N_POINTS) float64 34.68 34.68 34.69 ... 34.71 34.71 34.72
PSAL_QC (N_POINTS) int64 1 1 1 1 1 1 1 1 1 1 ... 1 1 1 1 1 1 1 1 1
TEMP (N_POINTS) float64 16.14 16.14 16.03 ... 2.431 2.422 2.413
TEMP_QC (N_POINTS) int64 1 1 1 1 1 1 1 1 1 1 ... 1 1 1 1 1 1 1 1 1
TIME_QC (N_POINTS) int64 1 1 1 1 1 1 1 1 1 1 ... 1 1 1 1 1 1 1 1 1
Attributes:
cdm_altitude_proxy: pres
cdm_data_type: TrajectoryProfile
cdm_profile_variables: cycle_number, data_type, format_version, handb...
cdm_trajectory_variables: platform_number, project_name, pi_name, platfo...
Conventions: Argo-3.1, CF-1.6, COARDS, ACDD-1.3
creator_email: support@argo.net
creator_name: Argo
creator_url: http://www.argo.net/
Easternmost_Easting: 93.926
featureType: TrajectoryProfile
geospatial_lat_max: -34.444
geospatial_lat_min: -48.855
geospatial_lat_units: degrees_north
geospatial_lon_max: 93.926
geospatial_lon_min: 9.045
geospatial_lon_units: degrees_east
history: 2020-06-24T21:05:32Z (local files)\n2020-06-24...
id: ArgoFloats
infoUrl: http://www.argo.net/
institution: Argo
keywords: adjusted, argo, array, assembly, best, centre,...
keywords_vocabulary: GCMD Science Keywords
license: The data may be used and redistributed for fre...
Northernmost_Northing: -34.444
references: http://www.argodatamgt.org/Documentation
source: Argo float
sourceUrl: (local files)
Southernmost_Northing: -48.855
standard_name_vocabulary: CF Standard Name Table v29
summary: Argo float vertical profiles from Coriolis Glo...
time_coverage_end: 2013-06-01T05:34:00Z
time_coverage_start: 2008-02-25T04:03:00Z
title: Argo Float Measurements
user_manual_version: 3.1
Westernmost_Easting: 9.045
DATA_ID: ARGO
DOI: http://doi.org/10.17882/42182
Fetched_from: http://www.ifremer.fr/erddap
Fetched_by: docs
Fetched_date: 2020/06/24
Fetched_constraints: phy_WMO1900857
Fetched_uri: http://www.ifremer.fr/erddap/tabledap/ArgoFloa...