日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 >

用matlab处理grib2,关于Matlab2017b读取GRIB2文件的问题

發(fā)布時間:2025/3/15 49 豆豆
生活随笔 收集整理的這篇文章主要介紹了 用matlab处理grib2,关于Matlab2017b读取GRIB2文件的问题 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

由于經(jīng)常需要處理grib2格式的大氣海洋數(shù)據(jù),因此,經(jīng)常用到用于讀取nc、hdf、grib等數(shù)據(jù)的Matlab工具箱:nctoolbox和snctools。Matlab版本升級為Matlab2017b之后,出現(xiàn)了問題,以前的2015b、2016a、2016b、2017a均可以正常使用。問題具體表現(xiàn)如下。

由于nctoolbox和snctools是通過調(diào)用NetCDF的java庫文件,所以需要在toolbox\local\classpath.txt指定java的路徑,nctoolbox和snctools都是2014年之前開發(fā)的工具箱,默認(rèn)使用的netcdf-java是4.2版本,但不能正確識別最近GRIB2格式中一些變量,特別是本人常用的CFSR、GFS、GDAS數(shù)據(jù)集中部分變量不能識別。為了能夠正常讀取所有的GRIB2變量,我在Matlab2015b、Matlab2016b的時候都是使用netcdf-java-4.6.9、netcdf-java-4.6.10,但是,但是,但是,切換到Matlab2017b,一起變了,只能使用netcdf-java-4.2才能讀取GRIB2文件,4.3、4.4、4.5、4.6的所有版本都試了一遍,都不行。苦逼的是,4.2版本,雖然能讀取,可有很多變量不能識別,也就是說讀取文件并不正常,用起來也就沒什么意義。

請教解決方案。

使用netcdf-java-4.2版本打開GRIB2文件時候,自動生成*.gbx8文件;使用4.6版本的,則自動生成*.gbx9和*.ncx3兩個文件。

Matlab2017b打開GRIB2文件錯誤信息如下:

>> fn

fn =

'f:\gdas2.0p25.2016120100.f00.grb2'

>> q=nc_info(fn)

錯誤使用 nc_info_java (line 26)

Java exception occurred:

java.io.IOException: java.lang.RuntimeException: java.lang.NoSuchFieldError: userTimeUnit

at ucar.nc2.NetcdfFile.open(NetcdfFile.java:427)

at ucar.nc2.NetcdfFile.open(NetcdfFile.java:394)

at ucar.nc2.NetcdfFile.open(NetcdfFile.java:381)

at ucar.nc2.NetcdfFile.open(NetcdfFile.java:369)

Caused by: java.lang.RuntimeException: java.lang.NoSuchFieldError: userTimeUnit

at ucar.nc2.NetcdfFile.(NetcdfFile.java:1596)

at ucar.nc2.NetcdfFile.open(NetcdfFile.java:835)

at ucar.nc2.NetcdfFile.open(NetcdfFile.java:424)

... 3 more

Caused by: java.lang.NoSuchFieldError: userTimeUnit

at

ucar.nc2.grib.collection.Grib2CollectionBuilder$Grib2Rectilyser.make(Grib2CollectionBuilder.java:259)

at ucar.nc2.grib.collection.Grib2CollectionBuilder.makeGroups(Grib2CollectionBuilder.java:163)

at

ucar.nc2.grib.collection.GribCollectionBuilder.createMultipleRuntimeCollections(GribCollectionBuilder.java:150)

at ucar.nc2.grib.collection.GribCollectionBuilder.createIndex(GribCollectionBuilder.java:138)

at ucar.nc2.grib.collection.GribCdmIndex.openGribCollectionFromDataFile(GribCdmIndex.java:780)

at ucar.nc2.grib.collection.GribCdmIndex.openGribCollectionFromDataFile(GribCdmIndex.java:764)

at ucar.nc2.grib.collection.GribCdmIndex.openGribCollectionFromRaf(GribCdmIndex.java:734)

at ucar.nc2.grib.collection.GribIosp.open(GribIosp.java:213)

at ucar.nc2.NetcdfFile.(NetcdfFile.java:1560)

... 5 more

出錯 nc_info (line 55)

fileinfo = nc_info_java(ncfile);

總結(jié)

以上是生活随笔為你收集整理的用matlab处理grib2,关于Matlab2017b读取GRIB2文件的问题的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。