GRIB (.grb, .grib)
- Import supports Versions 1 and 2 of the GRIB format.
Background & Context
-
- GRIB scientific data file format.
- Self-describing format for exchanging scientific data.
- Commonly used in meteorology to store historical and forecast weather data.
- Represents numerical weather prediction output (NWP).
- GRIB is an acronym derived from Gridded Binary.
- Binary file format.
- Standardized by the World Meteorological Organization's Commission for Basic Systems.
Import & Export
- Import["file.grb"] imports a GRIB file, returning the names of the datasets stored in the file.
- Import["file.grb"] returns a list of strings representing the names of all datasets contained in the file.
- Import["file.grb",elem] imports the specified element from a GRIB file.
- Import["file.grb",{elem,suba,subb,…}] imports a subelement.
- Import["file.grb",{{elem1,elem2,…}}] imports multiple elements.
- The import format can be specified with Import["file","GRIB"] or Import["file",{"GRIB",elem,…}].
- See the following reference pages for full general information:
-
Import import from a file CloudImport import from a cloud object ImportString import from a string ImportByteArray import from a byte array
Import Elements
- General Import elements:
-
"Elements" list of elements and options available in this file "Summary" summary of the file "Rules" list of rules for all available elements - Data representation elements:
-
"Data" all datasets imported as a list of arrays "Datasets" names of all datasets - Import by default uses the "Datasets" element for the GRIB format.
- Specifying and selecting datasets:
-
"Datasets",n n
dataset"Datasets",dataset named dataset - Meta-information elements:
-
"Annotations" meta-information for each dataset "DataFormat" type used to represent each dataset "Dimensions" data dimensions of each dataset "Metadata" general meta-information as a list of rules
Examples
Basic Examples (3)
Get the names of datasets stored in a GRIB file:
Import[ "ExampleData/temperature.grb"]data = Import[ "ExampleData/temperature.grb", {"Datasets", "Temperature"}];Render the imported data as an image:
Colorize[ImageAdjust@Image[Reverse@data[[1]]], ColorFunction -> "ThermometerColors"]Read meta-information from a GRIB file:
Import[ "ExampleData/temperature.grb", "Metadata"]Related Guides
History
Introduced in 2010 (8.0)