爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 10901|回复: 1

函数g2fsh的用法

[复制链接]

新浪微博达人勋

发表于 2012-5-8 11:43:08 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

x
RT~~
不知道哪位有用过g2fsh这个函数?
我提取出来了grib2中的0.371*0.371°Gaussian数据,想转为经纬度中的1°*1°的数据,ncl中的g2fsh貌似可以的样子
我就试了一试,结果出来还是0.371*0.371

do nmonth=1,12
if((nmonth.eq.1).or.(nmonth.eq.3).or.(nmonth.eq.5).or.(nmonth.eq.7).or.(nmonth.eq.8).or.(nmonth.eq.10).or.(nmonth.eq.12)) then
k=123
end if
if((nmonth.eq.4).or.(nmonth.eq.6).or.(nmonth.eq.9).or.(nmonth.eq.11)) then
k=119
end if
if(nmonth.eq.2) then
k=111
end if
if(nmonth.lt.10) then
filename="/mnt/hgfs/data/grib2/dswr/dswsfc.gdas.20030"+nmonth+".grb2"
else
filename="/mnt/hgfs/data/grib2/dswr/dswsfc.gdas.2003"+nmonth+".grb2"
end if
in=addfile(filename,"r")
do n=0,k
do m=0,5
a=in->DSWRF_P8_L1_GGA0_avg(n,m,{-89.761:89.761},:)
b=g2fsh(a,(/180,360/))
fbindirwrite("/mnt/hgfs/data/2003fixeddswr2.dat",b)
end do
end do
end do


程序如上,不知道错在哪里,请高人指教,感谢不已~

密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2012-5-8 12:53:32 | 显示全部楼层
本帖最后由 hzwjy 于 2012-5-8 12:54 编辑
a=in->DSWRF_P8_L1_GGA0_avg(n,m,{-89.761:89.761},:)
b=g2fsh(a,(/180,360/))
fbindirwrite("/mnt/hgfs/data/2003fixeddswr2.dat",b)

问题可能是在fbindirwrite上面了。
因为fbindirwrite这个函数写数据会接着已有的文件写。如果你在运行这个脚本前“2003fixeddswr2.dat”这个文件已存在,画图的又没考虑到这个问题,那么得到的可能就不是你期望的那个数据。

另外前面的时间循环写得比较麻烦,如果电脑性能够,可以用g2fsh函数一次就把一月的数据都做格点转换了。
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表