- 积分
- 2748
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2018-6-11
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
使用全球地形起伏模型(ETOPO2)的数据想要绘制地形等高线,但是使用gsn_csm_contour_map最后得到的图上没有经纬度,请问是什么原因呢?
原始文件信息、部分代码以及样图如下。
原始文件信息:
- #ETOPO2v2g_f4.nc
- dimensions:
- x = 10801 ;
- y = 5401 ;
- variables:
- float x(x) ;
- x:long_name = "x" ;
- x:actual_range = -180., 180. ;
- float y(y) ;
- y:long_name = "y" ;
- y:actual_range = -90., 90. ;
- float z(y, x) ;
- z:long_name = "z" ;
- z:_FillValue = NaNf ;
- z:actual_range = -10722.f, 8046.f ;
- // global attributes:
- :Conventions = "COARDS" ;
- :title = "z" ;
- :history = "grdreformat ETOPO2v2g_GMT_int.grd ETOPO2v2g_GMT_flt2.grd" ;
- :node_offset = 0 ;
- }
复制代码
绘图代码:
- begin
- load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
- load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
- load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
- load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
- load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"
- load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/ut_string.ncl"
- ;选定范围
- f2 = addfile("ETOPO2v2g_f4.nc","r")
- z = f2->z((2700+34*30):(2700+44*30),(5400+87*30):(5400+108*30))
- y = f2->lat((2700+34*30):(2700+44*30))
- x = f2 ->lon((5400+87*30):(5400+108*30))
- ;为二维数组z添加属性
- z!0 = "lat"
- z!1 = "lon"
- x@units = "degrees_east"
- y@units = "degrees_north"
- z&lat = y
- z&lon = x
- z&lat@units = "degrees_north"
- z&lon@units = "degrees_east"
- wks = gsn_open_wks("png","2018_uv10")
- ;set basic resource
- res = True
- res@gsnDraw = False
- res@gsnFrame = False
- res@gsnMaximize = True
- res@gsnLeftString = ""
- res@gsnRightString = ""
- res@vpWidthF = 0.6 ;窗口大小
- res@vpHeightF = 0.4
- res@pmLabelBarOrthogonalPosF = 0.05
- ;------Topography
- ret = res
- ret@cnFillOn = True
- ret@cnLinesOn = False
- ret@cnFillPalette = "MPL_Greys"
- ret@mpDataBaseVersion = "MediumRes"
- ret@mpOutlineOn = True
- ret@mpDataSetName = "Earth..4"
- ret@mpOutlineSpecifiers = (/"China:states","Gansu"/)
- ret@mpGeophysicalLineThicknessF = 3
- ret@mpNationalLineThicknessF = 3
- ret@mpFillDrawOrder = "PostDraw"
- ret@mpFillOn = False
- ret@mpProjection = "mercator"
- ret@mpLimitMode = "Corners"
- ret@mpFillAreaSpecifiers = (/"water","land" /)
- ret@mpSpecifiedFillColors = (/"white","white"/)
- ret@mpSpecifiedFillColors = (/100,0/)
- ret@mpLeftCornerLatF = min(y)
- ret@mpLeftCornerLonF = min(x)
- ret@mpRightCornerLatF = max(y)
- ret@mpRightCornerLonF = max(x)
- ret@lbLabelPosition = "left"
- ret@lbOrientation = "Vertical"
- ret@pmLabelBarOrthogonalPosF =-1.25
-
- ret@gsnAddCyclic = False ;未覆盖全地球,值设置为False
- ret@tmXBTickSpacingF=4. ;坐标轴间距
- ret@tmYLTickSpacingF=2.
- top = gsn_csm_contour_map(wks,z,ret)
- draw(top)
- frame(wks)
- end
复制代码
|
|