Info |
---|
DocumentationThe ecCodes Python API is documented at:
There are examples of how to use it at:
Other useful resources: |
Preliminaries
Login to ecs-login and work in your $SCRATCH
...
This tutorial covers the following topics:
Table of Content Zone | ||||
---|---|---|---|---|
|
...
Info | ||
---|---|---|
| ||
Using the Python API to decode messages in a GRIB file |
The directory contains an example Python script called eccodes_demo.py which decodes data via a call to a function called grib_dump and some GRIB messages to be decoded in a file called grib_file.grib
Run the Python script unchanged and redirect the output to a file using:
No Format |
---|
$> ./eccodes_demo.py > output |
Look at the text information written to the file called output. Compare with the output obtained with the grib_ls and grib_dump commands:
No Format |
---|
$> grib_ls grib_file.grib
...
$> grib_dump grib_file.grib |
Your challenge is to change the Python script eccodes_demo.py to replace the call to the function codes_dump with several calls to codes_get or codes_get_array to decode the values for the edition, date, time, paramId (or shortName) and level keys. Add your own print statements to output this information.
Expand | ||
---|---|---|
| ||