Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an iris-esmf-regrid based regridding scheme #2457

Merged
merged 25 commits into from
Sep 4, 2024
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
8cbaf69
Add an iris-esmf-regrid based regridding scheme
bouweandela Jun 14, 2024
dace441
Better docs
bouweandela Jun 14, 2024
e4e4196
Use as default scheme for irregular grids
bouweandela Jul 10, 2024
5da1919
Fix rechunking for all grids and add tests
bouweandela Jul 16, 2024
642e0a5
Fix test
bouweandela Jul 17, 2024
bfea2fa
More tests and better docs
bouweandela Jul 17, 2024
e86329c
Fix formatting issue
bouweandela Jul 17, 2024
6ed4fed
Restore ESMPyNearest as the default regridder for unstructured neares…
bouweandela Jul 17, 2024
bd84fa9
Improve documentation
bouweandela Jul 17, 2024
2f70e90
Fix mixup between unstructured and irregular and add mesh schemes
bouweandela Jul 23, 2024
645f6ca
Merge branch 'main' into add-iris-esmf-regrid-scheme
bouweandela Jul 23, 2024
9f1b8b1
Merge branch 'main' of github.com:ESMValGroup/ESMValCore into add-iri…
bouweandela Aug 13, 2024
912e34b
Add support for nearest regridding and time-varying masks
bouweandela Aug 26, 2024
83b90ca
Remove trailing whitespace
bouweandela Aug 27, 2024
bba4233
Merge branch 'main' of github.com:ESMValGroup/ESMValCore into add-iri…
bouweandela Aug 27, 2024
20ed0b8
Documentation improvements
bouweandela Aug 27, 2024
9aaf1b2
Small improvements
bouweandela Aug 27, 2024
90d4020
Add more tests
bouweandela Aug 29, 2024
ca7c348
Add note to docs
bouweandela Aug 29, 2024
286f43d
Improve deprecations
bouweandela Sep 3, 2024
42123c0
Move get_dims_along_axes to shared module
bouweandela Sep 3, 2024
51d5ec4
Improve documentation
bouweandela Sep 3, 2024
cfc4330
Allow coordinate names for computing mask
bouweandela Sep 3, 2024
854e411
Improve documentation
bouweandela Sep 3, 2024
a848468
Update docstring
bouweandela Sep 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve documentation
bouweandela committed Jul 17, 2024
commit bd84fa9a2b97394beba8efccfe7a4fc5791de8d2
36 changes: 22 additions & 14 deletions doc/recipe/preprocessor.rst
Original file line number Diff line number Diff line change
@@ -890,10 +890,10 @@ 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
~~~~~~~~~~
@@ -908,16 +908,17 @@ differ from other definitions):
* **Unstructured grid**: A grid with 1D latitude and 1D longitude coordinates
with common dimensions (i.e., a simple list of points).

.. _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, 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.
@@ -929,8 +930,9 @@ Built-in regridding schemes
: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, uses
:class:`~esmvalcore.preprocessor.regrid_schemes.IrisESMFRegrid` with
`method='conservative'`.
Source data on an unstructured grid is not supported.

.. _generic regridding schemes:
@@ -950,7 +952,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
@@ -999,7 +1003,10 @@ arguments.
One package that aims to capitalize on the :ref:`support for unstructured grids
introduced in Iris 3.2 <iris:ugrid>` is :doc:`esmf_regrid:index`.
It aims to provide lazy regridding for structured regular and irregular grids,
bouweandela marked this conversation as resolved.
Show resolved Hide resolved
as well as unstructured grids.
as well as unstructured grids. 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
@@ -1009,7 +1016,8 @@ 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

Additionally, the use of generic schemes that take source and target grid cubes as

Unchanged files with check annotations Beta

Keyword arguments that will be provided to the regridder.
"""
def __init__(

Check notice on line 94 in esmvalcore/preprocessor/_regrid_iris_esmf_regrid.py

Codacy Production / Codacy Static Code Analysis

esmvalcore/preprocessor/_regrid_iris_esmf_regrid.py#L94

Too many arguments (8/5) (too-many-arguments)
self,
method: Literal["bilinear", "conservative", "nearest"],
mdtol: float | None = None,