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
13 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
thalia
le 18 Mai 2017
Commenté : Jacob Halbrooks
le 22 Jan 2025 à 13:24
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 commentaires
Réponse acceptée
Jacob Halbrooks
le 25 Sep 2024
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 commentaires
Thomas Karl
le 18 Jan 2025
Modifié(e) : Walter Roberson
le 18 Jan 2025
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
le 22 Jan 2025 à 13:24
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.
Plus de réponses (1)
Marius
le 25 Oct 2017
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 commentaires
Voir également
Catégories
En savoir plus sur Spreadsheets dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!