我在此链接中发送了六个 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
有人可以帮我吗?