This tutorial is a practical introduction into the Web Coverage Processing Service.
Examples include:
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 with service description remained unchanged:
http://earthserver.ecmwf.int/rasdaman/ows?service=WCS&version=2.0.1
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"),
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:
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
(Note: csv output is suitable for further data processing and integrating data request into processing routines in Python for example)
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.
for c in (temp2m) return encode (min ( c[Lat(52), Long(13),ansi("2003-01-01T00:00":"2003-12-31T18:00")] ) - 273.15,"csv")
for c in (temp2m) return encode (max ( c[Lat(52), Long(13),ansi("2003-01-01T00:00":"2003-12-31T18:00")] )- 273.15,"csv")
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.
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")
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")
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.
from IPython.display import YouTubeVideo
YouTubeVideo('MnPABAAQnXM', width=700, height=400)
YouTubeVideo('m1q2AIoQADs', width=700, height=400)
© 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.