爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 3336|回复: 1

[其他] 求助帖!!!将wrfout插值到500hpa

[复制链接]

新浪微博达人勋

发表于 2023-3-12 21:02:47 | 显示全部楼层 |阅读模式

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

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

x
想将wrfout插值到500hpa,看其流场图,代码如下:
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"

begin
dir="./"
filename="wrfout_d01_2022-08-12_18_00_00"
  a = addfile(dir+filename,"r")
wks = gsn_open_wks("pdf","500hpa")
gsn_define_colormap(wks,"gui_default")

; Set some Basic Plot options
  res = True
  res@MainTitle = "WRF-500hpa"

  pltres = True
  mpres = True
  mpres = True
  mpres@mpGeophysicalLineColor = "Black"
  mpres@mpNationalLineColor    = "Black"
  mpres@mpUSStateLineColor     = "Black"
  mpres@mpUSStateLineThicknessF  = 1
  mpres@mpDataBaseVersion="MediumRes"
  mpres@mpDataSetName="Earth..4"

  mpres@mpOutlineSpecifiers = (/"China:states","India","Nepal","Bhutan","Bangladesh","Myanmar", \
                                    "Thailand","Cambodia","Vietnam","Taiwan"/)

; What times and how many time steps are in the data set?
  times  = wrf_user_list_times(a)  ; get times in the file
  ntimes = dimsizes(times)         ; number of times in the file
do it = 0,ntimes-1            ; TIME LOOP

   print("Working on time: " + times(it) )
   res@TimeLabel = times(it)   ; Set Valid time to use on plots

   ;hgt
   ph   = wrf_user_getvar(a,"PH",it)      ; perturbation geopotential
   phb  = wrf_user_getvar(a,"PHB",it)     ; BASE STATE geopotential
   ph   = (ph + phb)/9.8

  ;pressure
   p   = wrf_user_getvar(a,"P",it)      ; perturbation pressure
   pb  = wrf_user_getvar(a,"PB",it)     ; BASE STATE PRESSURE
   p   = p + pb

   ht_500 = wrf_user_intrp3d(ph,p,"v",500,0,False)
   ph@description = "hgt_500(bottom_top_stag)"
   ph@units = "m"

    ; hgt
    opts = res
    opts@cnLineColor         = "Green"
    contour = wrf_contour(a,wks,ht_500(:,:),opts)
    plot = wrf_map_overlays(a,wks,(/contour/),pltres,mpres)
    delete(opts)
end do
end

报错如下:
Variable: times
Type: string
Total Size: 24 bytes
            3 values
Number of Dimensions: 1
Dimensions and sizes:   [3]
Coordinates:
Number Of Attributes: 2
  description : times in file
  _FillValue :  missing
(0)     2022-08-12_18:00:00
(1)     2022-08-12_21:00:00
(2)     2022-08-13_00:00:00
(0)     Working on time: 2022-08-12_18:00:00
fatal:Subscript out of range, error in subscript #0
fatal:An error occurred reading z_in
fatal:["Execute.c":8637]:Execute: Error occurred at or near line 344 in file $NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl

fatal:["Execute.c":8637]:Execute: Error occurred at or near line 44 in file hgt_500.ncl


作为一个NCL小白,,,,我555555555
谢谢大佬QAQ
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2023-11-26 17:34:36 | 显示全部楼层
wrf_user_intrp3d是不是已经弃用了?
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

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