load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"VALUE=new((/31,24,53/),string);创建数组应该放前面,不然每次循环都会重新创建一个
do i=1,31
if (i .lt. 10) then
file_obs="china_sites_2020080"+i+".csv"
else
file_obs="china_sites_202008"+i+".csv"
end if
row =361
col =1673
readvalue=new((/row,col/),string)
f_h = asciiread("sitelist.csv",-1,"string")
delim=","
site=str_get_field(f_h,1,delim)
allvalue=asciiread(file_obs,-1,"string")
allvalue@_Fillvalue="-999"
do u=1,col
readvalue(0:360,u-1)=str_get_field(allvalue,u,delim)
readvalue@_Fillvalue="-999"
end do
type=str_get_field(allvalue,3,delim)
Col=0
Row=0
do j=10,355,15
do k=3,col-1
if (any(site .eq. readvalue(0,k)))then
VALUE(i-1,Row,Col)= readvalue(j,k)Col=Col+1
end if
end doRow=Row+1
Col=0
end do
end do
VALUE!0="day"
VALUE!1="hour"
VALUE!2="site"reValue=VALUE(site|:,day|:,hour|:)dos=1,53
write_table("obs8o3_"+site(s-1)+".csv","w",[/reValue(s-1,0,8:23)/],"%s")
write_table("obs8o3_"+site(s-1)+".csv","a",[/reValue(s-1,1:,:)/],"%s")
end do