ncks:ERROR接收到3个文件名;不需要超过两个



我在这个链接中发送了六个CSV文件(https://drive.google.com/drive/folders/1GQtyY1mI1YrK8GFP9SEo7dZfFHexKro3?usp=sharing)。这些文件中的每一个都有720行和360列,分别表示经度和纬度。第一个纬度点是-89.75,第一个经度点是-179.75,这些数据的分辨率是0.5度。我想把它们转换成NetCDF文件,所以我的代码是这样的:

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

不幸的是,我有以下错误:

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

有人能帮我吗?

此处的NCO文档解释了您从ncks收到该消息的最可能原因(NCO的旧版本,<4.2.5(。解决方案是升级并使用相同的命令,或者通过删除lon参数来继续使用古老的NCO:

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

最新更新