Inverse of sortlevel
Added by Thomas Jahns about 11 years ago
Hello everyone,
I'm trying to sort a time-sorted GRIB file in which for each timestep the variable codes and levels are arbitrarily permuted. I got almost what I wanted with selcode
, sortlevel
and merge
but want actually the inverse sort sortlevel
gives.
Any ideas to achieve this would be appreciated.
Thanks in advance, Thomas
Replies (4)
RE: Inverse of sortlevel - Added by Ralf Mueller about 11 years ago
just guessing, but: Couldn't you just use splitlevel of breaking things into parts, unix sort and unix cat (or cdo cat) for joining????
RE: Inverse of sortlevel - Added by Thomas Jahns about 11 years ago
Thank you for the suggestion Ralf, but the sorting I need is in this order:
- records for one timestep should be contiguous
- for each timestep the records of a variable should be contiguous (but this is not as strictly required)
- for a variable in a timestep the pressure levels should be descending
- for each timestep the records of a variable should be contiguous (but this is not as strictly required)
As you can see the sorting is a bit more loose than strictly by the 3 criteria but what I need most importantly is for the pressure levels to be sorted differently than they are now. The levels for the different variables are not identical and therefore cannot be split in a simple means.
Regards, Thomas
RE: Inverse of sortlevel - Added by Thomas Jahns about 11 years ago
Another alternative which I'm currently investigating: can I somehow set/change the level sequence streamReadVar uses?
RE: Inverse of sortlevel - Added by Thomas Jahns about 11 years ago
So to wrap things up: a descending sorting of pressure levels is unproblematic and thanks to Uwe has become part of the most recent version of CDI. This completes solves my issue before I even need to use cdo .