03-Extension to the WCS core: Web Coverage Processing Service

This tutorial is a practical introduction into the Web Coverage Processing Service.
Examples include:


Web Coverage Processing Service (WCPS) requests

The previous tutorial explained the principal setup of WCS requests. A Web Coverage Processing Service (WCPS) is an extension of the WCS core suite. A WCPS has the same setup as a WCS and consists of three components:

  • Service endpoint,
  • request type and
  • query parameter.

Service endpoint with service description remained unchanged:
http://earthserver.ecmwf.int/rasdaman/ows?service=WCS&version=2.0.1

Request type:
The processing extension defines an additonal request type:

Query parameter:
Based on a text-based SQL-like query language, data can be accessed, modified and retrieved.
The principal setup of a query is:

&query=for c in (coverageId) return encode (c[...], "format"),</p>

with:

  • coverageId: specifies the parameter (coverage) the query shall be applied on.

Example: temp2m for ERA-interim 2m air temperature

  • [...]: specifies the data or subset of data to work with. You can subset any axis of the coverage.

Example: the coverage temp2m has three axes: Lat, Long, ansi, and subsets of all three axes can be defined as: [Lat(-10.0:10.0), Long(-10.0:10.0), ansi("1999-01-01T00:00":"1999-01-31T18:00")].

  • format: the implied output format can be specified here.

Possible format encodings are:

  • csv
  • netcdf or
  • png

The following examples show a variety of WCPS queries and mathematical operations that can be applied to the data of a WCS Server. Examples base on ERA-interim 2m air temperature global fields, 6-hourly values from 1 January 1979 to 31 December 2015

  • Retrieve 2m air temperature in Kelvin for Italy for 15 January 1999 at 12 UTC encoded as csv

(Note: csv output is suitable for further data processing and integrating data request into processing routines in Python for example)

http://earthserver.ecmwf.int/rasdaman/ows?service=WCS&version=2.0.1&request=ProcessCoverages&query=for c in (temp2m) return encode(c[Lat(35.4:47.1), Long(6.6:18.5),ansi("1999-01-15T12:00")],"csv")

Note: Both queries above do not require WCPS per se. Same data can be rerieved with WCS core requests.

Get the minimum, maximum and mean temperature in degree celsius of Berlin for the year 2003

There are already predefined operators for retrieving the minimum, maximum and mean: min(), max() and avg(). We additionally convert the 2m air temperature in K into degC via a simple subtraction.

  • Minimum

for c in (temp2m) return encode (min ( c[Lat(52), Long(13),ansi("2003-01-01T00:00":"2003-12-31T18:00")] ) - 273.15,"csv")

http://earthserver.ecmwf.int/rasdaman/ows?service=WCS&version=2.0.1&request=ProcessCoverages&query=for c in (temp2m) return encode(min (c[Lat(52), Long(13),ansi("2003-01-01T00:00":"2003-12-31T18:00")]) - 273.15,"csv")

  • Maximum

for c in (temp2m) return encode (max ( c[Lat(52), Long(13),ansi("2003-01-01T00:00":"2003-12-31T18:00")] )- 273.15,"csv")

http://earthserver.ecmwf.int/rasdaman/ows?service=WCS&version=2.0.1&request=ProcessCoverages&query=for c in (temp2m) return encode(max (c[Lat(52), Long(13),ansi("2003-01-01T00:00":"2003-12-31T18:00")]) - 273.15,"csv")

  • Average

for c in (temp2m) return encode (avg ( c[Lat(52), Long(13),ansi("2003-01-01T00:00":"2003-12-31T18:00")] ) - 273.15,"csv")

http://earthserver.ecmwf.int/rasdaman/ows?service=WCS&version=2.0.1&request=ProcessCoverages&query=for c in (temp2m) return encode(avg (c[Lat(52), Long(13),ansi("2003-01-01T00:00":"2003-12-31T18:00")]) - 273.15,"csv")

With three simple queries, we retrieve the minimum, mamximum and average 2m air temperature of Berlin for the year 2003, which are -16 degC, 35.5 degC and 10.1 degC respectively.

The switch statement allows to classify the png pixel values and to apply RGB colour codes to it. Below, there are two examples how predefined RGB colour codes for 2m air temperature and total precipitation can be applied on-the-fly.

  • Colour scale for 2m air temperature on 18 June 2012 at 12 UTC in degrees Celsius

for c in (temp2m) return encode ( **switch** case -48 > c[ansi("2012-06-18T12:00")] - 273.5 return {red: 0; green: 0; blue: 128} case -44 > c[ansi("2012-06-18T12:00")] - 273.5 return {red: 0; green: 0; blue: 128} ... default return {red: 255; green: 0; blue:0},"png")

http://earthserver.ecmwf.int/rasdaman/ows?service=WCS&version=2.0.1&request=ProcessCoverages&query=for c in (temp2m) return encode (switch case -48 > c[ansi("2012-06-18T12:00")] - 273.5 return {red: 0; green: 0; blue: 128} case -44 > c[ansi("2012-06-18T12:00")] - 273.5 return {red: 0; green: 0; blue: 128} case -40 > c[ansi("2012-06-18T12:00")] - 273.5 return {red: 0; green: 0; blue: 128} case -36 > c[ansi("2012-06-18T12:00")] - 273.5 return {red: 0; green: 0; blue: 128} case -32 > c[ansi("2012-06-18T12:00")] - 273.5 return {red: 0; green: 0; blue: 128} case -28 > c[ansi("2012-06-18T12:00")] - 273.5 return {red: 0; green: 0; blue: 217} case -24 > c[ansi("2012-06-18T12:00")] - 273.5 return {red: 64; green: 0; blue: 255} case -20 > c[ansi("2012-06-18T12:00")] - 273.5 return {red: 128; green: 0; blue: 255} case -16 > c[ansi("2012-06-18T12:00")] - 273.5 return {red: 0; green: 128; blue: 255} case -12 > c[ansi("2012-06-18T12:00")] - 273.5 return {red: 0; green: 255; blue: 255} case -8 > c[ansi("2012-06-18T12:00")] - 273.5 return {red: 0; green: 255; blue: 128} case -4 > c[ansi("2012-06-18T12:00")] - 273.5 return {red: 128; green: 255; blue: 0} case -0 > c[ansi("2012-06-18T12:00")] - 273.5 return {red: 218; green: 255; blue: 0} case 4 > c[ansi("2012-06-18T12:00")] - 273.5 return {red: 255; green: 255; blue: 0} case 8 > c[ansi("2012-06-18T12:00")] - 273.5 return {red: 255; green: 245; blue: 0} case 12 > c[ansi("2012-06-18T12:00")] - 273.5 return {red: 255; green: 218; blue: 0} case 16 > c[ansi("2012-06-18T12:00")] - 273.5 return {red: 255; green: 176; blue: 0} case 20 > c[ansi("2012-06-18T12:00")] - 273.5 return {red: 255; green: 164; blue: 0} case 24 > c[ansi("2012-06-18T12:00")] - 273.5 return {red: 255; green: 79; blue: 0} case 28 > c[ansi("2012-06-18T12:00")] - 273.5 return {red: 255; green: 37; blue: 0} case 32 > c[ansi("2012-06-18T12:00")] - 273.5 return {red: 255; green: 10; blue: 0} case 36 > c[ansi("2012-06-18T12:00")] - 273.5 return {red: 255; green: 0; blue: 0} case 40 > c[ansi("2012-06-18T12:00")] - 273.5 return {red: 255; green: 0; blue: 255} case 44 > c[ansi("2012-06-18T12:00")] - 273.5 return {red: 255; green: 0; blue: 255} case 48 > c[ansi("2012-06-18T12:00")] - 273.5 return {red: 255; green: 0; blue: 255} case 52 > c[ansi("2012-06-18T12:00")] - 273.5 return {red: 255; green: 0; blue: 255} case 56 > c[ansi("2012-06-18T12:00")] - 273.5 return {red: 255; green: 0; blue: 255} default return {red: 255; green: 0; blue:0},"png")

  • Total precipitation for 18 June 2016 at 12 UTC in mm of water
    By specifying alpha parameter of the RGB colour code, one can set specific values to transparent. In the case of total precipitation, all values with less than 0.5 mm of water are set to transparent.

for c in (precipitation) return encode ( **switch** case 0.5 > c[ansi("2012-06-18T12:00")] * 1000 return {red: 255; green: 255; blue: 255; alpha: 0} case 2 > c[ansi("2012-06-18T12:00")] * 1000 return {red: 0; green: 255; blue: 255; alpha: 255} ... default return {red: 255; green: 0; blue:0; alpha: 255},"png")

http://earthserver.ecmwf.int/rasdaman/ows?service=WCS&version=2.0.1&request=ProcessCoverages&query=for c in (precipitation) return encode ( switch case 0.5 > c[ansi("2012-06-18T12:00")] * 1000 return {red: 255; green: 255; blue: 255; alpha: 0} case 2 > c[ansi("2012-06-18T12:00")] * 1000 return {red: 0; green: 255; blue: 255; alpha: 255} case 4 > c[ansi("2012-06-18T12:00")] * 1000 return {red: 0; green: 128; blue: 255; alpha: 255} case 10 > c[ansi("2012-06-18T12:00")] * 1000 return {red: 0; green: 0; blue: 255; alpha: 255} case 25 > c[ansi("2012-06-18T12:00")] * 1000 return {red: 218; green: 0; blue: 255; alpha: 255} case 50 > c[ansi("2012-06-18T12:00")] * 1000 return {red: 255; green: 0; blue: 255; alpha: 255} case 100 > c[ansi("2012-06-18T12:00")] * 1000 return {red: 255; green: 164; blue: 0; alpha: 255} case 250 > c[ansi("2012-06-18T12:00")] * 1000 return {red: 255; green: 0; blue: 0; alpha: 255} case 250 <= c[ansi("2012-06-18T12:00")] * 1000 return {red: 51; green: 51; blue: 51; alpha: 255} default return {red: 255; green: 0; blue:0; alpha: 255},"png")


The examples above shall give you an idea of what data processing and retrieval with a Web Coverage Processing Service is alike. WCPS can deal with far more complex data processing requests. For more information about the variety of data processing possible with WCPS, have a look to the two WCPS webinars available (see Ressources).

The next tutorial chapter will show you different ways to access and work with a Web Coverage (Processing) Service.


WCPS Webinar Part 1: Introduction

In [2]:
from IPython.display import YouTubeVideo
YouTubeVideo('MnPABAAQnXM', width=700, height=400)
Out[2]:

WCPS Webinar Part 2: Advanced Queries

In [3]:
YouTubeVideo('m1q2AIoQADs', width=700, height=400)
Out[3]:

© 2017 ECMWF

This software is licensed under the terms of the Apache Licence Version 2.0 which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. In applying this licence, ECMWF does not waive the privileges and immunities granted to it by virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.