Project

General

Profile

[Regression] Remapcon fails if a variable ldoesn't share the grid coordinates

Added by Amaury Barral 6 months ago

Using cdo 2.3.0, I encounter the following issue:

In ref.nc I have (lat, lon) coordinates.
In A.nc I have many (lat, lon, time) arrays, as well as arrays with other coordinates unrelated to (lat, lon) such as (pression, time). Let's call one of those arrays "mycoord".

If I call

cdo remapcon,ref.nc -selvar,mycoord A.nc out.nc

then I get

cdo remapcon (Abort): No remappable grid found!
terminate called without an active exception
[1] 263965 IOT instruction (core dumped)

However, in previous cdo versions (e.g. 1.9.8), those arrays were simply ignored, such that one could create an interpolated out.nc where all the arrays with coordinates matching ref.nc were remapped, and all the others were left alone.

1) Is this a bug or intended ?
2) How do I get around it ?

(of course, one solution would be to perform the remapcon only on the "good" arrays, then create a second array with only the "bad" arrays, then merge the two - but it's a lot more cumbersome than it used to be !)


Replies (6)

RE: [Regression] Remapcon fails if a variable ldoesn't share the grid coordinates - Added by Karin Meier-Fleischer 6 months ago

Without the file it is hard to say what happened. If your file contains multiple grids CDO takes the first grid for regridding. If you want to use another grid use the selgrid operator.

RE: [Regression] Remapcon fails if a variable ldoesn't share the grid coordinates - Added by Amaury Barral 6 months ago

If you want to use another grid use the selgrid operator.

What I'd like (as it was in 1.9.8) is for remapcon to only interpolate the arrays that match the grid of the reference, and leave the others alone. That's what it used to do. Now, instead, if there's any array that doesn't match the provided grid, it errors and corrupts the array.

RE: [Regression] Remapcon fails if a variable ldoesn't share the grid coordinates - Added by Amaury Barral 6 months ago

Edit: after some digging around, it seems that the problem is slightly more complicated. I'm creating a minimal test case and i'll post a new message here.

RE: [Regression] Remapcon fails if a variable ldoesn't share the grid coordinates - Added by Amaury Barral 6 months ago

Here's a simple example. Attached is to_remap.nc. It has two arrays `ps` and `ap`. `ps` is (lat, lon, presnivs, time) whereas `ap` is (presnivs, time).

When I perform

cdo remapcon,to_remap.nc -selvar,ps,ap to_remap.nc out.nc

the command executes without anomalous output.

However if we look at the created file `out.nc`, we see that although `ap` is correct, `ps` was converted into a totally different field, with constant values along `presnivs` and varying values along `time`, which doesn't match the original at all.

If we used cdo 1.9.8, then this does not occur.

RE: [Regression] Remapcon fails if a variable ldoesn't share the grid coordinates - Added by Uwe Schulzweida 5 months ago

Hello Amaury,

Thanks for the example file. There was an error in CDO when copying the datavalue of the ignored field during the interpolation.
This bug is fix in CDO release 2.4.1.

Cheers,
Uwe

RE: [Regression] Remapcon fails if a variable ldoesn't share the grid coordinates - Added by Amaury Barral 5 months ago

Thanks for the answer ! I can confirm that I don't have the problem anymore with 2.4.2

    (1-6/6)