爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 15661|回复: 5

wrf-ncl

[复制链接]

新浪微博达人勋

发表于 2015-10-10 18:53:40 | 显示全部楼层 |阅读模式
2金钱
WRF新手{:cry:}跪求赐教!!!可私聊,必有重谢!!!
WRF已经运行完成,想要将运行结果与模拟区域某站点数据进行对比以评估模拟准确性。目前,对于如何将数据提取出来仍有很多问题。下面是写关于提取数据的脚本(整理官网脚本等所得),运行脚本存在错误,看了大家的帖子n久,仍然不知道如何下手,求高手指教!!!!!
;***********************************************
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/WRFUserARW.ncl"
;***********************************************
begin
;***********************************************
DATADir ="/lustre/home/esechzh/models/WRFV3.7/run/"
FILES = systemfunc (" ls -1 " +DATADir + "wrfout_d03* ")
numFILES = dimsizes(FILES)
print("numFILES = " + numFILES)
print(FILES)
print (" ")
a =addfiles(FILES+".nc","r")
; What times and how many time steps are inthe data set?
times =wrf_user_getvar(a,"times",-1)  
; get all times in the file
ntimes = dimsizes(times)         
; number of times in the file
; The specific height levels that we wantthe data interpolated to.
height_levels = (/ 10., 20./)   ; height levels to plot - in meter
nlevels = dimsizes(height_levels)     ; number of height levels
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; First get the variables we will need        

   tc = wrf_user_getvar(a,"tc",-1)     ; T in C
   u  =wrf_user_getvar(a,"ua",-1)    ; u averaged to mass points
   v  =wrf_user_getvar(a,"va",-1)    ; v averaged to mass points
   p  = wrf_user_getvar(a,"pressure",-1) ; pressure is our vertical coordinate
   rh = wrf_user_getvar(a,"rh",-1)     ;relative humidity
   z  = wrf_user_getvar(a,"z",-1)        ; grid pointheight
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


; Find the ij location for the point ifinterest
  lat= 31
  lon= 121
llres = True
llres@ReturnInt = True   ; Returninteger values
locij = wrf_user_ll_to_ij(a, lon, lat, llres)
locij = locij - 1        ; arraypointers in NCL space
locX = locij(0)
locY = locij(1)        
tc_point  = tc(:,:,locY,locX);extract a time series at a point
;rh_point = rh(:,:,locY,locX)
  dolevel = 0,nlevels-1                 ;LOOP OVER LEVELS

     height = height_levels(level)

     p_plane  = wrf_user_intrp3d(p,z,"h",height,0.,False)
     tc_plane = wrf_user_intrp3d(tc_point,z,"h",height,0.,False)
     rh_plane = wrf_user_intrp3d(rh_point,z,"h",height,0.,False)
     u_plane  = wrf_user_intrp3d(u,z,"h",height,0.,False)
     v_plane  = wrf_user_intrp3d(v,z,"h",height,0.,False)
  enddo


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
alist = [/times, tc_plane, p_plane,rh_plane, u_plane, v_plane/]
write_table("data.csv","w", alist, "%d%16.2f%s%d%ld")
end






密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2015-10-10 20:02:51 | 显示全部楼层
什么错?
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2015-10-10 20:19:08 | 显示全部楼层

fatal:Subscript out of range, error in subscript #0
fatal:An error occurred reading dims
fatal:["Execute.c":8575]:Execute: Error occurred at or near line 225 in file $NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl

fatal:["Execute.c":8575]:Execute: Error occurred at or near line 54 in file datatest.ncl
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2015-10-10 20:20:01 | 显示全部楼层
luoluo312 发表于 2015-10-10 20:19
fatal:Subscript out of range, error in subscript #0
fatal:An error occurred reading dims
fatal:[ ...

能帮我看看这样写对吗,可以提取出数据转存成csv格式吗

密码修改失败请联系微信:mofangbao
回复

使用道具 举报

新浪微博达人勋

发表于 2015-12-17 14:46:37 | 显示全部楼层
变量名字不对吧
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

新浪微博达人勋

发表于 2015-12-17 17:27:25 | 显示全部楼层
我记得有一个帖子说这个的。没有这么麻烦吧
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

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

本版积分规则

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

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

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