Chaining more than 64 operators
Added by Leo van Kampenhout over 9 years ago
Hi Uwe and others,
I was wondering if it were possible to chain more than 64 operators in a single CDO call. Right now I get the following error message:
Error (processAddStream) : limit of 64 streams per process reached (processID = 0)!
My CDO version:
Climate Data Operators version 1.6.3 (http://code.zmaw.de/projects/cdo) Compiled: by csgteam on yslogin2 (x86_64-unknown-linux-gnu) Mar 3 2014 12:52:09 Compiler: gcc -std=gnu99 -fPIC -pthread
It would be convenient if this were possible, since it eliminates the need for temporary files and thus cuts I/O time.
Thanks,
Leo
Replies (6)
RE: Chaining more than 64 operators - Added by Uwe Schulzweida over 9 years ago
Hi Leo,
This limit is defined in the source file src/process.c line:
#define MAX_STREAM 64You can change this number and recompile the code.
We have no use case where a higher number of streams is needed, could you add an example command? This would help to optimize CDO.
Cheers, Uwe
RE: Chaining more than 64 operators - Added by Leo van Kampenhout over 9 years ago
Hi Uwe,
I work with a global climate model (CESM) that generates a single monthly history NetCDF containing all variables. Given a certain period of interest and a set of variables, I wrote a script (attached) that extracts the variables from the different monthly files and concatenate them together, thus creating a timeseries for each variable. With CDO I can do this using temporary files for each month/var combination, or using the chaining capability as the script has now. With the current setup I can do no more than 5 consecutive years (5*12 = 60 files).
Thanks, Leo
extract.py (2.37 KB) extract.py |
RE: Chaining more than 64 operators - Added by Uwe Schulzweida over 9 years ago
Hi Leo,
Thanks for your script!
If I understand it correctly then you are using the following CDO command:
cdo cat -selvar,varname file1 -selvar,varname file2 ... -selvar,varname filen resultYou can replace this command line by:
cdo select,name=varname file1 file2 ... filen result or with wildcards: cdo select,name=varname file* resultCheers, Uwe
RE: Chaining more than 64 operators - Added by Leo van Kampenhout over 9 years ago
Hi Uwe,
thanks for your reply! This seems to work great for most cases.
One minor annoyance left though. Whenever I try including the first year of the CESM simulation, CDO complains about input streams having different number of variables per timestep. This is because CESM does not write variables that are constant in time (just in the first time step). For the remainder of the simulation, these global attributes are written:
:Time_constant_3Dvars_filename = "./tr_eraimod_5_cap.clm2.h0.2001-01.nc" ;
:Time_constant_3Dvars = "ZSOI:DZSOI:WATSAT:SUCSAT:BSW:HKSAT:ZLAKE:DZLAKE" ;
I guess this trick is CESM-specific, as CDO SELECT does not account for it. In my previous setup this was not an issue however, as I did the selection before the concatenation. Would be great to hear your thoughts on this.
Cheers, Leo
RE: Chaining more than 64 operators - Added by Uwe Schulzweida over 9 years ago
Hi Leo,
thats right this feature is missing in CDO select. I will add it in the next release!
Cheers, Uwe
RE: Chaining more than 64 operators - Added by Leo van Kampenhout over 9 years ago
Awesome, thanks for that.
Leo