||
GRIB是气象领域的常用数据格式,有grib-1和grib-2两个版本。通常一个数据文件的数据格式是唯一的,不过ECMWF作为气象领域的大佬还是比较任性的,弄出个grib-1和grib-2混合文件来,这就比较难为通用的grib数据处理软件了。NCL的email list里有相关的提问,答复只能先用wgrib等工具将数据文件分割为两个分别只包含grib-1和grib-2数据的文件,然后再用NCL读取、绘图。
Hi Balazs,
This is a known issue with NCL's GRIB reader. It currently cannot handle
these mixed GRIB 1 and 2 files. We have a ticket in place for this and we
do hope to solve it. If you want NCL to read the data in these files now
you will need to separately extract the GRIB1 and GRIB2 records into
separate files. I believe that you could do this either using the ECMWF
grib_api tool, or you could use the NCEP tools wgrib and wgrib2. wgrib.
Using wgrib and wgrib2 is pretty simple:
wgrib2 EL13040712 -grib grib2.grb
wgrib EL13040712 -grib -d all -o grib1.grb
produced files grib1.grb and grib2.grb that work fine with NCL.
ECMWF has something called grib_copy (
http://old.ecmwf.int/publications/manuals/grib_api/grib_copy.html) that is
also supposed to be easy to use.
Hope this helps.
-dave
MeteoInfo Java版对于grib数据的解码用的是Unidata开发的Netcdf Java库,关于如果读取混合文件的问题得到的答复如下:
同样需要先对混合文件进行分割。仔细看了看Netcdf Java库中相关代码,在读取grib数据时会根据第一个Message判断是grib-1还是grib-2。因此考虑事先给定grib-1或者grib-2格式,对数据文件按照两种格式读取两次,以便读取grib-1和grib-2中的所有变量。对MeteoInfo相关代码进行了修改实现了这样的功能,但是却发现读出来的变量还是偏少,看来这种方式并不能解决问题,目前还是需要先对混合文件进行分隔。
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-12-23 06:49
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社