WCS Wrapper Installation WindowsOP

From Earth Science Information Partners (ESIP)

Back to WCS Wrapper

Questions and Comments should be directed to Kari Hoijarvi hoijarvi@seas.wustl.edu Phone 314-935-5772(w) or 314-843-6436(h)

Installation on a Windows workstation or server:

THE RUNTIME FILES ARE UPDATED, AND DOCUMENTATION IS BEING UPDATED TOO

Get Python

We recommend python 2.6.2.2 from ActiveState Python Page or ActiveState Direct Download. or you can download from python.org but activepython contains some goodies, like very nice language sensitive editor PythonWin.

The system will not work with python 2.5

Since the C and C++ dll's are 32 bit, get a 32 bit python even if you have 64 bit machine.

Get 3rd Party Components

OWS_3rdparty.zip

Unzip the file. You'll see

  • lxml-2.2.2.win32-py2.6.exe
  • install_webpy.bat
  • webpy
  • install_netcdf.bat
  • netcdf

Install lxml by running the setup program lxml-2.2.2.win32-py2.6.exe, use default answer for everything.

Install webpy webpy.org Webpy favicon.png

run batch file install_webpy.bat, it will print about two pages informational messages. There should be no warnings or errors. Hit enter to close the window.

Webpy comes with it's own development web server, with is OK for testing and works for just a few users.

Install NetCDF Unidata favicon.png

The netcdf folder has no setup program. The install_netcdf.bat simply contains instructions where to copy files, and it shows your current PATH environment variable.

The only file you absolutely need from the netcdf folder is netcdf.dll. Move it somewhere in the path. ncdump.exe is a very useful utility, that we recommend to have also. UNIDATA NetCDF docs has more information about these utilities. Main installation page may be useful too.

Get WCS Wrapper

From datafed.net/ows/datafed_ows.zip. Unzip it into your installation folder, let's use C:\OWS as an example.

You will to have directories C:\OWS\datafed and C:\OWS\web

The folder datafed contains datafed package, which contains tools for ISO 8601 time parsing and python-NetCDF bridge. Web is the WCS framework.

Make sure that C:\OWS is in your PYTHONPATH variable. Create it via Control Panel / System / Advanced / Environment Variables

Run command prompt, start / run, "cmd.exe". Type "SET PYTHONPATH". If you see PYTHONPATH=C:\OWS you're OK

Change Directory to C:\OWS\web folder and type python ows.py. You have now your server running, listening port 8080.

You can pass the port as parameter. python ows.py 80 listens the standard port 80.

Congratulations, you have your server running. Now we need to install some data to serve.

Creating Service from a single NetCDF file

C:\OWS\web\static\testprovider\ contains files CubeA_ncml.xml, CubeA.py and CubeA.nc

  • CubeA_ncml.xml is a NetCDF Markup Language description of the test coverage.
  • CubeA.py is a script that creates the empty .nc file and fills it with test data. It servers as a good example code how to create your own CF 1.0 compatible files. Run it.
  • CubeA.nc is the output of two previous, and serves as our test coverage.

Sections of the WCS url:

  • http://your_domain_or_ip_address:8080 is the server url. It returns a static index.html page of providers using this server.
  • /testprovider is the provider name. There must be a folder C:\OWS\web\static\testprovider\.
  • &identifier=CubeA is the name of the NetCDF file. So in this example, C:\OWS\web\static\testprovider\ contains file CubeA.nc and it becomes a coverage. There can be any number of NetCDF files. Coverages are all listed in the GetCoverage request.
  • RangeSubset=* selects variables to be returned from the NetCFD, '*' gets all, &RangeSubset=Spam;Eggs gets variables Spam and Eggs.

Try this: test query

The wcs GetCoverage returns an Xml envelope

<?xml version="1.0" encoding="UTF-8"?>
<Coverages xmlns="http://www.opengis.net/wcs/1.1/ows" 
        xmlns:ows="http://www.opengis.net/ows" xmlns:xlink="http://www.w3.org/1999/xlink">
    <Coverage>
        <ows:Title>Select * From CubeA</ows:Title>
        <ows:Abstract>Where boundingbox=-180,-90,180,90,urn:ogc:def:crs:OGC:2:84 and timesequence=2007-01-01</ows:Abstract>
        <Identifier>CubeA</Identifier>
        <Reference xlink:href="http://localhost:8080/static/cache/CubeA_1.nc" xlink:role="urn:ogc:def:role:WCS:1.1:coverage"/>
    </Coverage>
</Coverages>

Of all the standard supported options, &format=image/netcdf&store=true is the only supported one. The request writes out a netcdf file C:\OWS\web\static\cache\CubeA_1.nc and so it can be retrieved later with url http://localhost:8080/static/cache/CubeA_1.nc and it will be deleted in ten minutes. The number after coverage is a generated sequence number.

In short:

  • Every folder under static becomes a provider. Providers are unrelated. There can be any number of providers.
  • Every NetCDF file in the provider folder becomes a coverage. The WCS Capabilities document is automatically compiled from all the NetCDF files.
  • Every variable inside NetCDF becomes a field

Creating Metadata

The metadata queries of WCS, GetCoverage and DescribeCoverage need to be precompiled.

Run the following commands:

c:
cd \OWS\web
python owsadmin.py wcs_cap -v 1.1.0 -d my.server.com -p 8080 testprovider
python owsadmin.py wcs_desc -v 1.1.0 testprovider

Replace my.server.com with your domain name or your raw ip address like 128.34.111.47, and port -p 8080 with the port you want to use. Default is the standard -p 80, but that is not always possible, since you might have another webserver in your machine.

They will create files C:\OWS\web\static\testprovider\wcs_1.1.0_capabilities.xml and C:\OWS\web\static\testprovider\wcs_1.1.0_desc_CubeA.xml. The capabilities file contains all the coverages that this provider has, and each coverage gets its own desc file.

Try now test queries GetCapabilities and DescribeCoverage CubeA

Press ctrl+C to terminate the server. Although this server is intended for development and debugging only, you can use it to server data from your own workstation just fine. For high load sites, look webpy.org/install documentation how to set up a high load site.

Notice: WCS Wrapper core is written in C++, enabling large amount of data delivery. Python is used only for query parsing, making minimal impact in speed.

Creating a Service from periodical NetCDF files.

We are serving some HTAP ozone model data with this method. Our test servers are a Windows XP workstation and a Linux 64 bit server.

The windows version runs on port :8080, server was started python ows.py. Linux uses port 81, which has to be in the query url.

Live Query Examples:

Linux Server:

GetCapabilities
DescribeCoverage
GetCoverage

Windows Workstation:

GetCapabilities
DescribeCoverage
GetCoverage

How to set this up on your site:

Download our HTAP test package from " datafed.net/ows/datafed_ows_HTAP.zip. It only has two days of data to make download small.

Unzip it to the C:\OWS folder, the zip file contains directories C:\OWS\GEMAQ-v1p0, C:\OWS\GEOSChem-v45 and C:\OWS\web\static\HTAP\

The dataset name is HTAP. The coverages are GEMAQ-v1p0 and GEOSChem-v45.

If you used other folder than C:\OWS you need to edit C:\OWS\web\static\HTAP\HTAP_config.py and change the variable netcdf_root_folder to point the correct directory.

Try this test query.

Notice that it starts with http://localhost:8080/

The server returns a short XML document, which contains a link into the query result, you can download it by copying the url to your browser.

Test from another computer using your own IP address or domain name http://123.456.789.123:8080/

index.html Pages

If no query is present, the server gives a default page index.html. You should provide pages for your server and for all the providers.

The server is at C:\OWS\web\static\index.html, which will be displayed from url http://localhost:8080/

Every provider should have a index.html like C:\OWS\web\static\testprovider\index.html which will be displayed from http://localhost:8080/testprovider

If you modify the default index.html, make sure not to overwrite' it next time you upgrade the WCS Wrapper package. Keep the main copy elsewhere and copy it back.

Important! web.py development server requires, that text files have Unix-style end of line marker, plain LF and not the Windows convention CR-LF. The owsadmin.py script can be used to fix this:

python C:\OWS\web\owsadmin.py unix_nl "C:\OWS\web\static\testprovider\index.html"

Use your html editing tool support if possible.

Running in the background

This executable is meant to be a test server for developers. Therefore it does not support running as a service.

But you can run any command line program in the background:

Go to control panel and open "Scheduled Tasks".

  • Click on "add scheduled task."
  • pick C:\OWS\web\ows.py as the executable.
  • Check "When my computer starts" as the scheduling"
  • Choose a proper user name
  • Check box "open advanced properties..."

Change the properties:

  • The default port is 8080. On the task tab, add port number to the program C:\OWS\web\ows.py 8081
  • on settings tab, check off the "Stop the task if ..." box

You can now start the task and end it from the "Scheduled tasks" form.

Notice, that if you choose your own username, you'll see the window when you log on. This is kind of nice, since the window will display incoming queries. But you probably should create a new account for this: Control panel / Administrative Tools / Computer management / Local Users and Groups. Create a new account with plain user rights. Then add read and execute rights for this user in C:\OWS, and write access to C:\OWS\web\static\cache and C:\OWS\web\static\logs

To run this in real production environment, we prefer Linux and Apache web server. Be the first one to do it! webpy.org