The first part of this tutorial gave an introduction to the principical setup of a webservice and the need of a client (desktop- or web-based) that benefits from the web service. In principle, if a data provider (e.g. ECMWF) offers on-demand data access and processing with the help of a WC(P)S protocol, the data can be used in multiple ways:
- a scientist can integrate efficient data retrieval via WC(P)S directly into her processing routine,
We present you three different ways how to access, process and retrieve or integrate data requested from a WCS server:
In the framework of EarthServer-2, ECMWF is the Climate Science Data provider. A customized demo web-client has been developed that visualises ERA-interim reanalysis data with the help of NASA WebWorldWind, a three-dimensional virtual globe JavaScript API for web visualisations.
The custom-built web client gives currently access to three datasets (1) available at the WCS server:
The portal allows for the display of two-dimensional global datasets or a subset thereof (2).
An additional plotting functionality (3) allows the retrieval of data points in time of individual latitude / longitude point values. One plotting functionality allows for the plotting of ERA-interim time-series data and the other plotting routine uses Python's library matplotlib for plotting a hydrograp based on river-discharge forecast data.
The web client can be accessed via http://earthserver.ecmwf.int/earthserver/worldwind.
QGIS is a poplular open-source desktop-based Geographical Information System that bases on the collaboration and development of people within the geospatial data community. Based on individual plugins, QGIS can be enriched with a wide range of additional functionalities.
Per default, QGIS can be used as a WCS 1.1.1.1 compliant data server. ECMWF's WCS server is compliant to WCS 2.0 and gladly, there is a QGIS plugin that can be installed to be also compliant to WCS 2.0. Thapaliya & Misev (2014) built the QgsWcpsClient1 plugin, which allows to connect to a OGC WC(P)S server and to execute a WCPS query for direct import to QGIS. Figure below shows an example of a WCPS query executed in QGIS to retrieve sea surface temperature data from ECMWF for 31 December 2001.
A connection can be made either to ECMWF's service endpoint or to any other WCS 2.0 server. Once the connection is established, data on the server can be accessed via a WCPS query. Figure below shows (1) data from the Plymouth Marine Laboratory, the the marine science data provider of EarthServer-2 and (2) ERA-interim sea surface temperature from ECMWF.
Rather than downloading Gigabytes to Terrabytes of data, one can simply integrate data access, processing and retrieval into any processing routine.
The example below shows a simple and quick example in Python how ERA-interim 2m air temperature data can be requested from ECMWF's WCS server and directly stored python data structures, e.g a numpy-array of a python-list. This allows for further data processing or data visualisation.
# Load required libraries
%matplotlib inline
import requests
import numpy as np
import os
import matplotlib.pyplot as plt
Format of a Web Coverage Processing Service query - Example for a 2m air temperature spatial and temporal subsetting as well as a mathematical conversion, to convert Kelvin to degrees Celsius.
url_fmt = 'http://earthserver.ecmwf.int/rasdaman/ows?service=WCS&version=2.0.1' \
'&request=ProcessCoverages' \
'&query=for c in (%s) return encode(c[Lat(%s), Long(%s), ansi("%s":"%s")] - 273.15, "csv") '
Add your parameters into the customized url format.
url = url_fmt%("temp2m", 51, -1, "2000-01-01T00:00:00+00:00","2005-12-31T00:00:00+00:00")
Store the data information in a python numpy array (x) or a simple list (y) for further processing
r= requests.get(url,
proxies={'http':None}
)
r.raise_for_status()
# Store the requested data in a numpy array
x = np.array(eval(r.text.replace('{','[').replace('}',']')))
# Store the requested data in a python list
y = [float(a) for a in r.text[1:-1].split(",")]
# Example of a numerical output
x
array([ 8.46833, 8.51617, 9.34429, ..., 5.85497, 8.99085, 7.42964])
Example of a simple and quick plot of the requested time-series
plt.plot(y)
plt.show()
The next tutorial chapter will give you an overview of available data sets that can be retrieved from ECMWF's Web Coverage Service.
© 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.