Skip to content

Commit

Permalink
Merge branch 'main' into update_adjust_time
Browse files Browse the repository at this point in the history
  • Loading branch information
malininae authored Sep 11, 2024
2 parents edf1878 + 21ce35a commit a2eb517
Show file tree
Hide file tree
Showing 23 changed files with 1,121 additions and 343 deletions.
11 changes: 6 additions & 5 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,20 +438,21 @@

# Configuration for intersphinx
intersphinx_mapping = {
'cf_units': ('https://cf-units.readthedocs.io/en/latest/', None),
'cf_units': ('https://cf-units.readthedocs.io/en/stable/', None),
'cftime': ('https://unidata.github.io/cftime/', None),
'esmvalcore':
(f'https://docs.esmvaltool.org/projects/ESMValCore/en/{rtd_version}/',
None),
'esmvaltool': (f'https://docs.esmvaltool.org/en/{rtd_version}/', None),
'esmpy': ('https://earthsystemmodeling.org/esmpy_doc/release/latest/html/',
None),
'dask': ('https://docs.dask.org/en/stable/', None),
'distributed': ('https://distributed.dask.org/en/stable/', None),
'iris': ('https://scitools-iris.readthedocs.io/en/latest/', None),
'iris-esmf-regrid': ('https://iris-esmf-regrid.readthedocs.io/en/latest',
None),
'iris': ('https://scitools-iris.readthedocs.io/en/stable/', None),
'esmf_regrid': ('https://iris-esmf-regrid.readthedocs.io/en/stable/', None),
'matplotlib': ('https://matplotlib.org/stable/', None),
'numpy': ('https://numpy.org/doc/stable/', None),
'pyesgf': ('https://esgf-pyclient.readthedocs.io/en/latest/', None),
'pyesgf': ('https://esgf-pyclient.readthedocs.io/en/stable/', None),
'python': ('https://docs.python.org/3/', None),
'scipy': ('https://docs.scipy.org/doc/scipy/', None),
}
Expand Down
45 changes: 15 additions & 30 deletions doc/quickstart/find_data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -398,32 +398,17 @@ ESMValCore can automatically make native ICON data `UGRID
loading the data.
The UGRID conventions provide a standardized format to store data on
unstructured grids, which is required by many software packages or tools to
work correctly.
work correctly and specifically by Iris to interpret the grid as a
:ref:`mesh <iris:ugrid>`.
An example is the horizontal regridding of native ICON data to a regular grid.
While the built-in :ref:`nearest scheme <built-in regridding
schemes>` can handle unstructured grids not in UGRID format, using more complex
regridding algorithms (for example provided by the
:doc:`iris-esmf-regrid:index` package through :ref:`generic regridding
schemes`) requires the input data in UGRID format.
The following code snippet provides a preprocessor that regrids native ICON
data to a 1°x1° grid using `ESMF's first-order conservative regridding
algorithm <https://earthsystemmodeling.org/regrid/#regridding-methods>`__:

.. code-block:: yaml
preprocessors:
regrid_icon:
regrid:
target_grid: 1x1
scheme:
reference: esmf_regrid.schemes:ESMFAreaWeighted
While the :ref:`built-in regridding schemes <default regridding schemes>`
`linear` and `nearest` can handle unstructured grids (i.e., not UGRID-compliant) and meshes (i.e., UGRID-compliant),
the `area_weighted` scheme requires the input data in UGRID format.
This automatic UGRIDization is enabled by default, but can be switched off with
the facet ``ugrid: false`` in the recipe or the extra facets (see below).
This is useful for diagnostics that do not support input data in UGRID format
(yet) like the :ref:`Psyplot diagnostic <esmvaltool:recipes_psyplot_diag>` or
if you want to use the built-in :ref:`nearest scheme <built-in
regridding schemes>` regridding scheme.
This is useful for diagnostics that act on the native ICON grid and do not
support input data in UGRID format (yet), like the
:ref:`Psyplot diagnostic <esmvaltool:recipes_psyplot_diag>`.

For 3D ICON variables, ESMValCore tries to add the pressure level information
(from the variables `pfull` and `phalf`) and/or altitude information (from the
Expand Down Expand Up @@ -574,7 +559,7 @@ model output.

.. warning::

This is the first version of ACCESS-ESM CMORizer for ESMValCore. Currently,
This is the first version of ACCESS-ESM CMORizer for ESMValCore. Currently,
Supported variables: ``pr``, ``ps``, ``psl``, ``rlds``, ``tas``, ``ta``, ``va``,
``ua``, ``zg``, ``hus``, ``clt``, ``rsus``, ``rlus``.

Expand All @@ -585,7 +570,7 @@ The default naming conventions for input directories and files for ACCESS output

.. hint::

We only provide one default `input_dir` since this is how ACCESS-ESM native data was
We only provide one default `input_dir` since this is how ACCESS-ESM native data was
stored on NCI. Users can modify this path in the :ref:`config-developer` to match their local file structure.


Expand All @@ -594,7 +579,7 @@ Thus, example dataset entries could look like this:
.. code-block:: yaml
dataset:
- {project: ACCESS, mip: Amon, dataset:ACCESS_ESM1_5, sub_dataset: HI-CN-05,
- {project: ACCESS, mip: Amon, dataset:ACCESS_ESM1_5, sub_dataset: HI-CN-05,
exp: history, modeling_realm: atm, special_attr: pa, start_year: 1986, end_year: 1986}
Expand All @@ -612,15 +597,15 @@ Key Description Default value if not
==================== ====================================== =================================
``raw_name`` Variable name of the variable in the CMOR variable name of the
raw input file corresponding variable
``modeling_realm`` Realm attribute include `atm`, `ice` No default (needs to be
``modeling_realm`` Realm attribute include `atm`, `ice` No default (needs to be
and `oce` specified in extra facets or
recipe if default DRS is used)
```special_attr`` A special attribute in the filename No default
`ACCESS-ESM` raw data, it's related to
`ACCESS-ESM` raw data, it's related to
frquency of raw data
``sub_dataset`` Part of the ACCESS-ESM raw dataset No default
root, need to specify if you want to
use the cmoriser
use the cmoriser
==================== ====================================== =================================

.. _data-retrieval:
Expand Down Expand Up @@ -860,7 +845,7 @@ about this since we can point the user to the specific functionality
`here <https://scitools-iris.readthedocs.io/en/latest/userguide/loading_iris_cubes.html>`_ but we will underline
that the initial loading is done by adhering to the CF Conventions that `iris` operates by as well (see
`CF Conventions Document <http://cfconventions.org/cf-conventions/cf-conventions.html>`_ and the search
page for CF `standard names <http://cfconventions.org/standard-names.html>`_).
page for CF `standard names <https://cfconventions.org/Data/cf-standard-names/current/build/cf-standard-name-table.html>`_).

Data concatenation from multiple sources
========================================
Expand Down
52 changes: 32 additions & 20 deletions doc/recipe/preprocessor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -890,15 +890,15 @@ The arguments are defined below:
Regridding (interpolation, extrapolation) schemes
-------------------------------------------------

ESMValCore has a number of built-in regridding schemes, which are presented in
:ref:`built-in regridding schemes`. Additionally, it is also possible to use
third party regridding schemes designed for use with :doc:`Iris
<iris:index>`. This is explained in :ref:`generic regridding schemes`.
ESMValCore provides three default regridding schemes, which are presented in
:ref:`default regridding schemes`. Additionally, it is also possible to use
third party regridding schemes designed for use with :meth:`iris.cube.Cube.regrid`.
This is explained in :ref:`generic regridding schemes`.

Grid types
~~~~~~~~~~

In ESMValCore, we distinguish between three grid types (note that these might
In ESMValCore, we distinguish between various grid types (note that these might
differ from other definitions):

* **Regular grid**: A rectilinear grid with 1D latitude and 1D longitude
Expand All @@ -907,30 +907,34 @@ differ from other definitions):
longitude coordinates with common dimensions.
* **Unstructured grid**: A grid with 1D latitude and 1D longitude coordinates
with common dimensions (i.e., a simple list of points).
* **Mesh**: A mesh as supported by Iris and described in :ref:`iris:ugrid`.

.. _built-in regridding schemes:
.. _default regridding schemes:

Built-in regridding schemes
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Default regridding schemes
~~~~~~~~~~~~~~~~~~~~~~~~~~

* ``linear``: Bilinear regridding.
For source data on a regular grid, uses :obj:`~iris.analysis.Linear` with
`extrapolation_mode='mask'`.
For source data on an irregular grid, uses
:class:`~esmvalcore.preprocessor.regrid_schemes.ESMPyLinear`.
For source and/or target data on an irregular grid or mesh, uses
:class:`~esmvalcore.preprocessor.regrid_schemes.IrisESMFRegrid` with
`method='bilinear'`.
For source data on an unstructured grid, uses
:class:`~esmvalcore.preprocessor.regrid_schemes.UnstructuredLinear`.
* ``nearest``: Nearest-neighbor regridding.
For source data on a regular grid, uses :obj:`~iris.analysis.Nearest` with
`extrapolation_mode='mask'`.
For source data on an irregular grid, uses
:class:`~esmvalcore.preprocessor.regrid_schemes.ESMPyNearest`.
For source and/or target data on an irregular grid or mesh, uses
:class:`~esmvalcore.preprocessor.regrid_schemes.IrisESMFRegrid` with
`method='nearest'`.
For source data on an unstructured grid, uses
:class:`~esmvalcore.preprocessor.regrid_schemes.UnstructuredNearest`.
* ``area_weighted``: First-order conservative (area-weighted) regridding.
For source data on a regular grid, uses :obj:`~iris.analysis.AreaWeighted`.
For source data on an irregular grid, uses
:class:`~esmvalcore.preprocessor.regrid_schemes.ESMPyAreaWeighted`.
For source and/or target data on an irregular grid or mesh, uses
:class:`~esmvalcore.preprocessor.regrid_schemes.IrisESMFRegrid` with
`method='conservative'`.
Source data on an unstructured grid is not supported.

.. _generic regridding schemes:
Expand All @@ -950,7 +954,9 @@ afforded by the built-in schemes described above.

To facilitate this, the :func:`~esmvalcore.preprocessor.regrid` preprocessor
allows the use of any scheme designed for Iris. The scheme must be installed
and importable. To use this feature, the ``scheme`` key passed to the
and importable. Several such schemes are provided by :mod:`iris.analysis` and
:mod:`esmvalcore.preprocessor.regrid_schemes`.
To use this feature, the ``scheme`` key passed to the
preprocessor must be a dictionary instead of a simple string that contains all
necessary information. That includes a ``reference`` to the desired scheme
itself, as well as any arguments that should be passed through to the
Expand Down Expand Up @@ -996,10 +1002,13 @@ module, the second refers to the scheme, i.e. some callable that will be called
with the remaining entries of the ``scheme`` dictionary passed as keyword
arguments.

One package that aims to capitalize on the :ref:`support for unstructured grids
introduced in Iris 3.2 <iris:ugrid>` is :doc:`iris-esmf-regrid:index`.
One package that aims to capitalize on the :ref:`support for meshes
introduced in Iris 3.2 <iris:ugrid>` is :doc:`esmf_regrid:index`.
It aims to provide lazy regridding for structured regular and irregular grids,
as well as unstructured grids.
as well as meshes. It is recommended to use these schemes through
the :obj:`esmvalcore.preprocessor.regrid_schemes.IrisESMFRegrid` scheme though,
as that provides more efficient handling of masks.

An example of its usage in a preprocessor is:

.. code-block:: yaml
Expand All @@ -1009,16 +1018,19 @@ An example of its usage in a preprocessor is:
regrid:
target_grid: 2.5x2.5
scheme:
reference: esmf_regrid.schemes:ESMFAreaWeighted
reference: esmvalcore.preprocessor.regrid_schemes:IrisESMFRegrid
method: conservative
mdtol: 0.7
use_src_mask: true
collapse_src_mask_along: ZT
Additionally, the use of generic schemes that take source and target grid cubes as
arguments is also supported. The call function for such schemes must be defined as
`(src_cube, grid_cube, **kwargs)` and they must return `iris.cube.Cube` objects.
The `regrid` module will automatically pass the source and grid cubes as inputs
of the scheme. An example of this usage is
the :func:`~esmf_regrid.schemes.regrid_rectilinear_to_rectilinear`
scheme available in :doc:`iris-esmf-regrid:index`:
scheme available in :doc:`esmf_regrid:index`:

.. code-block:: yaml
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies:
- geopy
- humanfriendly
- iris >=3.10.0
- iris-esmf-regrid >=0.10.0 # github.com/SciTools-incubator/iris-esmf-regrid/pull/342
- iris-esmf-regrid >=0.11.0
- iris-grib
- isodate
- jinja2
Expand Down
Loading

0 comments on commit a2eb517

Please sign in to comment.