- 积分
- 1571
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2016-4-18
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 覃建明 于 2020-5-6 20:37 编辑
打算提取2m高度的风速,但是提取出来为异常值(不存在数值),提取高度在50m处的风速是正常的,求大佬帮忙解答下,如何提取2m高度的风速。多谢!
代码如下:
begin
; ------------------read wrfout file-------------------
;diri = "../rundam3/"
;fils = systemfunc("ls "+diri+"wrfout_d04*") ;read all files in this folder
;a = addfiles(fils,"r")
;ListSetType (a, "cat")
f1=systemfunc("ls ../rundam3/wrfout_d04*");原地形方案topowind
a=addfiles(f1(0:23),"r") ;模拟时段,20150602 00:00-0607 00:00 BJ,5天
ListSetType (a, "cat")
times = wrf_user_list_times(a) ; get all times in the file
ntimes = dimsizes(times) ; number of times in the file
; -----------read Wind\temperature\dew point temperature\pressure\Height
u = wrf_user_getvar(a,"ua",-1) ; u averaged to mass points
v = wrf_user_getvar(a,"va",-1) ; v averaged to mass points
;tc=wrf_user_getvar(a, "tc",-1)
height = wrf_user_getvar(a, "z",-1)
ter = wrf_user_getvar(a, "ter",-1) ; ter=HGT(HGT_M, HGT_U, HGT_V)
;---------------- Select set station lon,lat,fixed height(from surface(m))[CHANGE HERE]----------------------------
Latitude = 23.1222
Longitude = 100.0008
hh=2
;------------------------------------------------------------------
res = True
res@returnInt = True ; False : return real values, True: return interger values
point = wrf_user_ll_to_ij(a,Longitude,Latitude,res) ; wrf_user_ll_to_ij(nc_file,lon,lat,opt)
;The function wrf_user_ll_to_ij find the nearest grid point for a specific lat and lon
point =point -1
x = point(0)
y = point(1)
ter2 = ter(0,y,x)
nheight = conform(height,ter,(/0,2,3/)) ; assuming height is a 3d array and ter is a 2d array
height = height - nheight
nheight2 = nheight(0,y,x)
height2 = height(0,y,x)
print("X location is:" + x)
print("Y location is:" + y)
print("ter is:" + ter2)
print("nheight is:" + nheight2)
print("height is:" + height2)
;-------------------interpolation----------------------
;wrf_user_intrp3d(��ά���飬��ֱ���飨ѹ��\�߶ȣ�����ֵ��Ϣ��TRUE=��point A�㵽point B�ĺ�����ͼ;����ΪFalse��)
u_ph = wrf_user_intrp3d( u,height,"h", hh,0.,False)
v_ph = wrf_user_intrp3d( v,height,"h", hh,0.,False)
;tch = wrf_user_intrp3d( tc,height,"h", hh,0.,False)
;-----------------------``--------------------------------------
spdh= sqrt(u_ph^2 + v_ph^2)
windspdh=spdh(:,y,x)
dirh=wind_direction(u_ph,v_ph,0)
winddirh=dirh(:,y,x)
;tcc=tch(:,x,y)
; ------ WRITE IN FILE --------------- *
npts=ntimes
fName = "842278H82m.txt" ;FILENAME
data = new( npts, "string") ;OUTPUTDATE
print(" Time Wind_dir_hm Wind_speed_hm ")
print ( times+sprintf("%12.0f",winddirh)+sprintf("%12.1f", windspdh) )
data = times + sprintf("%12.0f",winddirh)+sprintf("%12.1f", windspdh)
asciiwrite (fName,data)
end
|
|