Skip to content
Draft
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# "omfiles[fsspec]>=1.2.0", # x-release-please-version
# "matplotlib",
# "cartopy",
# "earthkit-regrid==0.5.0",
# "earthkit-geo==1.0.0rc7",
# ]
# ///

Expand All @@ -17,7 +17,7 @@
import fsspec
import matplotlib.pyplot as plt
import numpy as np
from earthkit.regrid import interpolate
from earthkit.geo.grids.array import regrid
from omfiles import OmFileReader

MODEL_DOMAIN = "ecmwf_ifs"
Expand Down Expand Up @@ -52,9 +52,8 @@
print(f"Data shape: {data.shape}")
print(f"Data range: {np.nanmin(data)} to {np.nanmax(data)}")

# We are using earthkit-regrid for regridding: https://earthkit-regrid.readthedocs.io/en/stable/interpolate.html#interpolate
# with linear interpolation. Nearest neighbor interpolation can be obtained with`method="nearest-neighbour"`
regridded = interpolate(data, in_grid={"grid": "O1280"}, out_grid={"grid": [0.1, 0.1]}, method="linear")
# We are using earthkit-geo for regridding: https://earthkit-geo.readthedocs.io/en/latest/concepts/regridding/precomputed/regrid_array.html#precomputed-regrid-array
regridded, grid_spec = regrid(data, in_grid={"grid": "O1280"}, out_grid={"grid": [0.1, 0.1]}, backend="precomputed")
print(f"Regridded shape: {regridded.shape}")

# Create plot
Expand Down
Loading