日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

写入grib2++java_科学网—Mixed grib-1 and grib-2 data file - 王亚强的博文

發布時間:2024/3/24 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 写入grib2++java_科学网—Mixed grib-1 and grib-2 data file - 王亚强的博文 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

GRIB是氣象領域的常用數據格式,有grib-1和grib-2兩個版本。通常一個數據文件的數據格式是唯一的,不過ECMWF作為氣象領域的大佬還是比較任性的,弄出個grib-1和grib-2混合文件來,這就比較難為通用的grib數據處理軟件了。NCL的email list里有相關的提問,答復只能先用wgrib等工具將數據文件分割為兩個分別只包含grib-1和grib-2數據的文件,然后再用NCL讀取、繪圖。

Date: Fri Jun 20 2014 - 11:15:55 MDT

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庫,關于如果讀取混合文件的問題得到的答復如下:

Greetings Yaqiang,

netCDF-Java cannot handle this situation. I'm not sure what advantage

there is to ECMWF mixing grib records in a single file, but it would be

interesting to understand.

The only solution is to split the mixed grib file such that all of the

grib1 messages are in one file, and all of the grib2 messages are in

a second file.

I think you can do this using the grib_filter command line tool from

ecCodes (formally grib-api). You can write a rules file with the single

line:

write "./split/all_grib_[editionNumber]_records.grib[editionNumber]";

and then run:

grib_filter rules_files data/mixed.grb

where mixed.grb is the file containing the grib 1 and 2 messages. The result

will be that all of the grib1 messages will be output to:

split/all_grib_1_records.grib1

and all of the grib2 messages will be output to:

split/all_grib_2_records.grib2

For more info, check out:

Cheers,

Sean

同樣需要先對混合文件進行分割。仔細看了看Netcdf Java庫中相關代碼,在讀取grib數據時會根據第一個Message判斷是grib-1還是grib-2。因此考慮事先給定grib-1或者grib-2格式,對數據文件按照兩種格式讀取兩次,以便讀取grib-1和grib-2中的所有變量。對MeteoInfo相關代碼進行了修改實現了這樣的功能,但是卻發現讀出來的變量還是偏少,看來這種方式并不能解決問題,目前還是需要先對混合文件進行分隔。

轉載本文請聯系原作者獲取授權,同時請注明本文來自王亞強科學網博客。

鏈接地址:http://blog.sciencenet.cn/blog-611158-1052058.html

上一篇:Little endian HYSPLIT concentration data reading

下一篇:發布MeteoInfo 1.4.3

總結

以上是生活随笔為你收集整理的写入grib2++java_科学网—Mixed grib-1 and grib-2 data file - 王亚强的博文的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。