爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 8256|回复: 15

[作图] NCL作图如何插入地图

[复制链接]
发表于 2016-12-12 20:03:07 | 显示全部楼层 |阅读模式

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

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

x
请问用NCL做气象图时,如何插入地图?我转的是WRFOUT文件,ncl脚本是参考官网上的,哪位大神可以发给我一份带着地图的脚本,现在做出来的图都没有地图,谢谢
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2016-12-12 21:08:26 | 显示全部楼层
{:5_214:}{:5_214:}{:5_214:}{:5_214:}
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

 楼主| 发表于 2016-12-12 21:08:40 | 显示全部楼层
{:eb303:}{:eb303:}{:eb303:}{:eb303:}{:eb303:}
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

 楼主| 发表于 2016-12-12 21:08:47 | 显示全部楼层
{:eb334:}{:eb334:}{:eb334:}{:eb334:}{:eb334:}{:eb334:}
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

 楼主| 发表于 2016-12-12 21:08:55 | 显示全部楼层
{:5_196:}{:5_196:}{:5_196:}{:5_196:}{:5_196:}{:5_196:}
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

 楼主| 发表于 2016-12-12 21:09:01 | 显示全部楼层
{:eb502:}{:eb502:}{:eb502:}{:eb502:}{:eb502:}{:eb502:}{:eb502:}
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

 楼主| 发表于 2016-12-12 21:09:05 | 显示全部楼层
{:eb502:}{:eb502:}{:eb502:}{:eb502:}{:eb502:}{:eb502:}{:eb502:}
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

 楼主| 发表于 2016-12-12 21:09:09 | 显示全部楼层
{:5_196:}{:5_196:}{:5_196:}{:5_196:}{:5_196:}
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

发表于 2016-12-13 10:47:51 | 显示全部楼层
函数不一样,gsn_contour_map
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2016-12-13 13:46:46 | 显示全部楼层
邺下放歌 发表于 2016-12-13 10:47
函数不一样,gsn_contour_map

这是我的脚本,之前可以做出气象图,就是不知道怎么添加地图,插入地图脚本就一直报错,说是语法错误,希望您麻烦看一下
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
;load "./WRFUserARW.ncl"

begin
;
; Make a list of all files we are interested in
  DATADir = "/home/zhy/program/test-wrf/WRFV3/test/em_real/output/"
  FILES = systemfunc (" ls -1 " + DATADir + "wrfout* ")
  numFILES = dimsizes(FILES)
  print("numFILES = " + numFILES)
  print(FILES)
  print (" ")

; We generate plots, but what kind do we prefer?
; type = "ps"
  type = "pdf"
; type = "ps"
; type = "ncgm"
  wks = gsn_open_wks(type,"plt_Surface_multi_files")

; Set some basic resources
  res = True
  res@MainTitle                   = "REAL-TIME WRF"
  res@Footer = False

  pltres = True
  mpres = True


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   a = addfiles(FILES+".nc","r")
; f_lonlat = addfiles(FILES+".nc","r")

   times = wrf_user_getvar(a,"times",-1)  ; get all times in the file
   ntimes = dimsizes(times)         ; number of times in the file

  slp = wrf_user_getvar(a,"slp",-1)    ; slp
    wrf_smooth_2d( slp, 3 )            ; smooth slp
  tc = wrf_user_getvar(a,"tc",-1)      ; 3D tc
  u  = wrf_user_getvar(a,"ua",-1)      ; 3D U at mass points
  v  = wrf_user_getvar(a,"va",-1)      ; 3D V at mass points
  td2 =  wrf_user_getvar(a,"td2",-1)   ; Td2 in C
  tc2 = wrf_user_getvar(a,"T2",-1)     ; T2 in Kelvin
     tc2 = tc2-273.16                  ; T2 in C
  u10 = wrf_user_getvar(a,"U10",-1)    ; u at 10 m, mass point
v10 = wrf_user_getvar(a,"V10",-1)    ; v at 10 m, mass point

  tf2 = 1.8*tc2+32.                    ; Turn temperature into Fahrenheit
    tf2@description = "Surface Temperature"
    tf2@units = "F"
  u10 = u10*1.94386                    ; Turn wind into knots
  v10 = v10*1.94386
    u10@units = "kts"
    v10@units = "kts"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  res@pmTickMarkDisplayMode = "Always"
  res@mpDataSetName         = "Earth..4"
  res@mpDataBaseVersion     = "MediumRes"
  res@mpOutlineOn           = True
  res@mpOutlineSpecifiers   = (/"China:states"/)
  res@mpFillOn              = True
  res@mpFillBoundarySets    = "National"
  res@mpFillAreaSpecifiers  = (/"China:states","Taiwan"/)
  res@mpGeophysicalLineThicknessF = 2.0
  res@mpUSStateLineThicknessF     = 2.0

; gsn_define_colormap(wks,"WhViBlGrYeOrRe")
   WRF_map_c(a,res,0)
  res@tfDoNDCOverlay   = True
; lon2d = wrf_user_getvar(a[:],"XLONG",0)
; lat2d = wrf_user_getvar(a[:],"XLAT",0)
  tf2@lat2d = a->XLAT(0,:,:)
  tf2@lon2d = a->XLONG(0,:,:)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  do it = 0,ntimes-1,1             ; TIME LOOP
    wks = gsn_open_wks("pdf","plt_Surface_multi_files"+times(it))
    print("Working on time: " + times(it) )
    res@TimeLabel = times(it)   ; Set Valid time to use on plots

    ; Plotting options for T
      opts = res
      opts@cnFillOn = True
      opts@ContourParameters = (/ -20., 90., 5./)
      opts@gsnSpreadColorEnd = -3  ; End third from the last color in color map
      contour_tc = wrf_contour(a[0],wks,tf2(it,:,:),opts)
      delete(opts)


    ; Plotting options for SLP
      opts = res
      opts@cnLineColor = "Blue"
      opts@cnHighLabelsOn = True
      opts@cnLowLabelsOn = True
      opts@ContourParameters = (/ 900., 1100., 4. /)
  opts@cnLineLabelBackgroundColor = -1
      opts@gsnContourLineThicknessesScale = 2.0
      contour_psl = wrf_contour(a[0],wks,slp(it,:,:),opts)
      delete(opts)

    ; Plotting options for Wind Vectors
      opts = res
      opts@vcGlyphStyle = "LineArrow"
      opts@vcRefMagnitudeF = 2
      opts@vcRefLengthF = 0.003
      opts@FieldTitle = "Wind"       ; overwrite Field Title
      opts@NumVectors = 20           ; density of wind barbs
      vector = wrf_vector(a[0],wks,u10(it,:,:),v10(it,:,:),opts)
      delete(opts)


    ; MAKE PLOTS
     ; plot1 = wrf_map_overlays(a[0],wks,(/contour_tc,contour_psl,vector/),pltres,mpres)
     plot = gsn_csm_contour_map(wks,tf2(it,0,:,:),res)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

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

本版积分规则

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

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

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