Documentation on sub groups should be improved
Added by Guido Cioni over 1 year ago
I cannot find much about sub groups on the cdo documentation, but with 2.2.0 I'm now getting this error for commands that were working before
cdo -f nc4 setgridtype,curvilinear -mergetime -select,name=2t 'moloch_*.grib2' moloch_2D.nc
Could you please clarify what was changed that caused this syntax to now be invalid?
Also from the error message
Using two operators with variable input without using sub groups [] is not allowed
It is not clear how the syntax should be revised.
This entry https://code.mpimet.mpg.de/boards/53/topics/6702 didn't help
Replies (2)
RE: Documentation on sub groups should be improved - Added by Uwe Schulzweida over 1 year ago
Yes, the documentation is a bit behind. CDO 2.2.1 will output the following:
cdo --argument_groups ======================================================================================================================== This feature allow to use multiple operators with variable number of inputs Notes: When a bracket is closed it is no longer possible to add aditional inputs. When a bracket is closed another variable input operator can be used without brackets Where it is normally not possible to chain multiple operators of that kind, with subgroups a arbitrary number can be chained -merge -merge file1 operator file1 > error: it cannot be decided which inputs belong to which operator -merge [ -merge file1 operator ] file1 > success: With the brackets it is possible to have multiple variable inputs as inputs for another variable input -merge [ -merge [ *.grb ] -merge [ *.nc ] ] out In combination with the apply (see --apply) feature this allows rather complex calls -merge [ [ -addc,1 : *1991.grb ] -merge [ -mulc,23 : *1990.grb ] -add file3 file4 ] outfile ======================================================================================================================== cdo --apply ======================================================================================================================== This feature allows to prepend simple cdo chains to other chains Apply syntax: (1) [ chain : file1 file2 file ] (Recommended Syntax) (2) -apply,<chain> [ file1 file2 file_n ] (Old Syntax) For example the call: -merge [ -select,name=topo : *.grb ] would merge all grib files in the folder after selecting the variable topo from them The example: "-merge [ -addc,1 -mulc,2 : -add file1 file2 -subc,1 file3 file4 ] out" would result in: -merge -addc,1 -mulc,2 -add file1 file2 -addc,1 -mulc,2 -subc,3 file3 -addc,2 -mulc,23 file4 out In combination with the subgroup (see --argument_groups) feature this allows rather complex calls -merge [ [ -addc,1 : *1991.grb ] -merge [ -mulc,23 : *1990.grb ] -add file3 file4 ] outfile ========================================================================================================================Does this help?
RE: Documentation on sub groups should be improved - Added by Lars Buntemeyer 11 days ago
I have a similar case at DKRZ, e.g., this command works with cdo 2.0.5:
cdo -f nc merge -setname,tos -setgridtype,regular -seldate,2015-01-01T00:00:00 /pool/data/ERA5/E5/sf/an/1H/034/E5sf00_1H_2015-01-01_034.grb -chname,u,ua,v,va -dv2uvl -merge \ -seldate,2015-01-01T00:00:00 /pool/data/ERA5/E5/ml/an/1H/138/E5ml00_1H_2015-01-01_138.grb -seldate,2015-01-01T00:00:00 /pool/data/ERA5/E5/ml/an/1H/155/E5ml00_1H_2015-01-01_155.grb /scratch/g/g300046/ERA5-cmor/g000000a2015010100.nc
but from cdo 2.1 on, i get an error and have to adapt to:
cdo -f nc merge [ -setname,tos -setgridtype,regular -seldate,2015-01-01T00:00:00 /pool/data/ERA5/E5/sf/an/1H/034/E5sf00_1H_2015-01-01_034.grb -chname,u,ua,v,va -dv2uvl -merge \ [ -seldate,2015-01-01T00:00:00 /pool/data/ERA5/E5/ml/an/1H/138/E5ml00_1H_2015-01-01_138.grb -seldate,2015-01-01T00:00:00 /pool/data/ERA5/E5/ml/an/1H/155/E5ml00_1H_2015-01-01_155.grb ] ] merge.nc