- 积分
- 1210
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2016-7-2
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 FrankieLJY 于 2017-4-30 11:10 编辑
背景:一共有30天的wrf模拟数据,每天一个文件,27个站点坐标,想求27个站点坐标每天数据的平均,就是把这27个点的日平均数据再做平均
代码:
begin
nlat=(/37.066667,37.366667,38.033333,38.083333,38.233333,\
38.366667,38.85,39.05,39.083333,39.083333,39.116667,39.283333,\
39.433333,39.65,39.733333,39.8,39.85,40.2,40.383333,\
40.416667,40.416667,40.45,40.783333,40.983333,41.15,\
41.2,41.966667/)
nlon=(/114.05,115.383333,114.416667,116.55,115.733333,117.35,\
115.516667,117.716667,114.566667,117.05,116.383333,118.466667,\
118.883333,118.1,117.283333,116.466667,\
119.516667,117.95,116.866667,115.05,118.95,115.966667,\
114.883333,117.95,114.7,116.63333,117.766667/)
a=addfile("/data2/JJJ2010-201001/output/wrfout_d02_2010-01-02_00:00:00", "r")
lat2d=wrf_user_getvar(a, "XLAT", 0)
lon2d=wrf_user_getvar(a, "XLONG", 0)
do t=0,29,1 ;30天数据,分30次读取
point=0. ;添加一个变量
if (t.lt.8) then
f=addfile("/data1/JJJ2010-201001/output/wrfout_d02_2010-01-0"+(t+2)+"_00:00:00", "r") ;读取时间对应的文件
tc=wrf_user_getvar(f, "T2", -1) ;取温度数据
s=dim_avg_n(tc,0) ;对整个24小时做平均
do i=0,26,1
pointvalue=rcm2points(lat2d, lon2d, s, nlat(i), nlon(i), 0) ;取27个点对应的值
pointvalue=pointvalue-273.15 ;转换为摄氏温度
point=point+pointvalue ;将27个点的温度累加起来
end do
point=point/27 ;再除以27 得到27个点的平均温度
print(point) :输出平均温度
delete(point) ;删除变量,再做循环是重新开始
end if
if (t.gt.7) then :和上面的代码一样类似
f=addfile("/data1/JJJ2010-201001/output/wrfout_d02_2010-01-"+(t+2)+"_00:00:00", "r")
tc=wrf_user_getvar(f, "T2", -1)
s=dim_avg_n(tc,0)
do i=0,26,1
point=point+rcm2points(lat2d, lon2d, s, nlat(i), nlon(i), 0)
pointvalue=pointvalue-273.15
point=point+pointvalue
end do
point=point/27
print(point)
delete(point)
end if
end do
end
问题:1.这个思路我觉得应该没有问题,但是出来的结果都是缺省值的一个结果,而且所有的结果都是一样,希望家园的朋友指出错误
2.对于print出来的结果,如果我想写到txt文件中,请问可以用什么方法啊,具体的语法可不可以说一下
|
|