:py:mod:`pytmosph3r.model.diagfimodel` ====================================== .. py:module:: pytmosph3r.model.diagfimodel Module Contents --------------- .. py:class:: DiagfiModel(t: int = -1, var_dict: Optional[Dict] = None, gas_units: Optional[str] = None, aerosols_units: Optional[str] = None, extra_longitude: bool = True, *args, **kwargs) Bases: :py:obj:`pytmosph3r.model.model.FileModel` Model reading from a diagfi.nc file, from a LMDZ GCM for example. Same parameters as :class:`~pytmosph3r.model.hdf5model.FileModel`, plus the ones listed here. See :class:`~pytmosph3r.interface.inputdata.DiagfiData` for the structure of the diagfi file. To read from a diagfi, you may need the following parameters: :param t: Time slice to read from diagfi input file. If you do not have time-dependent data,set it to False. By default, takes the last time slice. :type t: int :param var_dict: Dictionary listing the names of the variables in the input file. Includes pressure 'p' and temperature 'temp' for now, as well as their surface values, and the surface area. 'u','v' and 'w' are the zonal, meridional and vertical winds, respectively. Defaults to {'p':'p', 'temp':'temp', 'ps':'ps', 'tsurf':'tsurf', 'surface':'aire', 'u':'u', 'v':'v', 'w':'w'}. :type var_dict: dict :param gas_units: Used to indicate what units are in the input file. For example "log_vmr" indicates it is a log of a VMR. Possible units are "vmr", "mmr", "log_vmr", "log_mmr","ln_vmr", "ln_mmr". :type gas_units: str :param aerosols_units: Used to indicate what units are in the input file. For example "log_mmr" indicates it is a log of a MMR. Possible units are "mmr", "log_mmr", "ln_mmr". :type aerosols_units: str :param input_mu: Molar mass (if you need to convert MMR to VMR). :type input_mu: float .. py:attribute:: gas_units Units of gases in input file. .. py:attribute:: aerosols_units Units of aerosols in input file. .. py:attribute:: var_dict Dictionary listing the names of the variables in the input file. This includes pressure 'p' and temperature 'temp', as well as surface pressure and temperature 'ps' and 'tsurf', or the surface 'surface'. 'u','v' and 'w' are the zonal, meridional and vertical winds, respectively. .. py:attribute:: extra_longitude If the last longitude is a duplicate of the first one. .. py:method:: inputs() .. py:method:: read_data() Read data from a diagfi.nc file generated by the LMDZ GCM. The netCDF file should have at least a temperature ``temp`` and a pressure either defined by ``p`` on all grid points or by `ps` the surface pressure and coefficients ``ap``, ``bp`` and ``aps``, ``bps``. For the gas and aerosols descriptions, see :any:`library_input `. The ``controle`` variable should (preferrably) list: #. :math:`n_{longitudes}` (optional, last longitude is a duplicate from the first one) #. :math:`n_{latitudes}` (optional) #. :math:`n_{vertical}` (optional) #. :math:`R_{p}` (planet radius) in `m` #. #NOT USED# #. :math:`g_{0}` (surface gravity) #. :math:`\mu` (molar mass) in `g/mol` (if abundances given in mass mixing ratios) .. py:method:: grid_to_radians(f, grid) Convert latitudes and longitudes to radians. .. py:method:: read_gases(f, controle) Read gases from :attr:`f` file descriptor using :attr:`gas_dict`. .. py:method:: read_aerosols(f) Read aerosols from diagfi using :attr:`aerosols_dict`. Each key should be composed of the name of the aerosol + the entry it corresponds to. The entries we will try to find are: :code:`["mmr", "reff", "condensate_density", "p_min", "optical_properties"]`. Example of a valid dictionary: {'H2O': 'h2o_ice', 'H2O_reff': 'H2Oice_reff'}. .. py:method:: read_winds(f, grid) Read winds from diagfi using :attr:`winds_dict`. Each key should be composed of the name of the aerosol + the entry it corresponds to. The entries we will try to find are: :code:`["mmr", "reff", "condensate_density", "p_min", "optical_properties"]`. Example of a valid dictionary: {'H2O': 'h2o_ice', 'H2O_reff': 'H2Oice_reff'}. .. py:method:: get_var(var, t=None, ndim=3) Try to fit the dimensions of one variable read from the input file. If the attribute :attr:`extra_longitude` of the class is set, we remove one longitude. If :attr:`t`: is not None nor False, we take the corresponding timestep in the simulation. :param var: Raw array read from the input file. :type var: ndarray :param t: Timestep to read in input file. If None, uses the attribute :attr:`t: of the class. If False, does not read any timestep. Defaults to None. :type t: int, optional :param ndim: Check if the output variable has the required number of dimensions `ndim`. Defaults to 3. :type ndim: int, optional :returns: Array at timestep `t` and that should have `ndim` dimensions. :rtype: ndarray .. py:function:: extend_bt(array, surf=None) .. py:function:: extend_b(array, surf=None)