Project

General

Profile

Issues with -apply chaining

Added by Evan Eastin 25 days ago

Hi there,

As in the title, I am having problems using the apply keyword where only the first operator specified after -apply is performed, e.g. only -sellonlatbox is run in the commands below and -selname is ignored. Switching the order of the operators shows the same behavior but with only -selname working.
I have been using the python bindings, but also ran the same call from the command line and found the same issue.

Here is the call in python:

self.cdo.mergetime(
    input=f'-apply,"-sellonlatbox,{self.bbox} -selname,{self.vars}" [ {infiles} ]',
    output=outf
)

and the debug output which I copy/pasted and ran directly from the command line, as well:

CALL  :cdo -O -s -mergetime -apply,"-sellonlatbox,-140,-50,14,54 -selname,U,V,OMEGA,H,T,QV,EPV" [ /projects/bccg/Data/REANA/MERRA2/M2I3NPASM/2001/*20010201.nc4 /projects/bccg/Data/REANA/MERRA2/M2I3NPASM/2001/*20010202.nc4 /projects/bccg/Data/REANA/MERRA2/M2I3NPASM/2001/*20010203.nc4 /projects/bccg/Data/REANA/MERRA2/M2I3NPASM/2001/*20010204.nc4 /projects/bccg/Data/REANA/MERRA2/M2I3NPASM/2001/*20010205.nc4 /projects/bccg/Data/REANA/MERRA2/M2I3NPASM/2001/*20010206.nc4 /projects/bccg/Data/REANA/MERRA2/M2I3NPASM/2001/*20010207.nc4 ] /scratch/eastinev/inc3d_reana/MC.200102_0.nc

cdo -V output (Python is 3.12 and cdo-python is version 1.6.0):

Climate Data Operators version 2.4.4 (https://mpimet.mpg.de/cdo)
System: x86_64-pc-linux-gnu
CXX Compiler: /m31/dev/sc_1_25/lib/spack/env/gcc/g++ -std=gnu++20 -g -O2 -fopenmp -pthread
CXX version : g++ (GCC) 11.4.1 20231218 (Red Hat 11.4.1-3)
CXX library : span ranges
C Compiler: /m31/dev/sc_1_25/lib/spack/env/gcc/gcc -g -O2 -fopenmp -pthread -pthread
C version : gcc (GCC) 11.4.1 20231218 (Red Hat 11.4.1-3)
F77 Compiler: /m31/dev/sc_1_25/lib/spack/env/gcc/gfortran -g -O2
F77 version : GNU Fortran (GCC) 11.4.1 20231218 (Red Hat 11.4.1-3)
Features: 32/250GB 4/64threads c++20 OpenMP45 Fortran pthreads HDF5 NC4/HDF5/threadsafe proj xml2 magics curl fftw3 avx2
Libraries: yac/3.1.0 NetCDF/4.9.2 HDF5/1.14.5 proj/9.4.1 xml2/2.13.5 curl/8.11.1 magics/4.9.3
CDI data types: SizeType=size_t
CDI file types: srv ext ieg grb1 grb2 nc1 nc2 nc4 nc4c nc5 nczarr 
     CDI library version : 2.4.4
 cgribex library version : 2.3.0
 ecCodes library version : 2.38.0
  NetCDF library version : 4.9.2 of Feb  5 2025 23:22:15 $
    exse library version : 2.0.0
    FILE library version : 1.9.1

Any thoughts on why this might be would be appreciated, thank you in advance!

Evan


Replies (2)

RE: Issues with -apply chaining - Added by Karin Meier-Fleischer 24 days ago

I'm able to reproduce the problem. You can use the 'normal' chaining to get the correct result, but you have to take care that the '[' and ']' as well as the ':' needs spaces before and after them.

cdo -mergetime [ -sellonlatbox,-140,-50,14,54 -selname,U,V,OMEGA,H,T,QV,EPV" : /projects/bccg/Data/REANA/MERRA2/M2I3NPASM/2001/*20010201.nc4 /projects/bccg/Data/REANA/MERRA2/M2I3NPASM/2001/*20010202.nc4 /projects/bccg/Data/REANA/MERRA2/M2I3NPASM/2001/*20010203.nc4 /projects/bccg/Data/REANA/MERRA2/M2I3NPASM/2001/*20010204.nc4 /projects/bccg/Data/REANA/MERRA2/M2I3NPASM/2001/*20010205.nc4 /projects/bccg/Data/REANA/MERRA2/M2I3NPASM/2001/*20010206.nc4 /projects/bccg/Data/REANA/MERRA2/M2I3NPASM/2001/*20010207.nc4 ] /scratch/eastinev/inc3d_reana/MC.200102_0.nc

RE: Issues with -apply chaining - Added by Evan Eastin 24 days ago

Great thank you, that is working correctly.

    (1-2/2)