Iris regridding scheme using ESMF
Project description
iris-esmf-regrid
Click here for the API documentation
Overview
This project aims to provide a bridge between Iris and ESMF. This takes the form of regridder classes which take Iris cubes as their arguments and use ESMF to perform regridding calculations. These classes are designed to perform well on cubes which have multiple non-horizontal dimensions and lazy (Dask) data. Both rectilinear and curvilinear grids as well as UGRID meshes have been supported.
Regridding Example
There are a range of regridder classes (e.g MeshToGridESMFRegridder
and
GridToMeshESMFRegridder
). For an example of the regridding process, the
MeshToGridESMFRegridder
class works as follows:
import iris
from iris.experimental.ugrid import PARSE_UGRID_ON_LOAD
from esmf_regrid.experimental.unstructured_scheme import MeshToGridESMFRegridder
# An example such a file can be found at:
# https://github.com/SciTools/iris-test-data/blob/master/test_data/NetCDF/unstructured_grid/data_C4.nc
with PARSE_UGRID_ON_LOAD.context():
source_mesh_cube = iris.load_cube("mesh_cube.nc")
# An example of such a file can be found at:
# https://github.com/SciTools/iris-test-data/blob/master/test_data/NetCDF/global/xyt/SMALL_hires_wind_u_for_ipcc4.nc
target_grid_cube = iris.load_cube("grid_cube.nc")
# Initialise the regridder with a source mesh and target grid.
regridder = MeshToGridESMFRegridder(source_mesh_cube, target_grid_cube)
# use the initialised regridder to regrid the data from the source cube
# onto a cube with the same grid as `target_grid_cube`.
result = regridder(source_mesh_cube)
Note that this pattern allows the reuse of an initialised regridder, saving significant amounts of time when regridding. To make use of this efficiency across sessions, we support the saving of certain regridders. We can do this as follows:
from esmf_regrid.experimental.io import load_regridder, save_regridder
# Save the regridder.
save_regridder(regridder, "saved_regridder.nc")
# Load saved regridder.
loaded_regridder = load_regridder("saved_regridder.nc")
# Use loaded regridder.
result = loaded_regridder(source_mesh_cube)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file esmf_regrid-0.4.0.tar.gz
.
File metadata
- Download URL: esmf_regrid-0.4.0.tar.gz
- Upload date:
- Size: 37.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e07b5be62f24717a12994d369d3082cf2c246a2c38fb8c5f057b1cae4d6b331 |
|
MD5 | c7ef8dee59fad9e459e0ef1e1f6bf651 |
|
BLAKE2b-256 | 77894599fdfcedd367ee4953c05d0768f7902223fb4575e2635f265481c49895 |
File details
Details for the file esmf_regrid-0.4.0-py3-none-any.whl
.
File metadata
- Download URL: esmf_regrid-0.4.0-py3-none-any.whl
- Upload date:
- Size: 55.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ca13cabc07e1952ce413b9040c27b3c005ccb4de31d1c414fd1c468ad9603a1 |
|
MD5 | eae6bc410173f198decd30ea10f03b37 |
|
BLAKE2b-256 | 3c02e182dfacac9b45c8e013ba9d350db2ee1e2260b1732ade784cad7e3c0528 |