- 积分
- 14
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2020-12-10
- 最后登录
- 1970-1-1
|

楼主 |
发表于 2020-12-11 11:24:10
|
显示全部楼层
抱歉,不知道怎么上传图片,就把代码直接打上来了,前面的数字表示行号:
1 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl":
2 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
3 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
4 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
6 begin
7 f = addfile("/mnt/d/bilinear/pr_day.nc","r")
8 pr = f->pr(:,:,:)
9 lon = f->lon(:) ;(0-358.125) 1.875
10 lat = f->lat(:) ;(-90-90) 1.25
11 time = f->time(:) ;18262d
12 pr@_FillValue = 1e+20
13 pr@units = "kg m-2 s-1"
14 newlat = fspan(-90,90,181)
15 newlon = fspan(0,359,360)
16 newlat@units = "degrees_north"
17 newlon@units = "degrees_east"
18 newpr=new((/18262,181,360/),typeof(pr),1e+20)
19 newpr = linint2_Wrap(lon,lat,pr,True,newlon,newlat,0)
20 newpr!0 = "time"
21 newpr!1 = "lat"
22 newpr!2 = "lon"
23 newpr&lat = newlat
24 newpr&lon = newlon
25 ntim = dimsizes(time)
26 nlat = dimsizes(newlat)
27 nlon = dimsizes(newlon)
28 setfileoption("nc","Format","LargeFile")
29 fout = addfile("/mnt/d/bilinear/pr_day_ACCESS19500101-19991231.nc","c")
30 setfileoption(fout,"DefineMode",True)
31 dimNames = (/"time", "lat", "lon"/)
32 dimSizes = (/ ntim , nlat, nlon/)
33 dimUnlim = (/ True , False, False/)
34 filedimdef(fout,dimNames,dimSizes,dimUnlim)
35 filevardef(fout, "time" ,typeof(time),getvardims(time))
36 filevardef(fout, "lat" ,typeof(lat),getvardims(lat))
37 filevardef(fout, "lon" ,typeof(lon),getvardims(lon))
38 filevardef(fout, "pr" ,typeof(pr) ,getvardims(pr))
39 filevarattdef(fout,"pr",newpr)
40 filevarattdef(fout,"time" ,time)
41 filevarattdef(fout,"lat" ,newlat)
42 filevarattdef(fout,"lon" ,newlon)
43 fout->time = (/time/)
44 fout->lat = (/newlat/)
45 fout->lon = (/newlon/)
46 fout->pr = (/newpr/)
48 end
运行过程中报错:fatal:Could not creat (/mnt/d/bilinear/pr_dayACCESS19500101-19991231.nc)
warning:FileSetFileOption:invalid file or format
fatal:["Execute.c":8637]:Execute:Error occurred at or near line 34 in file /mnt/d/ncl/bilinear1211.ncl
不能创建输出文件,文件无效或者格式无效?不知道是怎么回事。第34行我是参照官网上写的,不知道为啥也报错了。可以麻烦您帮我看下嘛,谢谢! |
|