爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 10548|回复: 3

ncl处理wrfout时如何作区域平均

[复制链接]

新浪微博达人勋

发表于 2016-7-31 14:25:29 | 显示全部楼层 |阅读模式

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

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

x
各位大神好!

麻烦请问,用ncl处理wrfout时,如何作区域平均?下面贴上我的ncl:
;*************************************************
; WRF: color over LC map with lat/lon labels
;************************************************
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/wrf/WRF_contributed.ncl"
begin
;************************************************
; open file and read in data
;************************************************
  f     = addfile ("F:\wangjing2\wrf-out\wrfout_d01_2000-04-01_00_00_00_2000_09_01_tt", "r")
  times = chartostring(f->Times)               ; built-in function
  ntim    = dimsizes(times)         ; # time steps
  rainc   = f->RAINC                 ; (Time, south_north, west_east)
  rainnc  = f->RAINNC     
;************************************************
  rainc   = rainc  > 0.0         
  rainnc  = rainnc > 0.0
  rainTot = rainc + rainnc         
  rainTot@description = "Precipitation"
  rainTot@units       =  rainc@units
;************************************************
x     =  (rainTot(ntim-1,:,:)-rainTot(60,:,:))/92;PH       ; (Time, bottom_top, south_north, west_east)

  wks = gsn_open_wks("png" ,"wrfout_d01_2000-04-01_00_00_00_2000_09_01_tt-rain678")           ; ps,pdf,x11,ncgm,eps
   gsn_define_colormap(wks,"MPL_BrBG") ; select color map

  res                       = True             ; plot mods desired
  res@gsnSpreadColors       = True             ; use full range of colormap
  res@cnFillOn              = True             ; color plot desired
  res@cnLinesOn             = False            ; turn off contour lines
  res@cnLineLabelsOn        = False            ; turn off contour labels
   res@gsnSpreadColorStart = 66
  res@gsnSpreadColorEnd   = 128
res@cnLevelSelectionMode = "ManualLevels"   
  res@cnMinLevelValF       =0
  res@cnMaxLevelValF       =  20
  res@cnLevelSpacingF      = 2
res@cnLevelSelectionMode = "ExplicitLevels"

  WRF_map_c(f, res, 0)                   ; reads info from file
  res@tfDoNDCOverlay       = True     
  if (.not.res@tfDoNDCOverlay) then
      x@lat2d = f->XLAT(0,:,:)                      ; direct assignment
      x@lon2d = f->XLONG(0,:,:)
  end if
  res@pmTickMarkDisplayMode = "Always"         ; turn on tickmarks
  
        res@tiMainString     = times(61)+"-"+times(ntim-1)
       res@gsnLeftString    = x@description
       plot                 = gsn_csm_contour_map(wks,x(:,:),res)
;下面开始作区域平均
shAve = wgt_areaave_Wrap(x( {27:31}, {105:120}),  1.0,1.0, 1)
printVarSummary(shAve)
  asciiwrite("wrfout_d01_2000-04-01_00_00_00_2000_09_01_tt_aave.txt", shAve)
end
出错在:
fatal:Dimension (1) of (x) is not named and therefore doesn't have an associated coordinate variable
怎么给x赋上wrfout的经纬度信息呢?或者还有其他的方法来做区域平均?求助!
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2017-4-8 17:27:19 | 显示全部楼层
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2018-7-23 14:11:29 | 显示全部楼层
楼主解决了吗?
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2021-10-13 17:25:44 | 显示全部楼层
Eudora99 发表于 2017-4-8 17:27
错误原因见网址https://www.ncl.ucar.edu/Support/talk_archives/2008/1809.html和https://www.ncl.ucar.ed ...

谢谢非常有帮助
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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