Project

General

Profile

cdo remapbil creates missing values when regridding CMIP files

Added by Shizhu Wang about 4 years ago

Hello there,

I want to use CDO to remap CMIP6 ocean simulations from various models onto the same grid (let's say, r360x180).

cdo remapbil,r360x180 in.nc out.nc

The in.nc is as enclosed (zos_Omon_CNRM-CM6-1_abrupt-4xCO2_r5i1p1f2_gn_185009-185912.nc).

Here are the out.nc.


There is a line of missing values in the out.nc
Actually this happens to some CMIP6 models (here we are trying to remap CNRM-CM6-1 ocean results). For the other models, such as CESM2 ocean and EC-Earth3 ocean, cdo did a great job.

Any suggestions?
Thanks :)
swang


Replies (33)

RE: cdo remapbil creates missing values when regridding CMIP files - Added by Margarida Samso over 1 year ago

Hi Brendan,

How could we correct the direction of our interpolated velocity vectors?

Thank you very much in advance,

Marga

RE: cdo remapbil creates missing values when regridding CMIP files - Added by Brendan DeTracey over 1 year ago

Hi Marga,
You need to correct them before interpolation. I suggest you contact the each modeling group and ask them for help. They should be able to give you a netcdf of the rotation angles.
You can calculate the rotation angles yourself from the original grid. You take a look at each grid cell and calculate how much you would have to rotate it so that it lines up properly with local latitude and longitude. CMIP modeling groups were supposed to provide either rotation angles or weights, but this never happened. I am sorry that there is not a simpler answer to this. ESMValTool [https://www.esmvaltool.org/] might have the machinery you require. You might try asking them on their github page.
Edit: I took a quick look at the ESMValtool source, and can't find the code I thought was there. You might still want to ask them about it.

RE: cdo remapbil creates missing values when regridding CMIP files - Added by Brendan DeTracey over 1 year ago

You might want to take a look at ESMPy [https://earthsystemmodeling.org/esmpy/]. This old thread [https://github.com/DamienIrving/ocean-analysis/issues/6] gave me this suggestion. If you scroll down to "DamienIrving commented on Nov 14, 2017" you will see a recipe of sorts. My goggle-fu was [https://www.google.com/search?q=rotate+vectors+cmip+ocean+model+current]

RE: cdo remapbil creates missing values when regridding CMIP files - Added by Brendan DeTracey over 1 year ago

Just found and might be worth a look: [https://xgcm.readthedocs.io/en/latest/index.html]
Edit: Does not do vector interpolation/rotation

RE: cdo remapbil creates missing values when regridding CMIP files - Added by Margarida Samso over 1 year ago

Hi Brendan,

Thank you very much for the information. I tested it with xESMF and the same error appears, then I guess it has to do with the data. One possible solution we found is to add a vertical duplicated line to the original file before interpolating, but I'm struggling to generate it with CDO. Do you know how this could be achieved? I tried with the next commands but it creates a new tos variable:
cdo -sellonlatbox,72.5,72.5,-78.2,50 tos_Omon_CanESM5_dcppA-hindcast_s2001-r1i1p2f1_gn_200201-201112.nc tos_Omon_CanESM5_dcppA-hindcast_s2001-r1i1p2f1_gn_200201-201112.nc-endline
cdo sellonlatbox: Processed 12571200 values from 1 variable over 120 timesteps [0.34s 40MB].

cdo merge tos_Omon_CanESM5_dcppA-hindcast_s2001-r1i1p2f1_gn_200201-201112.nc tos_Omon_CanESM5_dcppA-hindcast_s2001-r1i1p2f1_gn_200201-201112.nc-endline complete.nc
Warning (cdfCheckVarname): Changed double entry of variable name 'tos' to 'tos_2'!
cdo merge: Processed 12593280 values from 2 variables over 240 timesteps [0.61s 40MB].

Thank you very much in advance.

Best,
Marga

RE: cdo remapbil creates missing values when regridding CMIP files - Added by Brendan DeTracey over 1 year ago

Hi Marga,
If you would upload a sample file (perhaps with a single time slice. I always use cdo seltimestep,1 infile outfile) it would help diagnose.
The sethalo command can do what you want.
cdo sethalo,0,1 infile outfile will add a single duplicate column to the right edge of your data, if I understand the command correctly ;-)
sethalo may be used to trim or add columns to the left and right edges. Very handy for some CMIP ocean model output.

RE: cdo remapbil creates missing values when regridding CMIP files - Added by Margarida Samso over 1 year ago

Hi Brendan,

It worked! I applied cdo sethalo,0,1 and then cdo remapbil and the white line disappeared. Thank you so much!!

Have a nice weekend :)

Best regards,

Marga

RE: cdo remapbil creates missing values when regridding CMIP files - Added by Brendan DeTracey over 1 year ago

Great! [Two dew claws(i.e.dog's thumbs) up!]

(26-33/33)