今天只做简单记录,后面有机会再完善。
- grib简介
GRIB是WMO开发的一种用于交换和存储规则分布数据的二进制文件格式。主要用来表示数值天气预报的产品资料。现行的GRIB 码版本有GRIB1 (filename.grb)和GRIB2 (filename.grib)两种格式。 GRIB2较之GRIB1具有更多优点而被广泛使用。如:表示多维数据、模块性结构、支持多种压缩方式、IEEE标准浮点表示法等。
有关grib文件的详细描述参考:
https://blog.csdn.net/Mae_Liu/article/details/106172567 .
- 读grib的工具
笔者所知的grib的读取工具有:
1.wgrib/wgrib2
2.python(pygrib、xarry)
3.eccodes、eccodes-python
4.ncl(使用ncl_convert2nc命令转为nc文件)
简单介绍eccodes在Python界面下的读取,后面有时间再补充。
1.使用anaconda创建一个Python3环境
2.安装一个eccodes包
conda install -c conda-forge cfgrib eccodes
3.简单地读取
import eccodes
from eccodes import *
接下来就可以使用Python进行读取了
另外也可安装eccodes
安装方法详见:https://github.com/ecmwf/eccodes
只需有一行命令便可grib-nc
grib_to_netcdf -o output_filename.nc input_filename.grib2
简单的使用方法参见:https://www.bbsmax.com/A/QV5Z6qbe5y/
2020-9-29 : a great tool for reading grib data
wget https://github.com/nwpc-oper/nwpc-data.git
cd nwpc-data-master/
pip install .
please see more details here: https://blog.perillaroc.wang/post/2020/2020-04-23-nwpc-data-quickstart/
参考文献:
https://www.bbsmax.com/A/QV5Z6qbe5y/
https://github.com/ecmwf/eccodes
https://www.bbsmax.com/A/QV5Z6qbe5y/
…