爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 2732|回复: 0

NCL画水汽通量(fnl)

[复制链接]

新浪微博达人勋

发表于 2015-10-23 17:57:37 | 显示全部楼层 |阅读模式
NCL
系统平台:
问题截图: -
问题概况: 参考http://bbs.06climate.com/forum.php?mod=viewthread&tid=13017&extra=page%3D6帖子上画水汽通量,改了相应的变量名,试运行提示错误
fatal:syntax error: line 14 in file vaper_flux_wind.ncl before or near 0
0
--^

fatal:error in statement
fatal:Syntax Error in block, block not executed
fatal:error at line 224 in file vaper_flux_wind.ncl
我看过提问的智慧: 看过
自己思考时长(天): 3

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

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

x
参考http://bbs.06climate.com/forum.php?mod=viewthread&tid=13017&extra=page%3D6帖子上画水汽通量
改了相应的变量名,试运行提示错误
fatal:syntax error: line 14 in file vaper_flux_wind.ncl before or near 0
  0
--^
fatal:error in statement
fatal:Syntax Error in block, block not executed
fatal:error at line 224 in file vaper_flux_wind.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/csm/shea_util.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/skewt_func.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/wind_rose.ncl"
;*********************************************************
begin
plot=new(2,graphic)                              
  grb_file = addfile("/public/home/huanglei/data/fnl_20130316_18_00.grib","r")
;500hgt*********************************************************************

  0tt       = grb_file->TMP_P0_L100_GLL0({850},:,:)
  rhprs    = grb_file->RH_P0_L100_GLL0({850},:,:)
  u        = grb_file->UGRD_P0_L100_GLL0({850},:,:)
  v        = grb_file->VGRD_P0_L100_GLL0({850},:,:)
  tc       = tt-273.16
  lev      = tt@lv_ISBL0
  td=tc-((14.55+0.114*tc)*(1-0.01*rhprs)+(((2.5+0.007*tc)*(1-0.01*rhprs))^3)+(15.9+0.37*tc)*((1-0.01*rhprs)^14))
  vapr=6.112*exp((17.67*td)/(td+243.5))
  ee=vapr*1.001+(lev-100)/900*0.0034
  mixr=0.62137*(ee/(lev-ee))*1000/9.8
  qu=u*mixr
  qv=v*mixr

  mm=sqrt(qu^2+qv^2)
   do i=0,359
    do j=0,180
         if (mm(j,i).lt.15)then
              mm(j,i)=0
          end if
    end do
   end do

  copy_VarCoords(tt,qu)
  copy_VarCoords(tt,qv)
  copy_VarCoords(rhprs,mm)
  copy_VarMeta(tt,qu)
  copy_VarMeta(tt,qv)
  copy_VarMeta(rhprs,mm)

  wks =gsn_open_wks("pdf","fnl_vapour_flux")
  gsn_define_colormap(wks,"BlAqGrYeOrReVi200")   
  vcres = True
  vcres@gsnAddCyclic  = False
  vcres@gsnDraw      = False                        ; don't draw yet
  vcres@gsnFrame     = False                        ; don't advance frame yet

  vcres@mpDataSetName         = "Earth..3"   ; This new database contains  
  vcres@mpDataBaseVersion     = "MediumRes"  ; Medium resolution database
  vcres@mpOutlineOn           = True         ; Turn on map outlines
  vcres@mpProjection          = "CylindricalEquidistant"
  vcres@tiMainString          =""
  vcres@mpGeophysicalLineThicknessF = 0.35      ; double the thickness of geophysical boundaries
  vcres@mpNationalLineThicknessF    = 0.5      ; double the thickness of national boundaries
  vcres@pmTickMarkDisplayMode = "Always"
          vcres@mpMinLatF         =  -25                         ;最小纬度
          vcres@mpMaxLatF         =  50                        ;最大纬度
          vcres@mpMinLonF         =  40                        ;最小经度
          vcres@mpMaxLonF         =  160                       ;最大经度

   vcres@gsnDraw      = False                        ; don't draw yet
  vcres@gsnFrame     = False                        ; don't advance frame yet
                                       
  vcres@lbLabelBarOn = True
  vcres@lbLabelStride       = 2         ; plot every other colar bar label
  vcres@lbOrientation        = "vertical"         ; vertical label bars
  vcres@vcRefMagnitudeF         = 10.0              ; make vectors larger
  vcres@vcRefLengthF            = 0.018            ; ref vec length
  vcres@vcGlyphStyle            = "CurlyVector"    ; turn on curly vectors
  vcres@vcMinDistanceF          = 0.017            ; thin out vectors
  vcres@vcRefAnnoOn = False

  vcres@vcMonoFillArrowFillColor  = True
  vcres@vcLineArrowThicknessF  = 1.0
  vcres@vcRefAnnoOn  =False
  vcres@vcVectorDrawOrder= "PostDraw"
    vcres@gsnLeftString =""
   vcres@gsnRightString =""
  vcres@tiMainString =""
  plot(0)=gsn_csm_vector_map(wks,qu,qv,vcres)  ; create plot
  txres               = True                           
  txres@txFontHeightF = 0.020             ; Set the font height
  txres@txPerimOn     = True
  txres@txBackgroundFillColor =0
  txres@txPerimColor    = 0
;************************************************************************************************
res                 = True                    ; plot mods desired
res@gsnDraw         = False                   ; don't draw yet
res@gsnFrame        = False                   ; don't advance frame yet
res@cnFillOn        = True                    ; turn on color
res@gsnSpreadColors = True                    ; use full colormap
res@gsnSpreadColorStart = 0
res@gsnSpreadColorEnd   = 199
res@cnLinesOn       = False                   ; turn off contour lines
res@cnLineLabelsOn  = False                   ; tuen off line labels
res@cnInfoLabelOn =False
res@cnLevelSelectionMode="ExplicitLevels"
res@cnLevels=(/14,18,22,26,30,34,38,42,46,50,52/)
  res@gsnLeftString =""
  res@gsnRightString =""
  res@tiMainString =""
res@lbLabelBarOn = False
res@lbLabelStride       = 2         ; plot every other colar bar label
res@lbOrientation        = "vertical"         ; vertical label bars

   mm=smth9(mm,0.5,0.25,False)

plot01 = gsn_csm_contour(wks,mm,res)
overlay(plot(0),plot01)

delete(grb_file)
delete(tt)
delete(rhprs)
delete(u)
delete(v)
delete(tc)
delete(lev)
delete(td)
delete(vapr)
delete(ee)
delete(mixr)
delete(qu)
delete(qv)
delete(mm)

;********************************************************************************
  grb_file = addfile("./fnl_20060714_18_00.grib","r")

  tt       = grb_file->TMP_P0_L100_GLL0({850},:,:)
  rhprs    = grb_file->RH_P0_L100_GLL0({850},:,:)
  u        = grb_file->UGRD_P0_L100_GLL0({850},:,:)
  v        = grb_file->VGRD_P0_L100_GLL0({850},:,:)
  tc       = tt-273.16
  lev      = tt@lv_ISBL0


  td=tc-((14.55+0.114*tc)*(1-0.01*rhprs)+(((2.5+0.007*tc)*(1-0.01*rhprs))^3)+(15.9+0.37*tc)*((1-0.01*rhprs)^14))
  vapr=6.112*exp((17.67*td)/(td+243.5))
  ee=vapr*1.001+(lev-100)/900*0.0034
  mixr=0.62137*(ee/(lev-ee))*1000/9.8
  qu=u*mixr
  qv=v*mixr

  mm=sqrt(qu^2+qv^2)
   do i=0,359
    do j=0,180
         if (mm(j,i).lt.15)then
              mm(j,i)=0
          end if
    end do
   end do

  copy_VarCoords(tt,qu)
  copy_VarCoords(tt,qv)
  copy_VarCoords(rhprs,mm)
  copy_VarMeta(tt,qu)
  copy_VarMeta(tt,qv)
  copy_VarMeta(rhprs,mm)
  vcres@vcRefAnnoOn = True
  plot(1)=gsn_csm_vector_map(wks,qu,qv,vcres)  ; create plot
  txres               = True                           
  txres@txFontHeightF = 0.020             ; Set the font height
  txres@txPerimOn     = True
  txres@txBackgroundFillColor =0
  txres@txPerimColor    = 0
   mm=smth9(mm,0.5,0.25,False)

plot11 = gsn_csm_contour(wks,mm,res)
overlay(plot(1),plot11)
  pres                 = True
  pres@gsnPanelRowSpec = True
  pres@gsnPanelCenter  = False
  pres@gsnFrame        = False
  pres@lbAutoManage    = False
  pres@gsnPanelLabelBar    = True                ; add common colorbar
  pres@lbLabelFontHeightF  = 0.009               ; make labels smaller
  pres@lbLabelStride       = 2               

  gsn_panel(wks,plot,(/2/),pres)


frame(wks)
  end

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

本版积分规则

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

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

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