...
So the following piece of code will do what we want in a more general way:
Code Block | ||
---|---|---|
| ||
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 Fields | On |
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.
...