Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagepy
linenumberstrue
import requests
from eccodes import codes_new_from_message, codes_get, codes_release

url='https://some.gov/pub/data/temperature.grib2'
print('Started downloading...')
r = requests.get(url)
data = r.content # raw bytes

# Convert each field to a handle in turn
offset = 0
while offset < len(data):
    h = codes_new_from_message(data[offset:])
    print(offset, codes_get(h, 'step'), codes_get(h, 'shortName'))
    # Advance through the bytes by the length of the message
    offset += codes_get(h, 'totalLength')
    codes_release(h)
Info



Content by Label
showLabelsfalse
max5
spacesUDOC
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel in ("decode","python") and label = "decodeeccodes-faqs" and label = "pythonpython3" and type = "page" and space = "UDOC"
labelsdecode python

...

Page properties
hiddentrue


Related issues