Esempio n. 1
0
    def copy_from_model(cls, model_name, reference, **kwargs):
        """
        Set-up a user-defined grid using specifications of a reference
        grid model.
        
        Parameters
        ----------
        model_name : string
            name of the user-defined grid model.
        reference : string or :class:`CTMGrid` instance
            Name of the reference model (see :func:`get_supported_models`),
            or a :class:`CTMGrid` object from which grid set-up is copied.
        **kwargs
            Any set-up parameter which will override the settings of the
            reference model (see :class:`CTMGrid` parameters).
        
        Returns
        -------
        A :class:`CTMGrid` object.
        
        """
        if isinstance(reference, cls):
            settings = reference.__dict__.copy()
            settings.pop('model')
        else:
            settings = gridspec.get_model_info(reference)
            settings.pop('model_name')

        settings.update(kwargs)
        settings['reference'] = reference

        return cls(model_name, **settings)
Esempio n. 2
0
    def copy_from_model(cls, model_name, reference, **kwargs):
        """
        Set-up a user-defined grid using specifications of a reference
        grid model.

        Parameters
        ----------
        model_name : string
            name of the user-defined grid model.
        reference : string or :class:`CTMGrid` instance
            Name of the reference model (see :func:`get_supported_models`),
            or a :class:`CTMGrid` object from which grid set-up is copied.
        **kwargs
            Any set-up parameter which will override the settings of the
            reference model (see :class:`CTMGrid` parameters).

        Returns
        -------
        A :class:`CTMGrid` object.

        """
        if isinstance(reference, cls):
            settings = reference.__dict__.copy()
            settings.pop('model')
        else:
            settings = gridspec.get_model_info(reference)
            settings.pop('model_name')

        settings.update(kwargs)
        settings['reference'] = reference

        return cls(model_name, **settings)
Esempio n. 3
0
    def from_model(cls, model_name, **kwargs):
        """
        Define a grid using the specifications of a given model.
        
        Parameters
        ----------
        model_name : string
            Name the model (see :func:`get_supported_models` for available
            model names).
            Supports multiple formats (e.g., 'GEOS5', 'GEOS-5' or 'GEOS_5').
        **kwargs : string
            Parameters that override the model  or default grid
          settings (See Other Parameters below).
        
        Returns
        -------
        A :class:`CTMGrid` object.
        
        Other Parameters
        ----------------
        resolution : (float, float)
            Horizontal grid resolution (lon, lat) or (DI, DJ) [degrees]
        Psurf : float
            Average surface pressure [hPa] (default: 1013.15)
        
        Notes
        -----
        Regridded vertical models may have several valid names (e.g.,
        'GEOS5_47L' and 'GEOS5_REDUCED' refer to the same model).
        
        """
        settings = gridspec.get_model_info(model_name)
        model = settings.pop('model_name')
        for k, v in kwargs.items():
            if k in ('resolution', 'Psurf'):
                settings[k] = v

        return cls(model, **settings)
Esempio n. 4
0
    def from_model(cls, model_name, **kwargs):
        """
        Define a grid using the specifications of a given model.

        Parameters
        ----------
        model_name : string
            Name the model (see :func:`get_supported_models` for available
            model names).
            Supports multiple formats (e.g., 'GEOS5', 'GEOS-5' or 'GEOS_5').
        **kwargs : string
            Parameters that override the model  or default grid
          settings (See Other Parameters below).

        Returns
        -------
        A :class:`CTMGrid` object.

        Other Parameters
        ----------------
        resolution : (float, float)
            Horizontal grid resolution (lon, lat) or (DI, DJ) [degrees]
        Psurf : float
            Average surface pressure [hPa] (default: 1013.15)

        Notes
        -----
        Regridded vertical models may have several valid names (e.g.,
        'GEOS5_47L' and 'GEOS5_REDUCED' refer to the same model).

        """
        settings = gridspec.get_model_info(model_name)
        model = settings.pop('model_name')
        for k, v in kwargs.items():
            if k in ('resolution', 'Psurf'):
                settings[k] = v

        return cls(model, **settings)