Project

General

Profile

cdo selindexbox not working for gridtype "projection"

Added by Philipp Reiter over 5 years ago

Hi there,

I could use your help on the following issue:
I generate nc-files from ESRI-grids (see attachment frost_depth_copied.asc) using a grid-description generated on an already existing nc-file (grid_frost_depth_projection.txt).
However, I get the following error when trying to generate a subset of the nc file using the selindexbox operator: "Unsupported grid type: projection"
I am using cdo 1.9.5 cygwin under windows.

This has with older versions of cdo never been a problem. The only difference to older versions I worked with, is that the grid type "projection" is new. It was formerly "generic".

Thus I generated a grid description with an older cdo version I worked with a lot (1.6.9) and a generic grid resulted (grid_frost_depth_generic.txt).
If I now use cdo1.9.5 to generate my nc-file with this generic grid, I get a nc (dummy_frost_depth_generic.nc) file where I can use the operator selindexbox without a problem.

So I know how to solve my problem, but it is annyoing to use different cdo versions for different tasks and I still don't understand why the selindexbox shouldn't work with the new grid type "projection". Does anybody have an idea what could be the issue in my case?

Best regards,
Philipp


Replies (5)

RE: cdo selindexbox not working for gridtype "projection" - Added by Ralf Mueller over 5 years ago

hi Philipp!

this sounds really awkward - - I will have a look at it ;-)

thx for the report
ralf

RE: cdo selindexbox not working for gridtype "projection" - Added by Ralf Mueller over 5 years ago

I need some more information

  • how exactly did you create the nc files? According to the history attribute, you used cdo-1.9.4 for both files with
    cdo -m -1 -f nc -settaxis,20100101,12:00:00,1day -input,E:/FB_64/Klimadaten/DWD-Rasterdaten/01_Urdaten/Ablage/grid_frost_depth.txt E:/FB_64/Klimadaten/DWD-Rasterdaten/01_Urdaten/Ablage/dummy_frost_depth.nc
  • what is the call with sellonlatbox, that fails with 1.9.5 and runs with 1.6.9?
  • how did you use the griddes files?

thx in advance
ralf

RE: cdo selindexbox not working for gridtype "projection" - Added by Philipp Reiter over 5 years ago

Hi Ralf,

thanks for your immediate response!

Regarding your questions:

1. I created the nc files as you quoted, based on the ascii-file I uploaded, so this should be reproduceable. I afterwards solely changed the filename based on the grid I used. To both files (nc and grid-description) a '_projection' was added for the case where I used the grid-description of grid-type projection from cdo1.9.4 and '_generic' respectively to the two files for the case where the grid-description with the grid of type generic was used.

2. You misunderstood me or better: I didnt't state my issue clearly. The call of selindexbox does not fail for 1.9.4 and run with 1.6.9. The following call:

cdo selindexbox,4,195,179,419
runs in 1.9.4 when applied to the file 'dummy_frost_depth_generic.nc' but fails for 'dummy_frost_depth_projection.nc'. Both nc-files were created using cdo 1.9.4 (data is the same).
The difference between the two nc-files is the grid-description that was used for the creation. 'dummy_frost_depth_projection.nc' used the grid description 'grid_frost_depth_projection.txt', which was generated by calling 'cdo griddes' on a dummy-nc I created with the data using R to have a grid description when creating a nc-file for the complete dataset. But the call of
cdo selindexbox,4,195,179,419 dummy_frost_depth_projection.nc
failes with the error "Unsupported grid type: projection".

Since I have done this procedure already several times in the past for other datasets (using cdo1.6.9) and had in mind that there the grid type was 'generic' and not 'projection' I did the call 'cdo griddes' on the dummy-nc with cdo1.6.9 and got the grid-description 'grid_frost_depth_generic.txt'. And when I use this grid-description to create the overall nc-file

cdo -m -1 -f nc -settaxis,20100101,12:00:00,1day -input,E:/FB_64/Klimadaten/DWD-Rasterdaten/01_Urdaten/Ablage/grid_frost_depth.txt E:/FB_64/Klimadaten/DWD-Rasterdaten/01_Urdaten/Ablage/dummy_frost_depth.nc'
I get a nc, where the call of 'cdo selindexbox,4,195,179,419' runs.

3. The two griddes files were used as E:/FB_64/Klimadaten/DWD-Rasterdaten/01_Urdaten/Ablage/grid_frost_depth.txt in the nc-creation (call from question 1) for the respective nc-file (..._projection.nc and ..._generic.nc).

So what I did in a timeline:

1. load a sample timestep from an ESRI-raster into R and assign the projection information
2. export this sample timestep as dummy.nc
3. call

cdo griddes dummy.nc > grid_frost_depth.txt
using cdo 1.9.4 which results in a grid description with grid type 'projection'
4. create a nc-file for the whole dataset by calling
cdo -m -1 -f nc -settaxis,20100101,12:00:00,1day -input,grid_frost_depth.txt < frost_depth_copied.asc dummy_frost_depth.nc
using cdo1.9.4
5. change varname,unit and varlongname using nco
6. try to call
cdo selindexbox,4,195,179,419 dummy_frost_depth.nc dummy_frost_depth_rlp.nc
which fails with the error 'Unsupported grid type: projection'
7. change the filename of dummy_frost_depth.nc to dummy_frost_depth_projection.nc and that of grid_frost_depth.txt to grid_frost_depth_projection.txt
8. redo step 3 using cdo1.6.9 which results in a grid description with grid type 'generic'
9. redo step 4 with the grid-descriptioon from step 8
10. redo step 5
11. redo step 6: call now runs successfully
12. change the filename of dummy_frost_depth.nc to dummy_frost_depth_generic.nc and that of grid_frost_depth.txt to grid_frost_depth_generic.txt

So I could use cdo1.9.4 to do evrything with the exception of the 'cdo griddes' on the dummy-nc. 'cdo selindexbox' using cdo1.9.4 only works if the nc-file I call it on was created with the grid-description of type 'generic' which I only get from 1.6.9.
I also tried out cdo1.9.5, where I have the same issues.

Best and thanks in advance,
Philipp

RE: cdo selindexbox not working for gridtype "projection" - Added by Ralf Mueller over 5 years ago

thx for clarification - I edited you post a little bit to make the calls a little bit more readable.

RE: cdo selindexbox not working for gridtype "projection" - Added by Ralf Mueller over 5 years ago

two observations

  1. your projections looks wrong in panoply (which us usually pretty good in plotting CF-conform projections)
  2. the selindexbox operators should almost always work, because messing around with indices implies, that users exactly know, what they are looking for. So, as long as it's technically possible, selindexbox should work.

In your case it should work, so I consider this as a bug - sorry for that. I fixed it in the current development version and create the nc file with

$CDO -infov -selindexbox,4,195,179,419 dummy_frost_depth_PR.nc out-1.9.6-rc.nc
Could you please have a look at it to confirm its working properly?

thx in advance

    (1-5/5)