Argo is an international research program that deploys floats (as seen below) to collect physical and chemical data in the ocean at a variety of depths.
Image source: NOAA
ArgoPy is an effort to make data collected through the Argo network more accessible to the public as well as researchers. It contains up-to-date data from Argo floats from all around the world, as well as tools to clean and visualize the data.
Using the function below, users can see a dashboard of active Argo floats.
In [1]:
Copied!
from argopy import dashboard
dashboard()
from argopy import dashboard
dashboard()
Out[1]:
Install ArgoPy¶
Doumentation can be found here: https://argopy.readthedocs.io/en/latest/index.html
In [2]:
Copied!
import argopy
from argopy import DataFetcher
import argopy
from argopy import DataFetcher
Data acquisition¶
One of the strengths of ArgoPy is that the DataFetcher function provides easy access to up-to-date Argo data.
In [3]:
Copied!
# three methods of data selection
# by region (list: [lon_min, lon_max, lat_min, lat_max, depth_min, depth_max, date_start, date_end])
data_region = DataFetcher().region([-75, -65, 20, 30, 0, 100, '2015-01', '2015-02'])
# by World Meteorological Organization (WMO) float ID
data_floats = DataFetcher().float([6902746, 6902757])
# by profile (WMO float ID, [list of cycles])
data_profile = DataFetcher().profile(6902746, [10, 20, 30, 40, 50])
# three methods of data selection
# by region (list: [lon_min, lon_max, lat_min, lat_max, depth_min, depth_max, date_start, date_end])
data_region = DataFetcher().region([-75, -65, 20, 30, 0, 100, '2015-01', '2015-02'])
# by World Meteorological Organization (WMO) float ID
data_floats = DataFetcher().float([6902746, 6902757])
# by profile (WMO float ID, [list of cycles])
data_profile = DataFetcher().profile(6902746, [10, 20, 30, 40, 50])
Data visualization¶
There are three kinds of plots built into ArgoPy:
- 'trajectory', which shows the location of the float (default)
- 'profiler' or 'dac', which show metadata histograms
- 'qc_altimetry', which shows quality control information for each float
In [4]:
Copied!
data_region.plot()
data_region.plot()
Out[4]:
(<Figure size 900x540 with 1 Axes>, <GeoAxesSubplot:xlabel='longitude', ylabel='latitude'>)
In [5]:
Copied!
data_floats.plot('dac')
data_floats.plot('dac')
Out[5]:
(<Figure size 900x540 with 1 Axes>, <AxesSubplot:xlabel='Number of profiles'>)
In [6]:
Copied!
data_profile.plot('qc_altimetry')
data_profile.plot('qc_altimetry')
interactive(children=(Dropdown(description='Float', options=('6902746',), value='6902746'), Output()), _dom_cl…
Out[6]:
<function argopy.plot.plot.open_sat_altim_report.<locals>.f(Float)>
Compatability with other packages¶
In [7]:
Copied!
import pandas as pd
from matplotlib import pyplot as plt
import xarray as xr
import cartopy
import cartopy.crs as ccrs
import pandas as pd
from matplotlib import pyplot as plt
import xarray as xr
import cartopy
import cartopy.crs as ccrs
In [8]:
Copied!
# convert argo data to pandas dataframe
argo_pd = data_profile.to_dataframe()
# convert argo data to pandas dataframe
argo_pd = data_profile.to_dataframe()
In [9]:
Copied!
argo_pd
argo_pd
Out[9]:
CYCLE_NUMBER | DATA_MODE | DIRECTION | PLATFORM_NUMBER | POSITION_QC | PRES | PRES_ERROR | PRES_QC | PSAL | PSAL_ERROR | PSAL_QC | TEMP | TEMP_ERROR | TEMP_QC | TIME_QC | LATITUDE | LONGITUDE | TIME | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
N_POINTS | ||||||||||||||||||
0 | 10 | D | A | 6902746 | 1 | 3.0 | 2.4 | 1 | 35.085999 | 0.01 | 1 | 28.636999 | 0.002 | 1 | 1 | 19.242 | -59.534 | 2017-08-22 06:55:00 |
1 | 10 | D | A | 6902746 | 1 | 4.0 | 2.4 | 1 | 35.084999 | 0.01 | 1 | 28.638000 | 0.002 | 1 | 1 | 19.242 | -59.534 | 2017-08-22 06:55:00 |
2 | 10 | D | A | 6902746 | 1 | 5.0 | 2.4 | 1 | 35.085999 | 0.01 | 1 | 28.636999 | 0.002 | 1 | 1 | 19.242 | -59.534 | 2017-08-22 06:55:00 |
3 | 10 | D | A | 6902746 | 1 | 6.0 | 2.4 | 1 | 35.087002 | 0.01 | 1 | 28.636000 | 0.002 | 1 | 1 | 19.242 | -59.534 | 2017-08-22 06:55:00 |
4 | 10 | D | A | 6902746 | 1 | 7.0 | 2.4 | 1 | 35.085999 | 0.01 | 1 | 28.639000 | 0.002 | 1 | 1 | 19.242 | -59.534 | 2017-08-22 06:55:00 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
534 | 50 | D | A | 6902746 | 1 | 1938.0 | 2.4 | 1 | 34.987999 | 0.01 | 1 | 3.755000 | 0.002 | 1 | 1 | 19.650 | -57.767 | 2018-03-10 06:58:00 |
535 | 50 | D | A | 6902746 | 1 | 1963.0 | 2.4 | 1 | 34.987000 | 0.01 | 1 | 3.721000 | 0.002 | 1 | 1 | 19.650 | -57.767 | 2018-03-10 06:58:00 |
536 | 50 | D | A | 6902746 | 1 | 1988.0 | 2.4 | 1 | 34.985001 | 0.01 | 1 | 3.672000 | 0.002 | 1 | 1 | 19.650 | -57.767 | 2018-03-10 06:58:00 |
537 | 50 | D | A | 6902746 | 1 | 2013.0 | 2.4 | 1 | 34.983002 | 0.01 | 1 | 3.634000 | 0.002 | 1 | 1 | 19.650 | -57.767 | 2018-03-10 06:58:00 |
538 | 50 | D | A | 6902746 | 1 | 2030.0 | 2.4 | 1 | 34.983002 | 0.01 | 1 | 3.618000 | 0.002 | 1 | 1 | 19.650 | -57.767 | 2018-03-10 06:58:00 |
539 rows × 18 columns
In [11]:
Copied!
# plot argo data with matplotlib
fig, ax = plt.subplots()
ax.scatter(x = argo_pd.TEMP,
y = argo_pd.PRES,
marker = '.')
plt.xlabel('Temperature ($^\circ$C)')
ax.xaxis.set_ticks_position('top') # label x-axis at top of plot
ax.xaxis.set_label_position('top')
plt.ylabel('Pressure (dbar)') # pressure is an analog for depth
plt.gca().invert_yaxis() # invert y-axis to reflect depth
# plot argo data with matplotlib
fig, ax = plt.subplots()
ax.scatter(x = argo_pd.TEMP,
y = argo_pd.PRES,
marker = '.')
plt.xlabel('Temperature ($^\circ$C)')
ax.xaxis.set_ticks_position('top') # label x-axis at top of plot
ax.xaxis.set_label_position('top')
plt.ylabel('Pressure (dbar)') # pressure is an analog for depth
plt.gca().invert_yaxis() # invert y-axis to reflect depth
In [12]:
Copied!
# convert argo data to xarray dataset
argo_xr = data_region.to_xarray()
# convert argo data to xarray dataset
argo_xr = data_region.to_xarray()
In [13]:
Copied!
# perform calculations
argo_xr['PSAL'].mean()
# perform calculations
argo_xr['PSAL'].mean()
Out[13]:
<xarray.DataArray 'PSAL' ()> array(36.588856, dtype=float32)
In [37]:
Copied!
# convert argo data to pandas dataframe
argo_floats = data_floats.to_dataframe()
# convert argo data to pandas dataframe
argo_floats = data_floats.to_dataframe()
In [39]:
Copied!
# use dataframe with cartopy to create map
plt.figure(figsize = (10, 10))
ax = plt.axes(projection = ccrs.PlateCarree())
extent = [-80, -55, 12, 25]
ax.set_extent(extent)
ax.coastlines()
ax.gridlines()
plt.scatter(x = argo_floats.LONGITUDE,
y = argo_floats.LATITUDE,
c = argo_floats.PRES,
cmap = 'Blues',
marker = '.',
transform = ccrs.PlateCarree())
plt.colorbar(label = 'Pressure (dbar)', shrink = 0.3)
# use dataframe with cartopy to create map
plt.figure(figsize = (10, 10))
ax = plt.axes(projection = ccrs.PlateCarree())
extent = [-80, -55, 12, 25]
ax.set_extent(extent)
ax.coastlines()
ax.gridlines()
plt.scatter(x = argo_floats.LONGITUDE,
y = argo_floats.LATITUDE,
c = argo_floats.PRES,
cmap = 'Blues',
marker = '.',
transform = ccrs.PlateCarree())
plt.colorbar(label = 'Pressure (dbar)', shrink = 0.3)
Out[39]:
<matplotlib.colorbar.Colorbar at 0x7ff00d08f2e0>