爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 5486|回复: 1

[作图] 关于grib2格式的数据ncl画图(grib2数据中已指定兰伯特投影)

[复制链接]
发表于 2016-8-17 14:49:43 | 显示全部楼层 |阅读模式

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

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

x
上图是grib2文件, 变量的结构,其中坐标变量有x,y(没有lon,lat)
但是grib2中指定了,这个是兰伯特投影,还有一些参数,这个图怎么画?

上图是grib2文件转成的nc文件,变量中有gridlon_0,gridlat_0(都是二维数组1801x1901),温度值也是一个二维数组(1801x1901)




上图是我尝试着画出来的,感觉不大对,



部分ncl代码: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/cnmap/cnmap.ncl"
;----------------------------------------------------------------------
; This function creates a cylindrical equidistant map of Australia
; so you you can add polylines, polygons, or point data to it later.
;----------------------------------------------------------------------

;----------------------------------------------------------------------
; Main code
;----------------------------------------------------------------------
begin

path = "/usr/local/ncl/NCL/nc_read/"  
filename = "out.nc"
path=path+filename
;------------------------------------------------------------------------------------------------------------------
;read data from grb
  a = addfile(path,"r")
  datas=a->TMP_P0_L103_GLC0
;-----------------------------------------------------------------------------------------------------------------
;--- Open workstation.
  xwks="png"
  wks = gsn_open_wks(xwks,"shapefiles")
  gsn_define_colormap(wks,"custom_grib2_20160817")
;============================================

  res               = True
  res@tfDoNDCOverlay=True
  res@gsnMaximize   = True
  res@gsnDraw       = False
  res@gsnFrame      = False

  res@mpOutlineOn   = True                 ;show outline (boundary)
  res@mpFillOn      = True  
  res@mpDataBaseVersion = "MediumRes"

res@cnFillOn                = True               
res@cnLineLabelsOn    = True             ; turn off contour lines
res@cnLevelSelectionMode = "ExplicitLevels"        
res@cnLevels=(/270.6,277.3,284.1,290.9,297.6,304.4,311.1/)
;---Turn on fancier tickmark labels.
  res@pmTickMarkDisplayMode = "Always"
;------------------------------------------------------------------------------------------------
  res@mpProjection="LambertConformal"
  res@mpLambertParallel1F = 30.
  res@mpLambertParallel2F = 60.
  res@mpLambertMeridianF = 102.

;---Zoom in on area of interest
  res@mpLimitMode = "Corners"
  res@tiMainString          = "         "           ;map name

;---------------------------------------------------------------------------------------------------------

;---Create map.
  map=gsn_csm_contour_map(wks,datas,res)

;=================================================
cnres           = True
cnres@china     = True       ;draw china map or not叠加中国边界(shp)

chinamap = add_china_map(wks,map,cnres)
;---Drawing the map will also draw the attached polygons.
  draw(map)
  frame(wks)
end
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2016-8-17 15:03:30 | 显示全部楼层
在家园第一次发帖,图片没显示,请各位大神移步“关于ncl画图(grib2格式的数据,文件中指定是兰伯特投影)”
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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