Quick overview

First of all, load osdyn library and set a few environment variables

source env_osdyn_linux.csh

with env_osdyn_linux.csh such as

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
if ( -f "/appli/anaconda/versions/4.8.3/etc/profile.d/conda.csh" ) then
    source "/appli/anaconda/versions/4.8.3/etc/profile.d/conda.csh"
else
    setenv PATH "/appli/anaconda/versions/4.8.3/bin:$PATH"
endif
# <<< conda initialize <<<


# >>> PYTHON environment relative to osdyn >>>
conda activate osdyn
# <<< PYTHON environment relative to osdyn <<<

setenv PYTHONPATH "/path/OSDYN/osdyn/lib"
setenv OSDYN_MODEL mars  (user favorite model outputs among nemo, croco, symphonie, ww3, mesonh...)

Read data to get xarray.Datasets

Here are some quick examples of what you can do with xarray.DataArray objects. Everything is explained in much more detail in the rest of the documentation.

At first, import numpy, pandas and xarray using their customary abbreviations:

In [1]: import os

In [2]: from osdyn.utils.data.io import list_files

In [3]: from osdyn.config import get_config_value

In [4]: from osdyn.grcm.generic import moawi_dataset

The main added value of osdyn, in addition to the availability of diagnostics dedicated to ocean dynamics compared to the data, is the generic reading of datasets and their small transformation (changes of variable name in particular) in order to share the same coding whathever the data source. Here, examples are shown from moawi_dataset.

Note that from the moawi function, one gets a model class with its dataset (modelclass.ds = moawi_dataset result), plus the access to all of the methods relative to the model class, such as modelclass.get_z to get the level depths and so on.

Atmosphere, ocean or wave modelling outputs

Select the files from the database

In [5]: path = get_config_value("osdyn.grcm.mesonh", "path_v5_3")

In [6]: pattern_file = get_config_value("osdyn.grcm.mesonh", "pattern_obc_v5_3")

In [7]: pattern_date = eval(get_config_value("osdyn.grcm.mesonh", "period_v5_3"))

In [8]: infiles = list_files(os.path.join(path, pattern_file), pattern_date)
Found 2 files

In [9]: pattern_file
Out[9]: 'D2_%Y%m%d_%H0000.nc4'

In [10]: pattern_date
Out[10]: ('2011-09-02 15:00:00', '2011-09-02 16:00:00')

In [11]: infiles
Out[11]: 
['/home/datawork-lops-siam-moawi/PROJECTS/OSDYN/DATA/MODELS/MNH/V53/D2_20110902_150000.nc4',
 '/home/datawork-lops-siam-moawi/PROJECTS/OSDYN/DATA/MODELS/MNH/V53/D2_20110902_160000.nc4']

Get the common MesoNH fields of interest for an oceanographer

In [12]: moawi_dataset(infiles, model="mesonh")
Out[12]: 
<xarray.Dataset>
Dimensions:        (ny_g: 128, nx_c: 128, nx_g: 128, ny_c: 128, nz_c: 100, nz_g: 101, nt: 2)
Coordinates: (12/26)
  * ny_g           (ny_g) float64 2.5 3.5 4.5 5.5 ... 126.5 127.5 128.5 129.5
  * nx_c           (nx_c) float64 2.0 3.0 4.0 5.0 ... 126.0 127.0 128.0 129.0
  * nx_g           (nx_g) float64 2.5 3.5 4.5 5.5 ... 126.5 127.5 128.5 129.5
  * ny_c           (ny_c) float64 2.0 3.0 4.0 5.0 ... 126.0 127.0 128.0 129.0
  * nz_c           (nz_c) int64 1 2 3 4 5 6 7 8 9 ... 93 94 95 96 97 98 99 100
  * nz_g           (nz_g) float64 0.5 1.5 2.5 3.5 4.5 ... 97.5 98.5 99.5 100.5
    ...             ...
    lon_t          (ny_c, nx_c) float64 -6.216 -6.199 -6.182 ... -4.084 -4.067
    lat_t          (ny_c, nx_c) float64 47.66 47.66 47.66 ... 49.09 49.09 49.09
    lat_u          (ny_c, nx_g) float64 47.66 47.66 47.66 ... 49.09 49.09 49.09
    lon_v          (ny_g, nx_c) float64 -6.216 -6.199 -6.182 ... -4.084 -4.067
    lon_f          (ny_g, nx_g) float64 -6.225 -6.208 -6.191 ... -4.092 -4.075
    lat_f          (ny_g, nx_g) float64 47.66 47.66 47.66 ... 49.08 49.08 49.08
Data variables: (12/37)
    rain_sfc       (nt, ny_c, nx_c) float64 dask.array<chunksize=(1, 128, 128), meta=np.ndarray>
    precip_down    (nt, ny_c, nx_c) float64 dask.array<chunksize=(1, 128, 128), meta=np.ndarray>
    hs             (nt, ny_c, nx_c) float64 dask.array<chunksize=(1, 128, 128), meta=np.ndarray>
    pres           (nt, nz_c, ny_c, nx_c) float64 dask.array<chunksize=(1, 100, 128, 128), meta=np.ndarray>
    salt_sfc       (nt, ny_c, nx_c) float64 dask.array<chunksize=(1, 128, 128), meta=np.ndarray>
    temp_sfc       (nt, ny_c, nx_c) float64 dask.array<chunksize=(1, 128, 128), meta=np.ndarray>
    ...             ...
    corio_t        (ny_c, nx_c) float64 0.0001078 0.0001078 ... 0.0001102
    corio_u        (ny_c, nx_g) float64 0.0001078 0.0001078 ... 0.0001102
    corio_v        (ny_g, nx_c) float64 0.0001078 0.0001078 ... 0.0001102
    corio_f        (ny_g, nx_g) float64 0.0001078 0.0001078 ... 0.0001102
    xwnd_sfc       (nt, ny_c, nx_g) float64 dask.array<chunksize=(1, 128, 128), meta=np.ndarray>
    ywnd_sfc       (nt, ny_g, nx_c) float64 dask.array<chunksize=(1, 128, 128), meta=np.ndarray>
Attributes:
    model:    MesoNH

Let’s select a few variables and a subdomain of a WW3 output.

The files of interest are :

In [13]: fndict = {
   ....:     "path": get_config_value("osdyn.grcm.ww3", "path_hindcast"),
   ....:     "pattern_file": get_config_value(
   ....:         "osdyn.grcm.ww3", "pattern_file_hindcast"
   ....:     ),
   ....:     "pattern_date": eval(
   ....:         get_config_value("osdyn.grcm.ww3", "period_hindcast")
   ....:     ),
   ....:     "savedbyvar": get_config_value(
   ....:         "osdyn.grcm.ww3", "savedbyvar_hindcast"
   ....:     ),
   ....: }
   ....: 

In [14]: fndict
Out[14]: 
{'path': '/home/datawork-WW3/HINDCAST/MEDNORD/2013_ECMWF',
 'pattern_file': 'WW3-MENOR-2M_%Y%m_*.nc',
 'pattern_date': ('2013-08-12 15:00:00', '2013-10-02 16:00:00'),
 'savedbyvar': 'True'}

and the dataset :

In [15]: moawi_dataset(fndict, model="ww3", varnames=["foc", "hs", "mapsta"], lons=(5.5, 10), lats=(40.0, 43.5), decode_times=True)
Found 87 files
Out[15]: 
<xarray.Dataset>
Dimensions:  (ny_c: 107, nx_c: 93, nt: 736)
Coordinates:
  * ny_c     (ny_c) float64 1.0 2.0 3.0 4.0 5.0 ... 104.0 105.0 106.0 107.0
  * nx_c     (nx_c) float64 130.0 131.0 132.0 133.0 ... 219.0 220.0 221.0 222.0
  * nt       (nt) int64 0 1 2 3 4 5 6 7 8 ... 728 729 730 731 732 733 734 735
    time     (nt) datetime64[ns] 2013-08-01 ... 2013-10-31T21:00:00
    lon_t    (nx_c) float32 5.45 5.5 5.55 5.6 5.65 ... 9.85 9.9 9.95 10.0 10.05
    lat_t    (ny_c) float32 40.0 40.03 40.07 40.1 ... 43.43 43.47 43.5 43.53
    x_t      (nx_c) float64 5.492e+05 5.534e+05 ... 9.366e+05 9.408e+05
    y_t      (ny_c) float64 0.0 3.706e+03 7.413e+03 ... 3.892e+05 3.929e+05
Data variables:
    mapsta   (ny_c, nx_c) int16 dask.array<chunksize=(107, 93), meta=np.ndarray>
    foc      (nt, ny_c, nx_c) float32 dask.array<chunksize=(248, 107, 93), meta=np.ndarray>
    hs       (nt, ny_c, nx_c) float32 dask.array<chunksize=(248, 107, 93), meta=np.ndarray>
    dx_t     (nx_c) float64 4.257e+03 4.257e+03 ... 4.257e+03 4.257e+03
    dy_t     (ny_c) float64 3.707e+03 3.706e+03 ... 3.707e+03 3.706e+03
    dxdy_t   (nx_c, ny_c) float64 1.578e+07 1.578e+07 ... 1.578e+07 1.578e+07
    corio_t  (ny_c) float32 9.375e-05 9.381e-05 ... 0.0001004 0.0001005
Attributes:
    model:    WW3

And what about NEMO ?

In [16]: dico = {
   ....:     "path": get_config_value(
   ....:         "osdyn.grcm.nemo", "path_medrys1v1_menor"
   ....:     ),
   ....:     "pattern_file": get_config_value(
   ....:         "osdyn.grcm.nemo", "pattern_medrys1v1_menor"
   ....:     ),
   ....:     "pattern_date": ("2013-01-01", "2013-01-09"),
   ....: }
   ....: 

In [17]: dico
Out[17]: 
{'path': '/home/datawork-lops-siam-moawi/PROJECTS/OSDYN/DATA/MODELS/NEMO',
 'pattern_file': 'MENOR_MEDRYS1V1_1dAV_%Y%m%d_????????_grid*_R????????.nc',
 'pattern_date': ('2013-01-01', '2013-01-09')}
In [18]: moawi_dataset(dico, model="nemo", decode_times=True, varnames=["z_sfc", "xcur"])
Found 45 files
Out[18]: 
<xarray.Dataset>
Dimensions:  (nx_g: 206, nz_c: 75, nt: 9, ny_c: 106, nx_c: 206, ny_g: 106)
Coordinates:
  * nx_g     (nx_g) float64 1.5 2.5 3.5 4.5 5.5 ... 203.5 204.5 205.5 206.5
  * nz_c     (nz_c) float64 1.0 2.0 3.0 4.0 5.0 6.0 ... 71.0 72.0 73.0 74.0 75.0
  * nt       (nt) int64 0 1 2 3 4 5 6 7 8
    lon_t    (ny_c, nx_c) float32 ...
    lat_t    (ny_c, nx_c) float32 ...
    lon_u    (ny_c, nx_g) float32 ...
    lat_u    (ny_c, nx_g) float32 ...
    time     (nt) datetime64[ns] 2013-01-01T12:00:00 ... 2013-01-09T12:00:00
  * nx_c     (nx_c) float64 1.0 2.0 3.0 4.0 5.0 ... 203.0 204.0 205.0 206.0
  * ny_c     (ny_c) float64 1.0 2.0 3.0 4.0 5.0 ... 103.0 104.0 105.0 106.0
  * ny_g     (ny_g) float64 1.5 2.5 3.5 4.5 5.5 ... 103.5 104.5 105.5 106.5
    z_t      (nz_c) float32 -0.5165 -1.622 -2.848 ... -4.683e+03 -4.817e+03
Data variables:
    z_sfc    (nt, ny_c, nx_c) float32 dask.array<chunksize=(1, 106, 206), meta=np.ndarray>
    xcur     (nt, nz_c, ny_c, nx_g) float32 dask.array<chunksize=(1, 75, 106, 206), meta=np.ndarray>
Attributes:
    model:    Nemo

Same way for CROCO !

In [19]: dico = {
   ....:     "path": get_config_value(
   ....:         "osdyn.grcm.croco", "path_menor"
   ....:     ),
   ....:     "pattern_file": get_config_value(
   ....:         "osdyn.grcm.croco", "pattern_file_menor"
   ....:     ),
   ....:     "pattern_date": ("2013-01-01", "2013-01-09"),
   ....: }
   ....: 

In [20]: dico
Out[20]: 
{'path': '/home/datawork-lops-siam-moawi/PROJECTS/OSDYN/DATA/MODELS/CROCO/MENOR1.2/CROCO_FILES',
 'pattern_file': 'croco1200_%Y%m%d_ok_ini.nc',
 'pattern_date': ('2013-01-01', '2013-01-09')}
In [21]: moawi_dataset(dico, model="croco", decode_times=True, varnames=["z_sfc", "xcur"])
Found 1 files
Out[21]: 
<xarray.Dataset>
Dimensions:     (nz_g: 81, nz_c: 80, nt: 1, ny_c: 463, nx_c: 1157, nx_g: 1156, ny_g: 462)
Coordinates: (12/14)
  * nz_g        (nz_g) float64 0.5 1.5 2.5 3.5 4.5 ... 76.5 77.5 78.5 79.5 80.5
  * nz_c        (nz_c) float64 1.0 2.0 3.0 4.0 5.0 ... 76.0 77.0 78.0 79.0 80.0
  * nt          (nt) int64 0
  * nx_c        (nx_c) float64 1.0 2.0 3.0 4.0 ... 1.155e+03 1.156e+03 1.157e+03
  * nx_g        (nx_g) float64 1.5 2.5 3.5 4.5 ... 1.154e+03 1.156e+03 1.156e+03
  * ny_c        (ny_c) float64 1.0 2.0 3.0 4.0 5.0 ... 460.0 461.0 462.0 463.0
    ...          ...
    lon_u       (ny_c, nx_g) float64 ...
    lat_u       (ny_c, nx_g) float64 ...
    time        (nt) float64 9.969e+36
  * ny_g        (ny_g) float64 1.5 2.5 3.5 4.5 5.5 ... 459.5 460.5 461.5 462.5
    sc_t        (nz_c) float64 -0.9938 -0.9813 -0.9688 ... -0.01875 -0.00625
    sc_w        (nz_g) float64 -1.0 -0.9875 -0.975 ... -0.025 -0.0125 0.0
Data variables:
    z_sfc       (nt, ny_c, nx_c) float64 ...
    xcur        (nt, nz_c, ny_c, nx_g) float64 ...
    h_t         (ny_c, nx_c) float64 6.0 6.0 6.0 6.0 6.0 ... 6.0 6.0 6.0 6.0 6.0
    sc_cs_t     (nz_c) float64 ...
    sc_cs_w     (nz_g) float64 ...
    hc          float64 ...
    sc_subtype  float64 ...
Attributes:
    model:    Croco

The default option reads NetCDF files in which the longitude and latitude are axes

In [22]: dico = {
   ....:     "path": get_config_value("osdyn.grcm.ecmwf", "path"),
   ....:     "pattern_file": get_config_value("osdyn.grcm.ecmwf", "pattern_file"),
   ....:     "pattern_date": eval(get_config_value("osdyn.grcm.ecmwf", "period")),
   ....: }
   ....: 

In [23]: dico
Out[23]: 
{'path': '/home/datawork-lops-siam-moawi/PROJECTS/AMICO/MENOR/FORCING/FROMWW3/ECMWF',
 'pattern_file': 'wind_%Y.nc',
 'pattern_date': ('2013-01-01', '2013-12-31 00:00:00')}
In [24]: moawi_dataset(dico, decode_times=True)
Found 1 files
Out[24]: 
<xarray.Dataset>
Dimensions:   (ny_c: 57, nx_c: 137, nt: 9504)
Coordinates:
  * ny_c      (ny_c) float64 1.0 2.0 3.0 4.0 5.0 ... 53.0 54.0 55.0 56.0 57.0
  * nx_c      (nx_c) float64 1.0 2.0 3.0 4.0 5.0 ... 134.0 135.0 136.0 137.0
  * nt        (nt) int64 0 1 2 3 4 5 6 7 ... 9497 9498 9499 9500 9501 9502 9503
    time      (nt) datetime64[ns] 2012-12-01 ... 2013-12-31T23:00:00
    lon_t     (nx_c) float32 0.0 0.125 0.25 0.375 0.5 ... 16.62 16.75 16.88 17.0
    lat_t     (ny_c) float32 38.0 38.12 38.25 38.38 ... 44.62 44.75 44.88 45.0
    x_t       (nx_c) float64 0.0 1.093e+04 2.187e+04 ... 1.476e+06 1.487e+06
    y_t       (ny_c) float64 0.0 1.39e+04 2.78e+04 ... 7.645e+05 7.784e+05
Data variables:
    xwnd_10m  (nt, ny_c, nx_c) float32 ...
    ywnd_10m  (nt, ny_c, nx_c) float32 ...
    dx_t      (nx_c) float64 1.093e+04 1.093e+04 ... 1.093e+04 1.093e+04
    dy_t      (ny_c) float64 1.39e+04 1.39e+04 1.39e+04 ... 1.39e+04 1.39e+04
    dxdy_t    (nx_c, ny_c) float64 1.52e+08 1.52e+08 ... 1.52e+08 1.52e+08
    corio_t   (ny_c) float32 8.979e-05 9.004e-05 ... 0.0001029 0.0001031
Attributes:
    model:    Basic

So, you can select your variable of interest by using osdyn keynames and without knowing the real name in the netCDF file. Readers for MesoNH, WW3, Mars, Nemo, Croco and Symphonie, PREVIMER database,… are available. If the default reader does not fit your data, feel free to add a new reader or ask for a new one.

Observations

A reader has been developped for each type of observation. For instance, to read CTOH - Xtrack product, the use of the dedicated class allows you to read the data and and perform a few estimates or plottings.

In [25]: from osdyn.obs.satellite.xtrack import XTrack

In [26]: from osdyn.config import data_sample

In [27]: J222 = XTrack(data_sample('ctoh.sla.ref.J2.medsea.222.nc'))

In [28]: J222.modify_coords(xaxis='lat',taxis='time')

In [29]: J222.ds
Out[29]: 
<xarray.Dataset>
Dimensions:               (lat: 197, times: 300)
Coordinates:
  * lat                   (lat) float32 32.83 32.87 32.92 ... 43.24 43.29 43.33
  * times                 (times) datetime64[ns] 2008-07-20T16:40:19.466400 ....
Data variables:
    lon                   (lat) float32 ...
    mssh                  (lat) float32 ...
    point                 (lat) int32 ...
    dist_to_coast_gshhs   (lat) float64 ...
    dist_to_coast_stumpf  (lat) float64 ...
    mdt_cnes_cls_09_med   (lat) float32 ...
    cycle                 (times) float64 1.0 2.0 3.0 4.0 ... 301.0 302.0 303.0
    time                  (lat, times) object 2008-07-20 16:40:19.466400 ... ...
    sla                   (lat, times) float32 -0.1256 0.04334 ... -0.01369
    tide                  (lat, times) float32 0.1438 0.1157 ... -0.0262 0.0281
    dac                   (lat, times) float32 -0.0276 -0.0262 ... -0.0835
Attributes:
    title:        CTOH Along track Sea Level Anomalies
    institution:  CTOH/LEGOS, Toulouse Univ., CNRS, IRD, CNES, UPS, France
    Conventions:  CF-1.6
    history:      creation: 2017/07/12
    contact:      ctoh_products@legos.obs-mip.fr  http://ctoh.legos.obs-mip.fr
    source:       Version X-TRACK: 1.02 - Version mercurial: hgf253ee15e44d
    doi:          10.6096/CTOH_X-TRACK_2017_02
    reference:    Birol, F. et al. “Coastal Applications from Nadir Altimetry...
    NCO:          4.0.9

Here, you have read the NetCDF file from the XTrack class. The xarray.Dataset is available from J222.ds. The default Then you can estimate the distances along the track,

In [30]: J222.distance_along_track(J222.ds.lon, J222.ds.lat, cumulative=True)
Out[30]: 
array([      0.        ,    4608.42422783,   10492.61224828,
         16340.44148702,   22233.80283296,   28096.52289056,
         33968.74882999,   39830.72527238,   45706.18045526,
         51582.79745447,   57447.37114025,   63324.87439351,
         69188.07572416,   75058.89245062,   80969.96839208,
         86844.89555601,   92735.9143537 ,   98597.48157785,
        104474.96043535,  110361.22649877,  116217.46437988,
        122114.38349575,  127985.52315109,  133854.83446238,
        139728.1981933 ,  145627.52656362,  151478.08956636,
        157353.30783351,  163240.2744569 ,  169097.04612672,
        174973.1073124 ,  180822.2924863 ,  186701.57024976,
        192563.34041452,  198444.8068391 ,  204321.32768823,
        210195.05513356,  216064.80474574,  221934.96949013,
        227785.47278131,  233677.52535301,  239542.9252751 ,
        245410.01547065,  251276.12887624,  257146.43744955,
        263012.23378336,  268884.4640329 ,  274749.43203166,
        280634.04149152,  286493.68887736,  292368.65549224,
        298254.78188545,  304094.61459476,  309974.52387022,
        315856.06448916,  321710.33945384,  327580.08014568,
        333450.90262528,  339336.552872  ,  345213.26083491,
        351070.5355848 ,  356924.01048893,  362781.28493608,
        368636.20119441,  374502.71619825,  380373.78480682,
        386244.6170198 ,  392100.27489023,  397946.46693538,
        403830.77113813,  409707.62729671,  415542.31869195,
        421384.95936119,  427254.8422392 ,  433125.71245187,
        439019.53422673,  444850.99111082,  450729.79627316,
        456595.08889692,  462486.47155834,  468371.37789579,
        474220.06207823,  480072.03765304,  485941.00066008,
        491791.44071781,  497618.45840982,  503501.89526853,
        509349.83526925,  515227.69346897,  521083.07285621,
        526934.24074354,  532814.50793249,  538662.81488036,
        544537.19828082,  550412.1679151 ,  556253.35765775,
        562108.39072911,  567987.9008792 ,  573826.72641174,
        579642.64053998,  585521.99352089,  591349.16956856,
        597203.91941722,  603056.19737661,  608901.3226738 ,
        614774.16132092,  620637.58195162,  626494.94146912,
        632353.43006391,  638201.19888874,  644032.29021176,
        649892.18076572,  655749.12763084,  661613.82095628,
        667463.44685869,  673290.60310002,  679123.63409321,
        684958.37043977,  690818.28595414,  696649.17570863,
        702483.56503182,  708349.35071103,  714183.09611637,
        720056.74846408,  725905.22074103,  731749.83652468,
        737614.64606574,  743475.49595029,  749297.4801664 ,
        755115.70627142,  760942.92930545,  766765.58929533,
        772630.60051983,  778447.59321708,  784248.65583036,
        790106.71396858,  795987.42333363,  801811.42755977,
        807692.48587321,  813562.43828688,  819389.99674996,
        825153.81120077,  830322.15385559,  837180.43789278,
       1017983.86272406, 1023672.03126191, 1029503.05488697,
       1035340.6256519 , 1041177.35123536, 1047042.0614718 ,
       1052877.42592766, 1058728.28502395, 1064555.69398795,
       1070407.0068423 , 1076243.66102927, 1082083.97956952,
       1087908.31777077, 1093759.0562486 , 1099579.55523319,
       1105395.21151695, 1111236.19612626, 1117094.83730197,
       1122920.11520068, 1128720.07999927, 1134558.17602259,
       1140377.4516941 , 1146180.13119011, 1152003.34322775,
       1157836.52828192, 1163610.47996544, 1169428.50191388,
       1175255.36981619, 1181083.47366826, 1186886.77015769,
       1192730.79812999, 1198528.10136652, 1204341.92733314,
       1210123.81010341, 1215931.24729368, 1221743.90164096,
       1227552.23869292, 1233390.72705539, 1239221.87986215,
       1245066.1276022 , 1250890.46198755, 1256760.99704715,
       1262583.76685469, 1268375.34896659, 1274221.47511178,
       1280062.72880882, 1285930.89984596, 1291752.60876032,
       1297595.82906349, 1303426.0411808 , 1309216.950937  ,
       1315035.2523592 , 1320643.01080718])

In [31]: J222.ds
Out[31]: 
<xarray.Dataset>
Dimensions:               (lat: 197, times: 300)
Coordinates:
  * lat                   (lat) float32 32.83 32.87 32.92 ... 43.24 43.29 43.33
  * times                 (times) datetime64[ns] 2008-07-20T16:40:19.466400 ....
Data variables:
    lon                   (lat) float32 ...
    mssh                  (lat) float32 ...
    point                 (lat) int32 ...
    dist_to_coast_gshhs   (lat) float64 ...
    dist_to_coast_stumpf  (lat) float64 ...
    mdt_cnes_cls_09_med   (lat) float32 ...
    cycle                 (times) float64 1.0 2.0 3.0 4.0 ... 301.0 302.0 303.0
    time                  (lat, times) object 2008-07-20 16:40:19.466400 ... ...
    sla                   (lat, times) float32 -0.1256 0.04334 ... -0.01369
    tide                  (lat, times) float32 0.1438 0.1157 ... -0.0262 0.0281
    dac                   (lat, times) float32 -0.0276 -0.0262 ... -0.0835
Attributes:
    title:        CTOH Along track Sea Level Anomalies
    institution:  CTOH/LEGOS, Toulouse Univ., CNRS, IRD, CNES, UPS, France
    Conventions:  CF-1.6
    history:      creation: 2017/07/12
    contact:      ctoh_products@legos.obs-mip.fr  http://ctoh.legos.obs-mip.fr
    source:       Version X-TRACK: 1.02 - Version mercurial: hgf253ee15e44d
    doi:          10.6096/CTOH_X-TRACK_2017_02
    reference:    Birol, F. et al. “Coastal Applications from Nadir Altimetry...
    NCO:          4.0.9

or estimate the geostrophic velocities

In [32]: J222.geostrophy('sla')

In [33]: J222.ds
Out[33]: 
<xarray.Dataset>
Dimensions:               (lat: 197, times: 300)
Coordinates:
  * lat                   (lat) float32 32.83 32.87 32.92 ... 43.24 43.29 43.33
  * times                 (times) datetime64[ns] 2008-07-20T16:40:19.466400 ....
Data variables:
    lon                   (lat) float32 ...
    mssh                  (lat) float32 ...
    point                 (lat) int32 ...
    dist_to_coast_gshhs   (lat) float64 ...
    dist_to_coast_stumpf  (lat) float64 ...
    mdt_cnes_cls_09_med   (lat) float32 ...
    cycle                 (times) float64 1.0 2.0 3.0 4.0 ... 301.0 302.0 303.0
    time                  (lat, times) object 2008-07-20 16:40:19.466400 ... ...
    sla                   (lat, times) float32 -0.1256 0.04334 ... -0.01369
    tide                  (lat, times) float32 0.1438 0.1157 ... -0.0262 0.0281
    dac                   (lat, times) float32 -0.0276 -0.0262 ... -0.0835
    vgeos                 (lat, times) float32 -0.7442 3.342 ... 0.9653 0.3717
Attributes:
    title:        CTOH Along track Sea Level Anomalies
    institution:  CTOH/LEGOS, Toulouse Univ., CNRS, IRD, CNES, UPS, France
    Conventions:  CF-1.6
    history:      creation: 2017/07/12
    contact:      ctoh_products@legos.obs-mip.fr  http://ctoh.legos.obs-mip.fr
    source:       Version X-TRACK: 1.02 - Version mercurial: hgf253ee15e44d
    doi:          10.6096/CTOH_X-TRACK_2017_02
    reference:    Birol, F. et al. “Coastal Applications from Nadir Altimetry...
    NCO:          4.0.9

and do some interanual statistics… or specific oceanic diagnostics…

See dedicated notebooks for more details and other type of observations from Tutorials.

Way to get the data

For each type of downloaded type of data, a descriptive .cfg file has been written and saved under $PYTHONPATH/osdyn/database/desc. It allows us to know how to get the data. The scientific reference, the handbook as well as the way to cite are also registered.

[download]
host = "ftp.aviso.altimetry.fr"
remote_path = "regional-xtrack-coastal/version_x_track_2017_02/SLA_1Hz_201706/MEDSEA"
username = aviso_username
passwd = aviso_passwd

[reference]
ref = "Birol, F., N. Fuller, F. Lyard, M. Cancet, F. Niño, C. Delebecque, S. Fleury, F. Toublanc, A. Melet, M. Saraceno, F. Léger, 2017. “Coastal Applications from Nadir Altimetry: Example of the X-TRACK Regional Products.” Advances in Space Research, 2017, 59 (4), p.936-953. doi:10.1016/j.asr.2016.11.005."
user_hdbk = "hdbk_XTRACK_CTOH.pdf"
acknowledgement = ""

From this file named xtrack.cfg, the data have been retrieved by ftp via download_ftp_tree.py).

At first, register to the data operational centers to get your login and password.

Diagnostics

To guide the user, many notebooks are available from Tutorials. The list is continuously increased.

Some complete scripts are available under osapp-tools repositery and their results shown from TODO.

Any script_name.py comes with two configuration files script_name.ini and script_name.cfg. The user is invited to parameterize the .cfg file and launch the script

python script_name.py

The script first reads the default parameters (in .ini file) and re-assigns them if asked thanks to the specifications in .cfg file. It saves the parameters into a run_name.cfg file. Then the script runs the main program.

Any parameter can be modified at the launch of the script through its arguments:

python script_name.py --input.model nemo

Note

“model” must be defined in the “input” section of one of the configuration files.

Also note that new parameters can be added, both from the .cfg file (under section or not) or from arguments passed to the script.