Average rainfall 2001-2016, global tropics

Map: Average rainfall 2001-2016, global tropics

VWB map layout and media export

Thomas Gumbricht bio photo By Thomas Gumbricht

Introduction

This post presents a processing chain for creating map layouts and export media from the calculations of Vertical Water Balance (VWB) in the previous post.

Prerequisites

You must have completed the VWB processing in the previous post.

Vertical Water Balance

Project module

The project module file (projVWB.py) is available in the Project package projects.

Process Chain

The project file links to an ASCII text file that contains a list of the xml files to execute. The layout and export processes are under the folder Layout.

projFN ='doc/Layout/VWB_TRMM-vs-FAOrefevap-layout_YYYYMMDD.txt'

As the path to the project file does not start with a slash “\”, the path must be relative to the project module itself. The project package available on Karttur’s GitHub page contains the path and the files required for running the process chain.

Layout

If you want to create color maps/images and animations for presenting the VWB data you must create the required layout (see post on TRMM layout for more details).

Set scaling

Layout exports require scaling the original data to byte (0 - 255) range. Details on the scaling are given in the posts on layout of SMAP and TRMM. The xml on createscaling below calls the scaling definition process createscaling and sets the scaling of both the monthly and annual VWB layers, and all the layers produced as part of the trend analysis.

Add palette

The VWB palettes below, created with the process addrasterpalette, are Karttur’s default palettes for VWB.

<

Create legends

To create legends for use together with maps, use the process createlegend.

Add movieclock

You do not need to add a special movieclock for VWB, the default movieclock works fine. But if you want to create a customised movieclock, the process is addmovieclock. The only parameter that is required is the name of the movieclock, all other parameters are set to default unless explicitly given as parameters (thus the movieclock added below will be identical to the default movieclock).

Export legend

Use the process exportlegend to export stand alone legends. The process produces three legends, as a Scalable Vector Graphics (.svg file), a .png file and a compressed .jpg file.

Export images and create animation

With the scaling and palettes defined, you can export any of the VWB layers created above with the process exporttobyteancillary.

Export monthly images

Export statistical and trend results

All exports use the same process exporttobyteancillary, you just have to set the timestep and compostions to export all the statistical data, including the results of the trend analysis.

Create movie frames

The process movieframeancillary converts the exported images (from previous step) to movie frames. The process is basically a dimension conversion that can also create an embossed text on the fly. For the process movieframeancillary to work you must have installed imagemagick as explained in another blogpost.

To run the process fully automated you must set the parameter asscript to False, otherwise you must manually execute the shell script file reported when the process comes to an end.

Note that because the three versions of VWB (the total VWB, suplus VWB and deficit VWB) were organized to be stored in the same directory (or folder) path, you can only create one animation at the time. If you want to create animations of all three versions you must delete the “movieframe” folder between each creation.

Create movie clock and animation

The process movieclockancillary first creates the movieclocks to combine with the movie frames from the previous step, and then creates the movie/animation itself. To run the process fully automated you must set the parameter asscript to False, otherwise you must manually execute the shell script files reported when the process comes to an end. By default the process will create script files so you must explicitly enter asscript="False" if you want the process to generate the complete animation on the fly.

For the process <span class=’package’movieclockancillary</span> to work you must have installed FFmpeg as explained in another blogpost.

Monthly Vertical Water Balance estimated from TRMM rainfall and reference evapotranspiration.