how to create vertical levels, and merge ?
Added by Etienne Tourigny over 14 years ago
Greetings,
I've been looking for a simple way to create a vertical level after importing 2D data (using the input operator).
Also I need to merge files of different levels into one file, I believe that "copy" operator does this, am I right?
Basically I want to create a level for each land surface type (int codes), and make a level for each of these land surface types, where a grid point has a value of 100% if it is of that surface type.
After a spatial re-griding (of lower resolution), I would then have a value of the proportion of each surface type, stored in the various levels.
I guess I could do it by having a file with one vertical level, and for each surface type make a copy with the needed vertical level and proper values, then add them together. But I still need to add a vertical dimension (of 1 level) to the file...
cdo copy setrtoc2,1,1,100,0 -setlevel,1 in.nc lev01.nc
cdo copy setrtoc2,2,2,100,0 -setlevel,2 in.nc lev02.nc
...
cdo copy lev??.nc out.nc
Thanks
Etienne
Replies (3)
RE: how to create vertical levels, and merge ? - Added by Etienne Tourigny over 14 years ago
ok I've managed to make a 1-level vertical layer by using the "setzaxis" operator, with descriptor file as follows:
--
zaxistype = height
size = 1
levels = 1
--
And then create a series of files with different levels with:
cdo setrtoc2,$level,$level,100,0 -setlevel,$level $ifile "test_"$level".nc"
But I cannot combine these files into a single multi-level file...
The "copy" operator makes a file with 1 vertical level, but with a 2-element time axis.
The "merge" operator makes multiple levels, but all but the first level are filled with zeroes.
Here is an output of "cdo info" for the 2 resulting files:
tourigny@ozonegeo2:/home/tmp/proveg$ cdo info test_copy.nc
-1 : Date Time Code Level Size Miss : Minimum Mean Maximum
1 :-0001-11-30 00:00:00 1 1 20269426 11505021 : 0.0000 38.860 100.00
2 :-0001-11-30 00:00:00 1 1 20269426 11505021 : 0.0000 2.9534 100.00
tourigny@ozonegeo2:/home/tmp/proveg$ cdo info test_merge.nc
-1 : Date Time Code Level Size Miss : Minimum Mean Maximum
1 :-0001-11-30 00:00:00 1 1 20269426 11505021 : 0.0000 2.9534 100.00
2 :-0001-11-30 00:00:00 1 2 20269426 0 : 0.0000 0.0000 0.0000
It seems that one of the layers is not read...
==> Is there a way to correctly combine different levels into a single file?
Thanks, Etienne
RE: how to create vertical levels, and merge ? - Added by Ralf Mueller over 14 years ago
Do you use cdo-1.4.4? Merging zlevels in netcdf files is included in this version. Try
cdo -V
RE: how to create vertical levels, and merge ? - Added by Etienne Tourigny over 14 years ago
Fixed! I was using version 1.4.0.1, the latest 1.4.4 version works like a charm.
I downloaded that version (1.4.0.1) because it was the first on the list in the download page, although I should have looked better.
I guess I did that because I am used to sourceforge, which shows the latest version first as well as a link to the latest version. Perhaps changing the sorting order of the files list would make it more intuitive, as well as having a "latest version" link on the main page?
Thanks
Etienne