- 积分
- 8197
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2018-7-3
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2024-1-15 14:54:02
|
显示全部楼层
h2 = new(429,float) ;39年*11日 滑动 筛选90th
h3 = new((/365,45,321/),float) ;90th
do i =0,364,1
do j =0,44,1
do k =0,320,1
if (.not.all(ismissing(h0(:,i,j,k))) .and. (i.ge.5) .and. (i.le.359)) ;h0为海温序列(year,day,lat,lon), i为day,可进行修改
h1 = ndtooned(h0(:,(i-5):(i+5),j,k)) ;429数据转成一维方便后续排序
h2 := h1(ind(.not.ismissing(h1))) ;去掉缺测值
m = dimsizes(h2) ;区域内非缺测的格点数
qsort(h2) ;进行排序
if ((toint(floor(0.9*m))) .eq. (0.9*m))then ;判断第90th个数是否为整数
h3(i,j,k) = h2(toint(0.9*m))
else ;不是整数则前后两个数求平均得到90th
a=toint(floor(0.9*m))
b=toint(ceil(0.9*m))
h3(i,j,k)=(h2(a)+h2(b))/2
end if
delete(h1)
delete(h2)
else if(.not.all(ismissing(h0(:,i,j,k))) .and. ((i.lt.5))) ;前后11天涉及365天首尾相接
h1 = ndtooned(h0(:,(360+i):364,j,k))
hn = ndtooned(h0(:,0:(i+5),j,k))
a1 = array_append_record (h1, hn, 0)
h2 := a1(ind(.not.ismissing(a1)))
qsort(h2)
m = dimsizes(h2)
if ((toint(floor(0.9*m))) .eq. (0.9*m))then
h3(i,j,k) = h2(toint(0.9*m))
else
a=toint(floor(0.9*m))
b=toint(ceil(0.9*m))
h3(i,j,k)=(h2(a)+h2(b))/2
end if
;h3(i,j,k)=(h2(386)+h2(387))/2
delete(h1)
delete(hn)
delete(h2)
else if(.not.all(ismissing(h0(:,i,j,k))) .and. ((i.gt.359)))
h1 = new((/30,11,45,321/),float)
h1(:,0:(i-360),j,k) = h0(:,0:(i-360),j,k)
h1(:,(i-359):10,j,k) = h0(:,(i-5):364,j,k)
hn = ndtooned(h1)
h2 := hn(ind(.not.ismissing(hn)))
;printVarSummary(h2)
qsort(h2)
m = dimsizes(h2)
if ((toint(floor(0.9*m))) .eq. (0.9*m))then
h3(i,j,k) = h2(toint(0.9*m))
else
a=toint(floor(0.9*m))
b=toint(ceil(0.9*m))
h3(i,j,k)=(h2(a)+h2(b))/2
end if
;h3(i,j,k)=(h2(386)+h2(387))/2
delete(h1)
delete(hn)
delete(h2)
end if
end if
end if
end do
end do
end do
h3!0 ="time"
h3!1 ="lat"
h3!2 ="lon"
h3&lat = nlat
h3&lon = nlon
h3&time = time |
|