osdyn.grcm.generic

Module Contents

Functions

moawi_dataset(dspat, model=None, varnames=None, lons=None, lats=None, geocoords=True, gridfile=None, **kwargs)

Read and get the xarray dataset of the outputs of ocean, atmosphere,

moawi(dspat, model=None, varnames=None, lons=None, lats=None, geocoords=True, gridfile=None, **kwargs)

Reading of the outputs of ocean, atmosphere, wave or ice models and return

ds2class(ds)

Introduce a dataset back into its originate class.

dico4moawi(params)

Create the dictionary defining the pattern of the files to be read

modelmetadata4moawi(model, subset=None)

Get the dictionary defining the pattern of the files to be read.

osdyn.grcm.generic.moawi_dataset(dspat, model=None, varnames=None, lons=None, lats=None, geocoords=True, gridfile=None, **kwargs)[source]

Read and get the xarray dataset of the outputs of ocean, atmosphere, wave or ice models

Parameters
  • dspat (dict or [list of] str) –

    [List of] file[s] or patterns in dict to select the files.
    • if dict ({‘path’: x, ‘pattern_file’: x, ‘pattern_date’: x}), the list of files is obtained from list_files function.

    • if str, list_files function return a list according to the filename.

    • if list of files, nothing more is done.

  • model (str, optional) – “mars, “nemo”, “croco”, “symphonie”, “mesonh” or “ww3”. The default is None, and get_dataset function is directly called.

  • varnames (list or str, optional) –

    • list of Variable names to be read. Use osdyn key names.

    • ’all’ or ‘phys’ (default) for MesoNH reading

    The default is None, no selection is applied (but ‘phys’ for mesonh)

  • lons (tuple of real, optional) – Specify (lonmin, lonmax) to extract a subdomain. The default is None.

  • lats (tuple of real, optional) – Specify (latmin, latmax) to extract a subdomain. The default is None.

  • geocoords (bool, optional) – If True, the dimensions of the grid are lon and lat. The default is False.

  • gridfile (str) – None or path to the grid file in which the lon, lat, bathymetry (2D fields usually) are saved

  • **kwargs (dict) – To pass specific argument for xarray, dask as well as WW3 and MesoNH purposes especially. - xarray : decode_cf=True, decode_times=False - all models : times = list, tuple… to select a period - WW3 : {“partition”: True} - MesoNH : spec=”_sea” to specify the field names

Returns

Return type

xarray.Dataset with osdyn convention for the field names.

osdyn.grcm.generic.moawi(dspat, model=None, varnames=None, lons=None, lats=None, geocoords=True, gridfile=None, **kwargs)[source]

Reading of the outputs of ocean, atmosphere, wave or ice models and return the corresponding dataset in osdyn convention as well as the methods to select subdomain, interpolate data…

Parameters
  • dspat (dict or [list of] str) –

    [List of] file[s] or patterns in dict to select the files.
    • if dict ({‘path’: x, ‘pattern_file’: x, ‘pattern_date’: x}), the list of files is obtained from list_files function.

    • if str, list_files function return a list according to the filename.

    • if list of files, nothing more is done.

  • model (str, optional) – “mars, “nemo”, “croco”, “symphonie”, “mesonh” or “ww3”. The default is None, and get_dataset function is directly called.

  • varnames (list or str, optional) –

    • list of Variable names to be read. Use osdyn key names.

    • ’all’ or ‘phys’ (default) for MesoNH reading

    The default is None, no selection is applied (but ‘phys’ for mesonh)

  • lons (tuple of real, optional) – Specify (lonmin, lonmax) to extract a subdomain. The default is None.

  • lats (tuple of real, optional) – Specify (latmin, latmax) to extract a subdomain. The default is None.

  • geocoords (bool, optional) – If True, the dimensions of the grid are lon and lat. The default is False.

  • gridfile (str) – None or path to the grid file in which the lon, lat, bathymetry (2D fields usually) are saved

  • **kwargs (dict) – To pass specific argument for xarray, dask as well as WW3 and MesoNH purposes especially. - xarray : decode_cf=True, decode_times=False - all models : times = list, tuple… to select a period - WW3 : {“partition”: True} - MesoNH : spec=”_sea” to specify the field names

Returns

  • Model class in which .ds is a xarray.Dataset complying

  • with osdyn convention.

osdyn.grcm.generic.ds2class(ds)[source]

Introduce a dataset back into its originate class. Concerns datasets estimated from a previous osdyn dataset, through time resampling, climatologic and so on estimates.

Parameters

ds (xarray.Datarray) – Dataset which must contains the global attribute model.

Returns

Return type

A model class containing the input dataset.

osdyn.grcm.generic.dico4moawi(params)[source]

Create the dictionary defining the pattern of the files to be read as well as the variables and sub-domain to be read. All the information comes from the argument params.

Parameters

params (dict) – “input” section of the parameterization of a script through configobj.ConfigObj.

Returns

  • dico (dict) – Information to reach the NetCDF files.

  • subselect (dict) – Information to select a sub-domain or a few variables.

osdyn.grcm.generic.modelmetadata4moawi(model, subset=None)[source]

Get the dictionary defining the pattern of the files to be read.

Parameters
  • model (str) – Name of the model type among mars, nemo, croco, symphonie, ww3, mesonh.

  • subset (dict) – Not implemented yet.

Returns

  • dico (dict) – Information to reach the NetCDF files.

  • subselect (dict) – Information to select a sub-domain or a few variables. Not implemented yet.