Project

General

Profile

High resolution NetCDF regridding and masking

Added by Chandrakant Singh almost 5 years ago

I have a high-resolution variable (0.05 degrees) with values between 0 to 100. I want to remap it to a lower resolution (0.25 degree) and mask the ocean features to NaN. I tried to do that using:
cdo remapcon,r1440x720 a.nc output.nc #for regridding

But, the resultant netCDF have values from -300 to 300. I am quite confused as to why is that happening. Can someone provide some feedback on that?
Also, I am completely oblivious on how to mask only the sea features

Since the file is quite large, I am providing a link to my dropbox.
[[https://www.dropbox.com/sh/n3uj3byxw40ybkf/AAC9jfuG1DrWjEIO0kVywgVXa?dl=0
]]


Replies (3)

RE: High resolution NetCDF regridding and masking - Added by Karin Meier-Fleischer almost 5 years ago

Try:

cdo -f nc remapycon,r1440x720 a.nc output.nc

-Karin

RE: High resolution NetCDF regridding and masking - Added by Chandrakant Singh almost 5 years ago

Thanks, Karin.
Can you tell me what I changed with the new code? The resultant netCDF seems to work fine.

And if you have some suggestion about masking only the sea regions.
As I know that CDO function has pre-built land-sea mask.

RE: High resolution NetCDF regridding and masking - Added by Karin Meier-Fleischer almost 5 years ago

Older versions of CDO has used different software to compute the conservative remapping weights. The current version of remapcon is former remapycon.

To create a global mask where the ocean is equal 0 and land equal 1:

cdo -f nc -expr,'topo = ((topo > 0.0)) ? 1.0 : 0.0' -remapycon,r1440x720 -topo ocean_mask.nc

or 

cdo -f nc -setrtomiss,-20000,0  -remapbil,r1440x720 -topo ocean_mask.nc
cdo -f nc -setctomiss,0 -mul ocean_mask.nc output.nc output_masked.nc

-Karin

    (1-3/3)