wiki:CowsRoadmap

Integrate Pywms features

These notes are being prepared to document features of pywms that need porting to COWS in order to decommission pywms on the ipcc-ddc site.

The pywms source is on the  dcip trac at  http://proj.badc.rl.ac.uk/dcip/browser/ipcc-ddc/trunk/ddc-vis/pywms.

Colourmaps

Pywms supports configurable colourmaps for each layer using a ColourmapFactory? interface.

In cmap_manager.py IPCCColourmapFactory instances can be called with a pywms layer as it's only argument and must return a matplotlib colourmap object.

IPCCColourmapFactory is implemented as a wrapper around colourmap functions that take 2 arguments, layer.minValue and layer.maxValue. cmap_manager.py registers 4 specific instances using functions in the pywms.colourmaps.DDC_CMaps module. Each instance is registered with a specific colourmap name.

Therefore in general there are a set of named colourmap functions f(minValue, maxValue) that return matplotlib colourmap objects.

Configuring colourmaps

Each colourmap name as registered in cmip_manager.py is associated with particular layers in a pywms configuration file. The configuration file contains sections like:

[variable:eastward_wind]
title: Wind Eastward
varcaption: Surface Eastward Wind Climatology
cmap: ipcc_bluered

Where ipcc_bluered is the registered colourmap name.

It is also possible to override the min/max values in the data from the config file. This is necessary to keep certain colourmaps consistent:

E.g.

[variable:air_temperature_anomaly]
title: Temperature Anomaly
varcaption: Surface Air Temperature Anomaly
cmap: ipcc_temperature_anomaly
max_value: 30
min_value: -10

Colourmap code

See the module  pywms.colourmaps.DDC_CMaps for example code to generate matplotlib colourmaps. Also see  here for general colourmap documentation.

Captions

The pywms.caption_manager module enables configurable caption text by defining a formatter function associated with a configuration key. It takes information from the layer object which will also contain information defined in the configuration file for that layer.

In general formatter function need to get short descriptive text associated with data attributes such as institute, model, etc. and format them into a standard form.