Project

General

Profile

Interpolating with land-sea mask?

Added by Christian Page about 13 years ago

Hi,

I am trying to interpolate CMIP3 2-meter temperature data into the ERA Interim grid.

For Mean Sea-Level Pressure, it works very well using this command:
cdo remapbil,psl_1m_19890101_20101130_ERAI.nc psl_A1B_cnrm_cm3.nc output.nc

However, to interpolate correctly 2-meter temperature data, I need to perform the interpolation insuring that I am not mixing points over the sea with points over the land.
Is it possible with cdo to perform interpolation separately for land points and sea points using a mask NetCDF file?

Thanks!

Best regards,

Christian Page
CERFACS


Replies (3)

RE: Interpolating with land-sea mask? - Added by Uwe Schulzweida about 13 years ago

Hi Christian,

With CDO you have to do it in tree steps:
  • set the sea points to missing value and interpolate only the land points
  • set the land points to missing value and interpolate only the sea points
  • merge the results

Here is an example for nearest neighbor remapping with remapnn:

cdo -remapnn,targetgrid -div ifile.nc landmask.nc landdata.nc
cdo -remapnn,targetgrid -div ifile.nc seamask.nc seadata.nc
cdo add -setmisstoc,0 landdata.nc -setmisstoc,0 seadata.nc result.nc
This example works only if the input file has no missing values and no zero values. landmask.nc needs to have 1 at land points and missing value for all other.
Depending on the Mask the same procedure with remapbil could give a result with some non interpolated points.

Best regards,
Uwe

RE: Interpolating with land-sea mask? - Added by Christian Page about 13 years ago

Thanks very much for this answer! :)

Christian

RE: Interpolating with land-sea mask? From coarse to fine grid. - Added by Stephan Dietrich about 12 years ago

Hi,

I have a question concerning Uwe's comment that remapbil could give results with non-interpolated values. Unfortunately, this is true.

I try to remap from a coarse to fine grid, here T31 to T106. Nearest Neighbor would result in rather steep gradients, since the resolution of the grid is increased to T106 but the pattern of e.g. surface temperatures would just resample the low T31 resolution.

cdo remapbil (bic, con, ...) would lead to smoother edges, something what I would prefer. Unfortunately, due to the interpolation of missing values of the land/sea-masks (see Uwe's reply) the continent shrinks when resampling ifile.nc to landdata.nc (same of course is true for seadata.nc). After merging landdata.nc with seadata.nc the continents have a pronounced rim of missing values.

Has somebody an idea for a workaround?

I tried so far:
- Following the cdo documentation it is possible to set the shell environment 'export REMAP_EXTRAPOLATE=on' . However, the results for remapbin keeps the same for 'on' and 'off'. (see also post https://code.zmaw.de/boards/1/topics/452)
- I filled missing values of the merged remapbin dataset with values from a secondary dataset, which I have remapped with remapnn. This is slightly better but steep gradients still remain at the continent-ocean-borders.

However, I hope for some better solutions.

Best regards,
Stephan

    (1-3/3)