In this tutorial we will remap a dataset from the native ICON grid to HEALPix. The dataset used as an example is from the EERIE project and is available online. It consists of five 2d variables and covers 23 years with a 6 hour time step.
EERIE model data produced by MPI-M is licensed under a Creative Commons Attribution 4.0 International License (https://creativecommons.org/licenses). The data producers and data providers make no warranty, either express or implied, including, but not limited to, warranties of merchantability and fitness for a particular purpose. All liabilities arising from the supply of the information (including any liability arising in negligence) are excluded to the fullest extent permitted by law.
mip_era :
EERIE
project_id :
EERIE
physics_index :
1
product :
model-output
realization_index :
1
source_type :
AOGCM
variant_label :
r1i1p1f1
creation_date :
2024-11-18T12:40:44
institution_id :
MPI-M
source_id :
icon-esm-er
experiment_id :
eerie-control-1950
contact :
juergen.kroeger@mpimet.mpg.de
references :
Hohenegger et al., ICON-Sapphire: simulating the components of the Earth system and their interactions at kilometer and subkilometer scales. Geosci. Model Dev., 16, 779–811, 2023, https://doi.org/10.5194/gmd-16-779-2023
nominal_resolution :
10 km
version_id :
v20240618
realm :
atmos
grid :
native
grid_label :
gn
parent_experiment_id :
eerie-spinup-1950
parent_activity_id :
EERIE
sub_experiment_id :
none
experiment :
coupled control with fixed 1950's forcing (HighResMIP equivalent of pre-industrial control)
Max Planck Institute for Meteorology, Hamburg 20146, Germany
The first step is to create a HEALPix grid that is close to the resolution of our source grid. Here we will choose an order of 9 (also known as “zoom”) and “nest” ordering.
Next, we can use our defined source and target grids to compute interpolation weights. The easygems package provides a function to compute these weights using the Delaunay triangulation method.
[3]:
weights=egr.compute_weights_delaunay((ds.lon,ds.lat),(hp_lon,hp_lat))# You can also save the calculated weights for future use# weights.to_netcdf("healpix_weights.nc")
These weights can be applied to single fields directly:
Alternatively, we can use xarray’s apply_ufunc() function to lift the function onto a full dataset. This requires a coupled of additional information from the user, e.g. the input dimension along which the function should be applied, and the resulting output dimensions name and size.
EERIE model data produced by MPI-M is licensed under a Creative Commons Attribution 4.0 International License (https://creativecommons.org/licenses). The data producers and data providers make no warranty, either express or implied, including, but not limited to, warranties of merchantability and fitness for a particular purpose. All liabilities arising from the supply of the information (including any liability arising in negligence) are excluded to the fullest extent permitted by law.
mip_era :
EERIE
project_id :
EERIE
physics_index :
1
product :
model-output
realization_index :
1
source_type :
AOGCM
variant_label :
r1i1p1f1
creation_date :
2024-11-18T12:40:44
institution_id :
MPI-M
source_id :
icon-esm-er
experiment_id :
eerie-control-1950
contact :
juergen.kroeger@mpimet.mpg.de
references :
Hohenegger et al., ICON-Sapphire: simulating the components of the Earth system and their interactions at kilometer and subkilometer scales. Geosci. Model Dev., 16, 779–811, 2023, https://doi.org/10.5194/gmd-16-779-2023
nominal_resolution :
10 km
version_id :
v20240618
realm :
atmos
grid :
native
grid_label :
gn
parent_experiment_id :
eerie-spinup-1950
parent_activity_id :
EERIE
sub_experiment_id :
none
experiment :
coupled control with fixed 1950's forcing (HighResMIP equivalent of pre-industrial control)
It is good practice to store map projection information in the Coordinate Reference Systems (CRS). By making the crs coordinate non-dimensional it will “stick” to the dataset even if individual variables are subselected.