Nazanin
Nazanin

Reputation: 29

ncks: ERROR received 3 filenames; need no more than two

I have six CSV files which I have sent in this link (https://drive.google.com/drive/folders/1GQtyY1mI1YrK8GFP9SEo7dZfFHexKro3?usp=sharing). Each of these files has 720 rows and 360 columns which indicates longitude and latitude respectively. The first point of latitude is -89.75, the first point of longitude is -179.75, and the resolution of these data is 0.5 degrees. I want to convert them to a NetCDF file, so my code is this:

cdo -f nc -setreftime,1900-01-01,00:00:00,1day \
          -settaxis,1901-01-01,12:00:00,1day \
          -setcalendar,standard \
          -input,gridfile.txt \
          1901_1.nc < CSV_TO_nc/1901_1.csv

cdo -f nc -setreftime,1900-01-01,00:00:00,1day \
          -settaxis,1901-01-02,12:00:00,1day \
          -setcalendar,standard \
          -input,gridfile.txt \
          1901_2.nc < CSV_TO_nc/1901_2.csv

cdo -f nc -setreftime,1900-01-01,00:00:00,1day \
          -settaxis,1901-01-03,12:00:00,1day \
          -setcalendar,standard \
          -input,gridfile.txt \
          1901_3.nc < CSV_TO_nc/1901_3.csv

...

cdo -O -chname,var1,tmp \
       -setattribute,var1@long_name='monthly mean temperature',var1@units='degrees Celsius' \
       -mergetime \
       1901_*.nc 1901.nc

ncpdq -O -a lon,lat,time 1901.nc tmp.nc

ncks -O --fix_rec_dmn lon tmp.nc 1901reorder.nc

and the gridfile.txt is:

gridtype = lonlat

gridsize = 259200

xname = lon

xlongname = longitude

xunits = degrees_east

yname = lat

ylongname = latitude

yunits = degrees_north

xsize = 720

ysize = 360

xfirst = -179.75

xinc = 0.5

yfirst = -89.75

yinc = 0.5

unfortunately, I have the following error:

ncks: ERROR received 3 filenames; need no more than two

Could somebody help me?

Upvotes: 0

Views: 606

Answers (1)

Charlie Zender
Charlie Zender

Reputation: 6352

The NCO documentation here explains the most probable reason (an old version of NCO, < 4.2.5) why you received that message from ncks. The solution would be to upgrade and use the same command, or to continue using an ancient NCO by eliminating the lon argument thusly:

ncks -O --fix_rec_dmn tmp.nc 1901reorder.nc # NCO < 4.2.5
ncks -O --fix_rec_dmn lon tmp.nc 1901reorder.nc # NCO >= 4.2.5

Upvotes: 1

Related Questions