- 积分
- 4507
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2016-4-23
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 刀客白刃 于 2018-3-26 20:34 编辑
;***********************************************
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
;***********************************************
a = addfile("/home/18qinc/test/wrfout_d03_2014-01-01_00:00:00","r")
;-----------------------------------------------------------------------
tt = wrf_user_getvar(a,"times",-1)
write_file = "20140101-Lanzhouxq.txt"
; Find the ij location for the point if interest
llres = True
llres@ReturnInt = True ; Return integer values
locij = wrf_user_ll_to_ij(a, 103.6532, 36.5914, llres)
locij = locij - 1 ; array pointers in NCL space
locX = locij(0)
locY = locij(1)
taus = ispan(0,144,1) ; create a time reference
wd_station= new(1,float)
; get time information and strip out the day and hour
times_in_file = a->Times
dims = dimsizes(times_in_file)
times = new(dims(0),string)
do i=0,dims(0)-1
times(i) = chartostring(times_in_file(i,8:12))
end do
;-----------------------------------------------------------------------
t2 = wrf_user_getvar(a,"T2",-1) ; get t2 for all times
u10 = wrf_user_getvar(a,"U10",-1)
v10 = wrf_user_getvar(a,"V10",-1)
t2_point = t2(:,locY,locX) ; extract a time series at a point
ua_station = u10(:,locY,locX)
va_station = v10(:,locY,locX)
WindVeo = sqrt(ua_station*ua_station+va_station*va_station)
pi=3.1415926
pi=3.1415926
do i=0,144
if (ua_station(i).eq.0.0 .and. va_station(i).ge.0.0)then
wd_station(i) = 0.0
end if
if (ua_station(i).eq.0.0 .and. va_station(i).lt.0.0)then
wd_station(i) = 180.0
end if
if (va_station(i).eq.0.0 .and. ua_station(i).ge.0.0)then
wd_station(i) = 90.0
end if
if (va_station(i).eq.0.0 .and. ua_station(i).lt.0.0)then
wd_station(i) = 270.0
end if
if (ua_station(i).gt.0.0 .and. va_station(i).gt.0.0)then
wd_station(i) = atan(abs(ua_station(i)/va_station(i)))*180/pi
end if
if (ua_station(i).gt.0.0 .and. va_station(i).lt.0.0)then
wd_station(i) = atan(abs(va_station(i)/ua_station(i)))*180/pi+90.0
end if
if (ua_station(i).lt.0.0 .and. va_station(i).lt.0.0)then
wd_station(i) = atan(abs(ua_station(i)/va_station(i)))*180/pi+180.0
end if
if (ua_station(i).lt.0.0 .and. va_station(i).gt.0.0)then
wd_station(i) = atan(abs(va_station(i)/ua_station(i)))*180/pi+270.0
end if
end do
do i=0,144
alist = [/tt,t2,u10,v10,WindVeo,wd_station/]
write_table(write_file, "a", alist, "%5d %5d %5d %5d %5d %5d")
print(tt+" is ok")
end do
;-----------------------------------------------------------------------
end
错误
fatal:Subscript out of range, error in subscript #0
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 75 in file tqljzd1.ncl
|
|