:py:mod:`osdyn.grcm.generic` ============================ .. py:module:: osdyn.grcm.generic Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: osdyn.grcm.generic.moawi_dataset osdyn.grcm.generic.moawi osdyn.grcm.generic.ds2class osdyn.grcm.generic.dico4moawi osdyn.grcm.generic.modelmetadata4moawi .. py:function:: 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, wave or ice models :param dspat: [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. :type dspat: dict or [list of] str :param model: "mars, "nemo", "croco", "symphonie", "mesonh" or "ww3". The default is None, and get_dataset function is directly called. :type model: str, optional :param varnames: - 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) :type varnames: list or str, optional :param lons: Specify (lonmin, lonmax) to extract a subdomain. The default is None. :type lons: tuple of real, optional :param lats: Specify (latmin, latmax) to extract a subdomain. The default is None. :type lats: tuple of real, optional :param geocoords: If True, the dimensions of the grid are lon and lat. The default is False. :type geocoords: bool, optional :param gridfile: None or path to the grid file in which the lon, lat, bathymetry (2D fields usually) are saved :type gridfile: str :param \*\*kwargs: 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 :type \*\*kwargs: dict :returns: :rtype: xarray.Dataset with osdyn convention for the field names. .. py:function:: 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 the corresponding dataset in osdyn convention as well as the methods to select subdomain, interpolate data... :param dspat: [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. :type dspat: dict or [list of] str :param model: "mars, "nemo", "croco", "symphonie", "mesonh" or "ww3". The default is None, and get_dataset function is directly called. :type model: str, optional :param varnames: - 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) :type varnames: list or str, optional :param lons: Specify (lonmin, lonmax) to extract a subdomain. The default is None. :type lons: tuple of real, optional :param lats: Specify (latmin, latmax) to extract a subdomain. The default is None. :type lats: tuple of real, optional :param geocoords: If True, the dimensions of the grid are lon and lat. The default is False. :type geocoords: bool, optional :param gridfile: None or path to the grid file in which the lon, lat, bathymetry (2D fields usually) are saved :type gridfile: str :param \*\*kwargs: 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 :type \*\*kwargs: dict :returns: * *Model class in which .ds is a xarray.Dataset complying* * *with osdyn convention.* .. py:function:: ds2class(ds) Introduce a dataset back into its originate class. Concerns datasets estimated from a previous osdyn dataset, through time resampling, climatologic and so on estimates. :param ds: Dataset which must contains the global attribute `model`. :type ds: xarray.Datarray :returns: :rtype: A model class containing the input dataset. .. py:function:: dico4moawi(params) 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``. :param params: "input" section of the parameterization of a script through configobj.ConfigObj. :type params: dict :returns: * **dico** (*dict*) -- Information to reach the NetCDF files. * **subselect** (*dict*) -- Information to select a sub-domain or a few variables. .. py:function:: modelmetadata4moawi(model, subset=None) Get the dictionary defining the pattern of the files to be read. :param model: Name of the model type among `mars`, `nemo`, `croco`, `symphonie`, `ww3`, `mesonh`. :type model: str :param subset: Not implemented yet. :type subset: dict :returns: * **dico** (*dict*) -- Information to reach the NetCDF files. * **subselect** (*dict*) -- Information to select a sub-domain or a few variables. Not implemented yet.