Versions Compared

Key

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

...

So the following piece of code will do what we want in a more general way:

Code Block
languagepy
precip = read("precip.grib")

n = count(precip)
precip_3h = precip[2, n] - precip[1, n-1]
return precip_3h

Visualise the macro. Your plot may be blank! There is one more trick: we have created a derived field, and this changes the automatic scaling algorithm used when plotting. Precipitation is stored in metres, but we want to display it in mm. Modify the precip_shade icon and set:

Grib Scaling of Derived FieldsOn

Visualise you your macro result again and confirm that you now have precipitation only for the 3-hour periods, which does not accumulate with each frame.

...