Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Confirmed.

Step-by-step guide

Suppose the we have a GRIB file, and we want to use some NumPy routines to manipulate the data values, and then write the result back to a GRIB file. The following Python code shows how to do this:

Code Block
languagepy
import metview as mv
import numpy as np

g = mv.read("mydata.grib")[0] # work on the first field only
vals = np.reciprocal(g.values())
g = g.set_values(vals)
mv.write('recip.grib', g)

Content by Label
showLabelsfalse
max5
spacesUDOC
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel = "metview-faqs" and type = "page" and space = "UDOC"
labelskb-how-to-article