Accessing trajectory data#

Within the folder for each float there is also a netCDF file with the data during the time the float was drifting, this is the data not included during the profiling part of the cycle.

First, import libraries:

import numpy as np
import xarray as xr
import netCDF4
from matplotlib import pyplot as plt
%matplotlib inline
Rtraj = xr.open_dataset('../../Data/202107-ArgoData/dac/coriolis/6901254/6901254_Rtraj.nc')
Rtraj
<xarray.Dataset> Size: 2MB
Dimensions:                              (N_PARAM: 3, N_MEASUREMENT: 6853,
                                          N_CYCLE: 103, N_HISTORY: 1774)
Dimensions without coordinates: N_PARAM, N_MEASUREMENT, N_CYCLE, N_HISTORY
Data variables: (12/102)
    DATA_TYPE                            object 8B ...
    FORMAT_VERSION                       object 8B ...
    HANDBOOK_VERSION                     object 8B ...
    REFERENCE_DATE_TIME                  object 8B ...
    DATE_CREATION                        object 8B ...
    DATE_UPDATE                          object 8B ...
    ...                                   ...
    HISTORY_PARAMETER                    (N_HISTORY) object 14kB ...
    HISTORY_PREVIOUS_VALUE               (N_HISTORY) float32 7kB ...
    HISTORY_INDEX_DIMENSION              (N_HISTORY) object 14kB ...
    HISTORY_START_INDEX                  (N_HISTORY) float64 14kB ...
    HISTORY_STOP_INDEX                   (N_HISTORY) float64 14kB ...
    HISTORY_QCTEST                       (N_HISTORY) object 14kB ...
Attributes:
    title:                        Argo float trajectory file
    institution:                  CORIOLIS
    source:                       Argo float
    history:                      2019-01-15T11:25:20Z creation; 2021-06-30T1...
    references:                   http://www.argodatamgt.org/Documentation
    user_manual_version:          3.1
    Conventions:                  Argo-3.1 CF-1.6
    featureType:                  trajectory
    decoder_version:              CODA_043b
    comment_on_resolution:        JULD and PRES variable resolutions depend o...
    comment_on_measurement_code:  Meaning of some specific measurement codes ...

once again the netCDF includes all the meta data to understand the data. Let’s bgin by plotting the actual trayectory of the float.

import cartopy.crs as ccrs
import cartopy

we use cartopy, so we can plot the coastile and the land:

lon=Rtraj.LONGITUDE[~np.isnan(Rtraj.LONGITUDE) & ~np.isnan(Rtraj.LATITUDE)]
lat=Rtraj.LATITUDE[~np.isnan(Rtraj.LONGITUDE) & ~np.isnan(Rtraj.LATITUDE)]

fig,ax = plt.subplots(figsize=(10,10),subplot_kw={'projection': ccrs.PlateCarree()})
ax.plot(lon,lat,'-bo',label='Float surfacing')
ax.plot(lon[0],lat[0],'ok',markersize=12,label='Deployment')
ax.plot(lon[-1],lat[-1],'sk',markersize=12,label='Last surfacing')

ax.add_feature(cartopy.feature.LAND)
ax.add_feature(cartopy.feature.COASTLINE, edgecolor='white')
ax.set_title(f"Data from {Rtraj.PLATFORM_NUMBER.values.astype(str)}")
ax.legend()
ax.gridlines(draw_labels=True, dms=True, x_inline=False, y_inline=False);
../../_images/6f8617c3b099599e68d5cdee7aed2a525702193ddcbfff8673288b0dde5b865a.png

a blue dot for each time the float reached the surface.

We can also plot the observations of Temperature and Salinity, in a TS diagram, during the drifting of the float:

fig,ax = plt.subplots(figsize=(10,10))
sc=ax.scatter(Rtraj.PSAL,Rtraj.TEMP,c=Rtraj.PRES)
ax.set_title(f"Vertical Salinity section for float {Rtraj.PLATFORM_NUMBER.astype(str).values}")
ax.set_xlabel(f"{Rtraj.PSAL.long_name}")
ax.set_ylabel(f"{Rtraj.TEMP.long_name}")
fig.colorbar(sc);
../../_images/b626ce5304aab78f64877acfb7dca44a9d7097a72089330eca496734f2a5d4d3.png

and the time-series of temperature, where we can see that most of the observations are at the parking depth,

fig,ax = plt.subplots(figsize=(15,8))
ax.plot(Rtraj.JULD,Rtraj.PRES,'-')
sc=ax.scatter(Rtraj.JULD,Rtraj.PRES,c=Rtraj.TEMP)
ax.set_xlabel(f"{Rtraj.JULD.standard_name}")
ax.set_ylabel(f"{Rtraj.PRES.long_name}")
ax.invert_yaxis()
fig.colorbar(sc);
../../_images/9d78c1fc8ec4eb407e881a186152af471d74e5dc69ce9322abda73cd94179a99.png

And we can see what observations we have in eacj data point, using the MEASUREMENT_CODE. As indicated in the Ago referente Table 15 of the Argo user’s manual, we have a few observations with code 901, that correspond to “Grounded flag Configuration phas”, in red in the follo

fig,ax = plt.subplots(figsize=(15,8))
ax.plot(Rtraj.JULD,Rtraj.MEASUREMENT_CODE,'o',label='MEASUREMENT_CODE');
ax.plot(Rtraj.JULD[Rtraj.MEASUREMENT_CODE==901],Rtraj.MEASUREMENT_CODE[Rtraj.MEASUREMENT_CODE==901],'ro',label='901');
ax.legend();
../../_images/4072beccff7b9f262565d8aaeab823db1b4d269ec968722c0bd3d6bce4811632.png