爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 8218|回复: 5

NCL制图

[复制链接]
发表于 2016-1-9 14:30:11 | 显示全部楼层 |阅读模式

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

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

x

我进行NCL出图,使用的是Windsat全球数据,投影好的,可是大小和分辨率怎么设置,我使用的数据
分辨率是25*25公里的。现在出图如下所示,代码如下所示。

    想请教几个问题,1、图片整体大小如何与图像分辨率设置同步。2、如何使空白区域和内部
图片合理配置,怎么和分辨率联系到一起。

;************************************************
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"   
;************************************************
begin
;************************************************
; read in netCDF file
;************************************************
  input = "/home/gexz/TestParam/NCL/WindSat/WindSatA_SWS_20150101.HDF"
  f = addfile(input,"r")
  
  sws = f->SWS
  dir = f->SWD
  sws@_FillValue = -999
  dir@_FillValue = -999
  u = sws*cos(dir*3.1415926/180.0)
  v = sws*sin(dir*3.1415926/180.0)
  
  u@_max = max(u)
  u@_min = min(u)
  v@_max = max(v)
  v@_min = min(v)
  

  printVarSummary(u)
  printVarSummary(v)


  wks_type = "png"
  wks_type@wkWidth = 1450
  wks_type@wkHeight = 745
  wks = gsn_open_wks(wks_type,"Test1")
  gsn_define_colormap(wks,"rainbow")
   
   res                             = True            ; plot mods desired

   res@cnFillOn                    = True            ; turn on color
   res@cnLinesOn                   = False         ; no contour lines
   res@cnFillMode                  = "RasterFill"    ; turn on raster mode
   res@gsnSpreadColors             = True            ; use full color map 是否从整个colormap中平均取值
   res@vpKeepAspect                = True
   res@vpWidthF                    = 0.8
   res@vpHeightF                   = 0.8
   res@vpXF                        = 0.1
   res@vpYF                        = 1.0
   res@lbLabelBarOn                = True            ; turn off individual cb's  显示/隐藏颜色条
;   res@lbTitleString               = "m/s";设置颜色条的标题
   res@lbLabelAlignment            = "ExternalEdges";设置颜色标签显示的位置
   res@pmLabelBarWidthF            =  0.75;设置颜色条的宽度
   res@pmLabelBarHeightF           = 0.1;设置颜色条的高度
   res@cnLineLabelsOn              =  False          ;图像中等值线标签

   res@mpFillOn                    = False           ; don't fill contours 是否填充地图
   res@mpGeophysicalLineThicknessF = 2.0             ; line thickness 设置地图轮廓线的宽度
   res@mpGeophysicalLineColor      = "black"         ; boundaries color 设置地图轮廓线的颜色
   res@vcGlyphStyle                = "LineArrow"   ; WindBarb CurlyVector turn on curley vectors 向量图类型
   res@vcRefMagnitudeF             = 20.             ; define vector ref mag 设置向量的弯曲程度
   res@vcRefLengthF                = 0.020           ; define length of vec ref 设置向量的长度
   res@vcRefAnnoOrthogonalPosF     = -0.17           ; move ref vector 设置向量图标偏移位置
   res@vcMinDistanceF              = 0.015           ; thin vectors  设置向量的疏密程度。
   res@vcRefAnnoString2            = "m/s"           ; unit string   设置向量单位
   res@vcRefAnnoString2On          = True            ; turn on second string 显示向量单位字符
   res@gsnScalarContour            = True            ; vectors on contours
   res@vcLineArrowColor = "red"
   res@vcLineArrowThicknessF = 2.0
   res@vcVectorDrawOrder = "PostDraw"
   
   res@gsnScalarContour            = True            ; vectors on contours
   res@cnLevelSelectionMode        = "ManualLevels"  ;设计颜色调范围和间距
   res@cnLevelSelectionMode = "ManualLevels"
   res@cnMinLevelValF = 0
   res@cnMaxLevelValF = 45
   res@cnLevelSpacingF = 2
   res@gsnRightString  = ""
   res@gsnLeftString  = ""
   res@gsnDraw                     = False           ; don't draw yet
   res@gsnFrame                    = False           ; don't advance frame yet

   res@txFontHeightF               = 0.014           ; shrink upper text

;   res@gsnAddCyclic                = False           ; regional data
;   res@mpMinLatF                   = -90
;   res@mpMaxLatF                   = 90
;   res@mpMinLonF                   = 0
;   res@mpMaxLonF                   = 360
   res@mpCenterLonF = 180 ;choose center lon
   res@mpCenterLatF = 0.0   ; choose center lat
   res@mpSatelliteDistF = 5.0  
   plot = gsn_csm_vector_scalar_map_ce(wks,u,v,sws,res)
  
   pres                  = True

   pres@lbLabelBarOn     = False           ; turn off individual cb's  显示/隐藏颜色条
   pres@gsnMaximize      = True                         ; blow up plots
   pres@txString         = "Sea Surface Direction"      ; common title
   pres@lbLabelStride    = 4                            ; label bar stride
   pres@gsnPanelLabelBar = True      
   gsn_panel(wks,plot,(/1,1/),pres)  


end
111.png
密码修改失败请联系微信:mofangbao
发表于 2016-1-15 13:51:22 | 显示全部楼层
请问数据在哪里下载的啊??
密码修改失败请联系微信:mofangbao
发表于 2016-10-27 16:55:07 | 显示全部楼层
楼主是不是发现  res@vpWidthF                    = 0.8
   res@vpHeightF                   = 0.8
   res@vpXF                        = 0.1
   res@vpYF                        = 1.0
失效了?白边的范围太大?
密码修改失败请联系微信:mofangbao
发表于 2016-10-27 16:55:37 | 显示全部楼层
请问楼主这个问题解决了吗?
密码修改失败请联系微信:mofangbao
发表于 2018-1-22 13:39:29 | 显示全部楼层
请问这个格式的windsat数据哪里下载的?
密码修改失败请联系微信:mofangbao
发表于 2018-3-19 14:33:58 | 显示全部楼层
感谢你的分享,对我有很大帮助
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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