- 积分
- 8997
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2013-3-14
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 亽小笨蜑■ɑ 于 2015-8-3 15:13 编辑
利用NCL提取WRF结果WRFOUT的数据,提取各类气象要素,例如风速,想存储为6列,名字分别是经度 纬度 时间 高度 u风速 v风速 存到txt文件中,现在不会排列数据,写的脚本如下,有哪位大神帮帮忙吗 多谢!
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
begin
; The WRF ARW input file.
a = addfile("/mnt/wrfout_d03_2014-10-10_00:00:00.nc","r")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; What times and how many time steps are in the data set?
time = wrf_user_getvar(a,"times",-1) ; get all times in the file
ntime = dimsizes(time) ; number of times in the file
; The specific height levels that we want the data interpolated to.
height_levels = (/ 10,30,50,70/) ; height levels to plot - in meter
height = height_levels
;==================================================================================
lat = wrf_user_getvar(a,"lat",-1)
lon = wrf_user_getvar(a,"lon",-1)
dimz = dimsizes(lat)
mlon = dimz(2)
nlat = dimz(1)
nheight = dimsizes(height)
nx = ntime*mlon*nlat*nheight
ny = 5
data = random_uniform(0,5,(/nx,ny/)) ; random numbers
;====================================================================================
; Remove file just in case
filename = "data.txt"
system("rm -f " + filename)
;====================================================================================
;====;First get the variables we will need
it = -1
z = wrf_user_getvar(a, "z",it) ; grid point height
u = wrf_user_getvar(a,"ua",it) ; u averaged to mass points
v = wrf_user_getvar(a,"va",it) ; v averaged to mass points
u_plane = wrf_user_intrp3d(u,z,"h",height,0.,False)
v_plane = wrf_user_intrp3d(v,z,"h",height,0.,False)
asciiwrite("data.txt",data)
end
|
|