Hi, is there a matlab function to read .grib2 files (these are files similar to netcdf but Matlab nclibraries cant seem to be able to read them) thank you
    6 次查看(过去 30 天)
  
       显示 更早的评论
    
Hi, I need to read .grib2 files fast. I m currently using a java toolbox (njvarget) to read them but it takes a lot of time as the files are many. Is there a way to read them faster (changing function or reformatting them?)? thank you
0 个评论
采纳的回答
  Jacob Halbrooks
    
 2024-9-25
        As of R2023b, you can read data from a GRIB file (.grb, .grib, .grib2) using the Mapping Toolbox readgeoraster function. You can also get information about a GRIB file by using the georasterinfo function. These functions were enhanced in R2024b to support GRIB files that use CCSDS compression.
2 个评论
  Thomas Karl
 2025-1-18
				
      编辑:Walter Roberson
      
      
 2025-1-18
  
			 I am able to import  grib2 files for weather data from a couple of providers such as DWD and also for older grib2 files  from MeteoFrance, however newer MeteoFrance grib2 products ( https://meteo.data.gouv.fr/datasets/65bd1247a6238f16e864fa80 ) can neither  be read by readgeoraster nor by the  opensource nctoolbox
Not sure if somebody has looked at this and whether grib2 now comes in different subformats
Below an example (I have tried at least 10 different grib2 files from Meteofrance - it does not seem to be a problem for one specific file)
meteofrance='C:\0thomas\arome_local\aws\arome__0025__SP1__13H18H__2025-01-18T09_00_00Z.grib2'
names=meteofrance;
info = georasterinfo(names);
metadata = info.Metadata
numBands = info.NumBands % how many data fields?
->>>
Error using georasterinfo
Unable to read
'arome__0025__SP1__13H18H__2025-01-18T09_00_00Z.grib2'.
Format might not be supported, file might be
corrupt, or a supporting file might have been
specified.
  Jacob Halbrooks
    
 2025-1-22
				This might be due to the GRIB file being compressed, in which case an enhancement in R2024b may enable you to read the file into MATLAB. In particular, see the "Raster Import: Read data from compressed GRIB files" release note in Mapping Toolbox R2024b here.
更多回答(1 个)
  Marius
 2017-10-25
        Hi Thalia,
If you just want to read grb2 files. You may want to check out nctoolbox (https://github.com/nctoolbox/nctoolbox/).
You find some documentation here (https://github.com/nctoolbox/nctoolbox/wiki).
It is not explicitly fast. Although at least I did not make the experince that pygrib or the netCDF-Java API are significantly faster.
A word of warning: It does not work out of a Proxy network. Best of luck.
0 个评论
另请参阅
类别
				在 Help Center 和 File Exchange 中查找有关 Data Import and Analysis 的更多信息
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



