Project

General

Profile

Using two operators with variable input without using sub groups [] is not allowed?

Added by Brendan DeTracey about 1 year ago

Hi there! I am using cdo 2.1.0. I am missing a very obvious syntax error... :(

$ ls /home/brendan/d1/cmip6_data/680/ACCESS-CM2/raw/past/tos_Omon_ACCESS-CM2_historical_r1i1p1f1_*.nc
/home/brendan/d1/cmip6_data/680/ACCESS-CM2/raw/past/tos_Omon_ACCESS-CM2_historical_r1i1p1f1_gn_195001-195912.nc
/home/brendan/d1/cmip6_data/680/ACCESS-CM2/raw/past/tos_Omon_ACCESS-CM2_historical_r1i1p1f1_gn_196001-196912.nc
/home/brendan/d1/cmip6_data/680/ACCESS-CM2/raw/past/tos_Omon_ACCESS-CM2_historical_r1i1p1f1_gn_197001-197912.nc
/home/brendan/d1/cmip6_data/680/ACCESS-CM2/raw/past/tos_Omon_ACCESS-CM2_historical_r1i1p1f1_gn_198001-198912.nc
/home/brendan/d1/cmip6_data/680/ACCESS-CM2/raw/past/tos_Omon_ACCESS-CM2_historical_r1i1p1f1_gn_199001-199912.nc
/home/brendan/d1/cmip6_data/680/ACCESS-CM2/raw/past/tos_Omon_ACCESS-CM2_historical_r1i1p1f1_gn_200001-200912.nc
/home/brendan/d1/cmip6_data/680/ACCESS-CM2/raw/past/tos_Omon_ACCESS-CM2_historical_r1i1p1f1_gn_201001-201412.nc
cdo -O -a -f nc4 -z zip --cmor setattribute,dfo_creation_date=2023-03-06T16:51:24+00:00 -fldmean -selregion,polygon_gomss_subarea_gom.txt -selname,tos -select,startdate=1950-01-01T00:00:00,enddate=2014-12-31T23:59:59 -copy /home/brendan/d1/cmip6_data/680/ACCESS-CM2/raw/past/tos_Omon_ACCESS-CM2_historical_r1i1p1f1_*.nc /home/brendan/d1/cmip6_data/680/subarea_time_series_2023/tos_Omon_ACCESS-CM2_historical_r1i1p1f1_gom_1950-2014.nc
cdo (Abort): setattribute,dfo_creation_date=2023-03-06T16:51:24+00:00 -fldmean -selregion,polygon_gomss_subarea_gom.txt -selname,tos -select,startdate=1950-01-01T00:00:00,enddate=2014-12-31T23:59:59 -copy /home/brendan/d1/cmip6_data/680/ACCESS-CM2/raw/past/tos_Omon_ACCESS-CM2_historical_r1i1p1f1_gn_195001-195912.nc /home/brendan/d1/cmip6_data/680/ACCESS-CM2/raw/past/tos_Omon_ACCESS-CM2_historical_r1i1p1f1_gn_196001-196912.nc /home/brendan/d1/cmip6_data/680/ACCESS-CM2/raw/past/tos_Omon_ACCESS-CM2_historical_r1i1p1f1_gn_197001-197912.nc /home/brendan/d1/cmip6_data/680/ACCESS-CM2/raw/past/tos_Omon_ACCESS-CM2_historical_r1i1p1f1_gn_198001-198912.nc /home/brendan/d1/cmip6_data/680/ACCESS-CM2/raw/past/tos_Omon_ACCESS-CM2_historical_r1i1p1f1_gn_199001-199912.nc /home/brendan/d1/cmip6_data/680/ACCESS-CM2/raw/past/tos_Omon_ACCESS-CM2_historical_r1i1p1f1_gn_200001-200912.nc /home/brendan/d1/cmip6_data/680/ACCESS-CM2/raw/past/tos_Omon_ACCESS-CM2_historical_r1i1p1f1_gn_201001-201412.nc /home/brendan/d1/cmip6_data/680/subarea_time_series_2023/tos_Omon_ACCESS-CM2_historical_r1i1p1f1_gom_1950-2014.nc
                                                                                                                                                                                                         ^ Using two operators with variable input without using sub groups [] is not allowed


Replies (5)

RE: Using two operators with variable input without using sub groups [] is not allowed? - Added by Brendan DeTracey about 1 year ago

Hi Karin,
It gives me the same error:

$ cdo -O -a -f nc4 -z zip --cmor -setattribute,dfo_creation_date=2023-03-06T16:51:24+00:00 -fldmean -selregion,polygon_gomss_subarea_gom.txt -selname,tos -select,startdate=1950-01-01T00:00:00,enddate=2014-12-31T23:59:59 -copy /home/brendan/d1/cmip6_data/680/ACCESS-CM2/raw/past/tos_Omon_ACCESS-CM2_historical_r1i1p1f1_*.nc /home/brendan/d1/cmip6_data/680/subarea_time_series_2023/tos_Omon_ACCESS-CM2_historical_r1i1p1f1_gom_1950-2014.nc

cdo (Abort): -setattribute,dfo_creation_date=2023-03-06T16:51:24+00:00 -fldmean -selregion,polygon_gomss_subarea_gom.txt -selname,tos -select,startdate=1950-01-01T00:00:00,enddate=2014-12-31T23:59:59 -copy /home/brendan/d1/cmip6_data/680/ACCESS-CM2/raw/past/tos_Omon_ACCESS-CM2_historical_r1i1p1f1_gn_195001-195912.nc /home/brendan/d1/cmip6_data/680/ACCESS-CM2/raw/past/tos_Omon_ACCESS-CM2_historical_r1i1p1f1_gn_196001-196912.nc /home/brendan/d1/cmip6_data/680/ACCESS-CM2/raw/past/tos_Omon_ACCESS-CM2_historical_r1i1p1f1_gn_197001-197912.nc /home/brendan/d1/cmip6_data/680/ACCESS-CM2/raw/past/tos_Omon_ACCESS-CM2_historical_r1i1p1f1_gn_198001-198912.nc /home/brendan/d1/cmip6_data/680/ACCESS-CM2/raw/past/tos_Omon_ACCESS-CM2_historical_r1i1p1f1_gn_199001-199912.nc /home/brendan/d1/cmip6_data/680/ACCESS-CM2/raw/past/tos_Omon_ACCESS-CM2_historical_r1i1p1f1_gn_200001-200912.nc /home/brendan/d1/cmip6_data/680/ACCESS-CM2/raw/past/tos_Omon_ACCESS-CM2_historical_r1i1p1f1_gn_201001-201412.nc /home/brendan/d1/cmip6_data/680/subarea_time_series_2023/tos_Omon_ACCESS-CM2_historical_r1i1p1f1_gom_1950-2014.nc
                                                                                                                                                                                                          ^ Using two operators with variable input without using sub groups [] is not allowed

If I remove -select,startdate=1950-01-01T00:00:00,enddate=2014-12-31T23:59:59, it works.
$ cdo -O -a -f nc4 -z zip --cmor -setattribute,dfo_creation_date=2023-03-06T16:51:24+00:00 -fldmean -selregion,polygon_gomss_subarea_gom.txt -selname,tos -copy /home/brendan/d1/cmip6_data/680/ACCESS-CM2/raw/past/tos_Omon_ACCESS-CM2_historical_r1i1p1f1_*.nc /home/brendan/d1/cmip6_data/680/subarea_time_series_2023/tos_Omon_ACCESS-CM2_historical_r1i1p1f1_gom_1950-2014.nc
cdo(1) fldmean: Process started
cdo(2) selregion: Process started
cdo(3) selname: Process started
cdo(4) copy: Process started
cdo(4) copy:   0%cdo(1) fldmean: 100%cdo(4) copy: Processed 84240000 values from 7 variables over 780 timesteps
cdo(3) selname: Processed 84240000 values from 1 variable over 780 timesteps
cdo(2) selregion: Processed 84240000 values from 1 variable over 780 timesteps
cdo(1) fldmean: Processed 16380 values from 1 variable over 780 timesteps
cdo    setattribute: Processed 780 values from 1 variable over 780 timesteps [4.97s 83MB]

RE: Using two operators with variable input without using sub groups [] is not allowed? - Added by Brendan DeTracey about 1 year ago

The same command line works with cdo 2.0.4 :(
This is very confusing since selregion is not (officially?) introduced until 2.1.0

RE: Using two operators with variable input without using sub groups [] is not allowed? - Added by Brendan DeTracey about 1 year ago

Please ignore. It works when I get rid of the copy command.

RE: Using two operators with variable input without using sub groups [] is not allowed? - Added by Ralf Mueller about 1 year ago

hi Brendan,
good to hear from you! I hope you are well

In case you are interested, here is a bit of background info: The copy operator is one of few that takes a flexible number for input stream (others are select, cat, merge, mergetime). In order to chain those, CDO needs more information about what is going in and out. I once wrote something about it here you can get a complete list by checking the output of

cdo --operators
This will give you a list of all operators with something like (<number of input streams>|<number of output stream) and the and of each line. -1 indicates an arbitrary number.

I guess the reason for 2.0.4 to work is constant work on the command line parser of CDO. It might got a bit stricter in 2.1.0, which makes life not easier for users. But the goal is, that CDO only process calls which can be full understood. sorry for the inconvenience.

cheers
ralf

    (1-5/5)