我用ncl画图时出现底图和实际图形的坐标偏移,同学说可能是坐标没有固定,要重新设置坐标,于是修改后的部分程序如下:
;**********************************************************************
; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
begin
;-----------------读取数据-----------------------------
f = addfile("./mfwamglocep_2017010300_R20170104.nc","r");读取nc文件
lon = f->longitude(0:4319)
lon@units = "degrees_east"
lat = f->latitude(0:2040)
lat@units = "degrees_north"
H = f->VHM0(0,0:2040,0:4319) ;取nc变量赋值
H!0="lat"
H&lat = lat
H!1="lon"
H&lon = lon
wtype = "png"
wks1 = gsn_open_wks(wtype,"swh")
可是出现了报错:
(0) check_for_y_lat_coord: Warning: Data either does not contain a valid latitude coordinate array or doesn't contain one at all.
(0) A valid latitude coordinate array should have a 'units' attribute equal to one of the following values:
(0) 'degrees_north' 'degrees-north' 'degree_north' 'degrees north' 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg north'
(0) check_for_lon_coord: Warning: Data either does not contain a valid longitude coordinate array or doesn't contain one at all.
(0) A valid longitude coordinate array should have a 'units' attribute equal to one of the following values:
(0) 'degrees_east' 'degrees-east' 'degree_east' 'degrees east' 'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE' 'deg east'