| 
 
	积分5489贡献 精华在线时间 小时注册时间2011-9-23最后登录1970-1-1 
 | 
 
| 
本帖最后由 ztftom 于 2012-3-14 11:23 编辑
x
登录后查看更多精彩内容~您需要 登录 才可以下载或查看,没有帐号?立即注册 
  
 到现在为止,我所知道的使用python读取grib文件的方法有两个,都需要安装额外的package:
 1. pygrib
 http://code.google.com/p/pygrib/
 基于ECMWF GRIB API。 这个package的安装我始终没有成功,大家可以继续尝试一下。
 
 2. pyNIO
 http://www.pyngl.ucar.edu/Nio.shtml
 我现在在用的一个软件包,下载解压缩之后放在EPD python的library里面就可以调用了。
 =========下面是一个小样例======
 import numpy as np      # pyNio is based on Numpy
 import Nio                    # import pyNio
 fname = '~/data/fnl'       # replace with real filename
 f     = Nio.open_file(fname, mode='r',\
 options=None, history='', format='grib')   # open the file
 var   = f.variables[var_name]   # build up the pointer to the variable
 var_value = var.get_value()     # get the value of the variable
 f.close()                                 # close file
 =======  END ========
 
 GRIB文件需要独立的索引表才能读取。pyNio对主流的reanalysis data有内建的索引表(基于wgrib)。具体细节可参考上面给出的链接。下面是从reanalysis的GRIB中读到的SST画出的图:
 
   
 
 
 
 | 
 评分
查看全部评分
 |