爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 7872|回复: 0

[作图] 图做出来无经纬度,想请教一下原因

[复制链接]
发表于 2020-10-20 15:12:28 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
使用全球地形起伏模型(ETOPO2)的数据想要绘制地形等高线,但是使用gsn_csm_contour_map最后得到的图上没有经纬度,请问是什么原因呢?
原始文件信息、部分代码以及样图如下。

原始文件信息:
  1. #ETOPO2v2g_f4.nc
  2. dimensions:
  3.         x = 10801 ;
  4.         y = 5401 ;
  5. variables:
  6.         float x(x) ;
  7.                 x:long_name = "x" ;
  8.                 x:actual_range = -180., 180. ;
  9.         float y(y) ;
  10.                 y:long_name = "y" ;
  11.                 y:actual_range = -90., 90. ;
  12.         float z(y, x) ;
  13.                 z:long_name = "z" ;
  14.                 z:_FillValue = NaNf ;
  15.                 z:actual_range = -10722.f, 8046.f ;

  16. // global attributes:
  17.                 :Conventions = "COARDS" ;
  18.                 :title = "z" ;
  19.                 :history = "grdreformat ETOPO2v2g_GMT_int.grd ETOPO2v2g_GMT_flt2.grd" ;
  20.                 :node_offset = 0 ;
  21. }
复制代码


绘图代码:
  1. begin
  2. load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
  3. load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
  4. load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
  5. load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
  6. load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"
  7. load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/ut_string.ncl"

  8. ;选定范围               
  9.                 f2 = addfile("ETOPO2v2g_f4.nc","r")
  10.                 z = f2->z((2700+34*30):(2700+44*30),(5400+87*30):(5400+108*30))
  11.                 y = f2->lat((2700+34*30):(2700+44*30))
  12.                 x = f2 ->lon((5400+87*30):(5400+108*30))
  13. ;为二维数组z添加属性               
  14.                 z!0 = "lat"
  15.                 z!1 = "lon"
  16.                 x@units = "degrees_east"
  17.                 y@units = "degrees_north"
  18.                 z&lat = y
  19.                 z&lon = x
  20.                 z&lat@units = "degrees_north"
  21.                 z&lon@units = "degrees_east"

  22.                 wks = gsn_open_wks("png","2018_uv10")

  23. ;set basic resource
  24.         res                = True
  25.         res@gsnDraw        = False
  26.         res@gsnFrame       = False
  27.         res@gsnMaximize    = True

  28.                 res@gsnLeftString  = ""
  29.                 res@gsnRightString = ""
  30.                 res@vpWidthF       = 0.6           ;窗口大小
  31.                 res@vpHeightF      = 0.4
  32.         res@pmLabelBarOrthogonalPosF = 0.05

  33. ;------Topography
  34.                 ret = res
  35.                 ret@cnFillOn = True
  36.                 ret@cnLinesOn = False
  37.                 ret@cnFillPalette = "MPL_Greys"

  38.                 ret@mpDataBaseVersion                        = "MediumRes"
  39.         ret@mpOutlineOn                                        = True                       
  40.                 ret@mpDataSetName                                = "Earth..4"
  41.                 ret@mpOutlineSpecifiers                        = (/"China:states","Gansu"/)
  42.         ret@mpGeophysicalLineThicknessF        = 3
  43.         ret@mpNationalLineThicknessF        = 3
  44.                 ret@mpFillDrawOrder                                = "PostDraw"
  45.                 ret@mpFillOn                                        = False
  46.                 ret@mpProjection                = "mercator"      
  47.                 ret@mpLimitMode                 = "Corners"
  48.                 ret@mpFillAreaSpecifiers                = (/"water","land" /)
  49.                 ret@mpSpecifiedFillColors                = (/"white","white"/)
  50.                 ret@mpSpecifiedFillColors                = (/100,0/)
  51.                 ret@mpLeftCornerLatF            = min(y)
  52.                 ret@mpLeftCornerLonF            = min(x)
  53.                 ret@mpRightCornerLatF           = max(y)      
  54.                 ret@mpRightCornerLonF           = max(x)

  55.                 ret@lbLabelPosition = "left"
  56.                 ret@lbOrientation = "Vertical"
  57.                 ret@pmLabelBarOrthogonalPosF =-1.25
  58.                
  59.                 ret@gsnAddCyclic = False                ;未覆盖全地球,值设置为False

  60.                 ret@tmXBTickSpacingF=4.            ;坐标轴间距
  61.                 ret@tmYLTickSpacingF=2.

  62.                 top = gsn_csm_contour_map(wks,z,ret)

  63. draw(top)
  64.         frame(wks)

  65. end
复制代码

2018_uv10.png


密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表