请选择 进入手机版 | 继续访问电脑版
爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 6977|回复: 3

[作图] WRF输出结果绘图,数据与地图不匹配

[复制链接]

新浪微博达人勋

发表于 2019-3-14 22:24:26 | 显示全部楼层 |阅读模式

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

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

x
输入的数据:把WRF的输出结果用CDO提取出累计降水并运算出某日降水后的nc文件

绘图方法:没有用NCL中专门对WRF后处理的函数,采用一般contour的绘图函数。

问题:将wrf结果中的XLONG,XLAT赋给要绘图的变量后,数据与底图的坐标不匹配。如果不对底图进行经纬度的设定,则把区域模拟的结果整个绘制在全球范围上。

根据模拟的区域对底图进行设定:

res@mpProjection = "LambertConformal"
res@mpLambertMeridianF = 115.
res@mpLimitMode = "LatLon"
res@mpMinLatF = 37.
res@mpMaxLatF = 42.
res@mpMinLonF = 114.
res@mpMaxLonF = 120.0
结果如图:

precip.png
--------------------------------------------------------------------------------------------

但是,如果不对底图范围进行设置,就会出现下图的情况:
precip1.png
----------------------------------------------------------------------------------------------

下面是ncl——filedump对数据的描述:
  dimensions:
      x = 265
      y = 255
      XTIME = 1  // unlimited
   variables:
      float XLONG ( y, x )
         standard_name :    longitude
         long_name :    longitude
         units :    degree_east
         _CoordinateAxisType :    Lon

      float XLAT ( y, x )
         standard_name :    latitude
         long_name :    latitude
         units :    degree_north
         _CoordinateAxisType :    Lat

      double XTIME ( XTIME )
         standard_name :    time
         units :    minutes since 2012-07-10 00:00:00
         calendar :    standard
         axis :    T

      float RAINNC ( XTIME, y, x )
         units :    mm
         coordinates :    XLONG XLAT
         FieldType :    104
         MemoryOrder :    XY
         description :    ACCUMULATED TOTAL GRID SCALE PRECIPITATION
         stagger :   

-------------------------------------------------------------------------------------------------

完整代码如下:
begin
a = addfile("precip.nc","r")
precip = a->RAINNC
Lon = a->XLONG
Lat = a->XLAT

precip@lat2d = Lat
precip@lon2d = Lon

precip@units = "mm"

printVarSummary(precip)
wks = gsn_open_wks("png","precip1")

res                      = True
res@gsnMaximize          = True

res@mpDataSetName         = "Earth..4"
res@mpDataBaseVersion     = "MediumRes"
res@mpOutlineBoundarySets       = "National"
res@mpOutlineOn               = True
res@mpOutlineBoundarySets     = "NoBoundaries"
res@mpGeophysicalLineThicknessF= 4.
res@mpNationalLineThicknessF= 4.
res@mpOutlineSpecifiers = (/"China:states","taiwan"/)
res@mpFillOn = False
res@mpGeophysicalLineColor  = "black"
res@mpNationalLineColor     = "black"
res@mpUSStateLineColor      = "black"
res@mpUSStateLineThicknessF = 3.
res@tfDoNDCOverlay      = True          ; Tell NCL you are doing a native plot
res@gsnAddCyclic        = False
;res@mpProjection = "LambertConformal"
;res@mpLambertMeridianF = 115.
;res@mpLimitMode = "LatLon"
;res@mpMinLatF = 37.
;res@mpMaxLatF = 42.
;res@mpMinLonF = 114.
;res@mpMaxLonF = 120.0

res@cnFillOn             = True
res@cnLinesOn            = False
res@cnLevelSpacingF      = 5.           ; NCL chose 4.0
res@tfDoNDCOverlay      = True
res@gsnAddCyclic        = False
res@gsnLeftString = "Total Precipitation"
res@tiMainString = "WRF Simulation"

plot = gsn_csm_contour_map(wks,precip(0,:,:),res)
end

密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2019-3-22 13:06:07 | 显示全部楼层
画图的时候尽量把地图mpres 和contour的 cnres分开,用overlay将contour叠加到map上
https://www.ncl.ucar.edu/Applications/overlay.shtml
你这是没设置地图的边界,随便找个别人的例子看看怎么设吧
https://www.ncl.ucar.edu/Documen ... p.shtml#mpLimitMode
密码修改失败请联系微信:mofangbao
回复 支持 1 反对 0

使用道具 举报

新浪微博达人勋

发表于 2019-3-15 09:35:42 | 显示全部楼层
以前帮忙弄过,不过现在已经忘了
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2019-3-22 12:08:10 | 显示全部楼层
;;--draw contour--;;
contour = wrf_contour(a,wks,mdbz,opts)

;;--show the plots--;;
plot = wrf_map_overlays(a,wks,(/contour/),pltres,mpres)


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

本版积分规则

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

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

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