Remmaping (regridding) NetCDFs

Lately, I have been working on remmaping NetCDF files from a coarse spatial resolution to a higher one. Specifically, I am remmaping Euro-CORDEX regional climate models (RCMs) with grids cells of 12.5km to observation grid cells of 10km.

rawRCM

Figure 1. Difference in resolution and rotation between the RCM (background in colour) and the observation (black-line cells)  grids

There is a lot of information online on how to do this. However, it is all sparse and can be difficult to understand if you haven’t done this before.

To begin with, we can find useful information on the different grids and methods used in climate research in the Climata Date Guide from the US National Center for Atmospheric Research. From this and other sources, we can get that conservative interpolation is one of the most apporiate methods to remmap precipiation because it keeps the minimum and maximum values after interpolation.

Now that we know that, how can we do the interpolation?

As I said before, there is a lot of information online. Also, there are several options to perform the conservative interpolation and to analyse NetCDF files. I used the Climate Data Operators (CDO) developed by the Max-Planck-Institut für Meteorologie. CDO is a collection of command line operators to analyse climate data. CDO only runs on Linux. Therefore, I installed Ubuntu in my machine using the Linux subsystem option on Windows 10. Afterwards, I installed CDO on Ubuntu and was ready to perform the conservative interpolation.

IMPORTANT: To perform the conservative interpolation, both the source and destination  NetCDF files (RCM and observation grids, respectively) must include the corners of each grid cell. 

Some of the CORDEX RCMs include the corners of each grid cell. Therefore, it is straightforward to satisfy the above. However, if your destination grid does not include the grid corners (as mine), then you have to define them yourself. Luckly, if you dig online you can find different approaches on how to do this.

I used a script based on the NCAR Command Line (NCL). NCL is a language for analysis and visualization of scientific data. This is the scrip I used to get the cell corners of my destination file:


OutFileName = "Name_of_your_new_file_with_cell_corners.nc"

f     = addfile ("Name_of_your_original_file_without_cell_corners.nc", "r")
lat2d = f->lat
lon2d = f->lon                        

Opt                      = True
Opt@InterpMethod         = "conserve"
Opt@ForceOverwrite       = True
Opt@PrintTimings         = True

curvilinear_to_SCRIP(OutFileName,lat2d,lon2d,Opt)

Now that both the source and destination files have the cell corners defined we can start with the conservative remmaping using CDO:


cdo remapcon,destination_grid_file.nc -setgrid,source_grid_file.nc source_data.nc remmaped_data.nc

Finally, next figure shows how the remapped RCM looks like, matching the observation grids. Now, the data can be used to compare RCM projections to our observations, to do a bias correction of the climate model, etc.

remapRCM

Figure 2. Remapped RCM (the precipitation units where also changed, but not shown in this post)

Leave a comment