Skip to content
Snippets Groups Projects
VIPS Logo

VIPS Grid models

Tor-Einar Skog, Senior developer, NIBIO

Updated: 2023-11-17

What you will learn

This document describes how to set up a VIPS compatible DSS model displaying results in a grid, such as in the screenshot below:

Grid models example

Prerequisites

  • You should be familiar with web maps and WMS services
  • You should be familiar with using and manipulating gridded weatherdata files, e.g. NetCDF files or GRIB files

Architecture of the VIPS gridded model system

TODO: Architecture overview illustration

Structure of the WMS Service

VIPS expects the WMS Service to follow certain patterns in order to display it in a map.

Model metadata

You need at least these metadata set:

  • wms_title - Used to display the model's name (see illustration above)
  • wms_abstract - This is used to display the model's description (see illustration above)

WMS Layers

In order for VIPS to be able to utilize your WMS, you need to structure the layers in a specific way:

  • The layer names must follow this namespacing pattern: [MODEL_ID].[PARAMETER ID].[YYYY-MM-DD]. For instance, the PSILARTEMP (Carrot Rust Fly) model has these layers (for one day):
    • PSILARTEMP.WARNING_STATUS.2023-04-01
    • PSILARTEMP.DD.2023-04-01

For each layer, you need to specify metadata for classification and legend building, e.g. like in this mapfile excerpt:

LAYER
        NAME "PSILARTEMP.WARNING_STATUS.2023-04-01"
        DATA "/disks/data01/mapserver/data/PSILARTEMP/result_WARNING_STATUS_2023-04-01.tif"
        TEMPLATE "/disks/data01/mapserver/wms/PSILARTEMP/query_template.xml" TOLERANCE 1 TOLERANCEUNITS PIXELS
        TYPE RASTER
        PROCESSING "BANDS=1" # WARNING_STATUS band on top (others invisible, but band values are available in the query template)
        PROCESSING "NODATA=-1"
       
        
        STATUS ON
        METADATA
          "wms_title"     "Carrot rust fly (Psila rosae) temperature model 2023-04-01"  
        END  
          CLASSITEM "[pixel]"
      
        # class using simple string comparison, equivalent to ([pixel] = 0)
      
        CLASS
          NAME "Model not running"
          EXPRESSION ([pixel] >= 0 AND [pixel] < 2) 
          STYLE
              COLOR 112 112 112
          END
        END
        CLASS
          NAME "No infection risk"
          EXPRESSION ([pixel] >= 2 AND [pixel] < 3) 
          STYLE
              COLOR 0 180 87
          END
        END
        CLASS
          NAME "Possible infection risk"
          EXPRESSION ([pixel] >= 3 AND [pixel] < 4) 
          STYLE
              COLOR 255 204 0
          END
        END
        CLASS
          NAME "High infection risk"
          EXPRESSION ([pixel] >= 4) 
          STYLE
              COLOR  255 0 0
          END
        END
    END # Layer

This will result in correct color presentation in the map, and the availability of a legend for the map (see the upper right corner in the screenshot above)

Example Mapserver file

For your reference, please see the file examples/PSILARTEMP.map in this repository.

Existing VIPS grid models for reference: