Code Monkey home page Code Monkey logo

iris-esmf-regrid's Introduction

iris-esmf-regrid

Build Status Documentation Status pre-commit.ci status codecov Code style: black License Contributors Mark stale issues and pull requests


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)

iris-esmf-regrid's People

Contributors

bjlittle avatar dependabot[bot] avatar github-actions[bot] avatar jamesp avatar lbdreyer avatar pre-commit-ci[bot] avatar stephenworsley avatar trexfeathers avatar zklaus avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.