Difference between revisions of "WCS Wrapper Installation WindowsOP"
Line 225: | Line 225: | ||
Go to control panel and open "Scheduled Tasks". | Go to control panel and open "Scheduled Tasks". | ||
− | Click on "add scheduled task." | + | * Click on "add scheduled task." |
− | pick C:\OWS\web\ows.py as the executable. | + | * pick C:\OWS\web\ows.py as the executable. |
− | Check "When my computer starts" as the scheduling" | + | * Check "When my computer starts" as the scheduling" |
− | Choose a proper user name | + | * Choose a proper user name |
+ | |||
+ | * Check box "open advanced properties..." | ||
Change the properties: | Change the properties: |
Revision as of 13:01, July 14, 2009
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:
THIS PROCEDURE PAGE IS CURRENTLY UNDER UPDATE. YOU MIGHT WANT TO CHECK BACK IN A FEW DAYS.
WCS Wrapper uses several open source packages. Since we did not check the licences, we're not including them to setup package, you have to get them yourself.
Get Python
Preferably 2.5.1 since this system has not been tested with earlier versions. I will upgrade to 2.6 as soon as I have time. You can get it from python.org/download/ but Windows users may want to use ActiveState version activestate.com/Products/activepython/ since it has for example very nice language sensitive editor PythonWin. The download is free.
Since the C and C++ dll's are 32 bit, get a 32 bit python even if you have 64 bit machine.
UPDATE:
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 PythonWin IDE.
Get 3rd Party Components
UPDATING, these are not online yet
Unzip the file.
Install lxml by running the setup program lxml-2.2.2.win32-py2.6.exe, use default answer for everything. If you don't have python 2.6, installation will fail.
Install webpy
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.
Install NetCDF
The netcdf folder has no setup program. The install_netcdf.bat simply contains instructions where to copy files.
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 Web.py framework
WCS Wrapper uses web.py framework. webpy.org/install is latest, but use 0.22 below. It comes with it's own development server, with is OK for testing and just a few users.
WCS Wrapper is tested using web.py version 0.22 GET 0.22 here. I'll upgrade to 0.3 as soon as I have time.
Web.py is delivered in unix style .tar.gz file. Under windows, I recommend 7-zip to unzip it. You have to first unzip the gnu zip '.tar.gz' to '.tar' and then unzip the .tar file into normal folder.
Go to main directory and type python setup.py install
Get the Python Xml package, lxml
It's hosted at codespeak.net/lxml/. Somehow, I have had difficulties accessing it with Firefox, IE seems to work.
WCS Wrapper uses it in XML processing. It's best to download the pre-compiled windows package from pypi.python.org/pypi/lxml/
WCS Wrapper is tested with 1.3.6. Run the EXE to install. Again, newer versions are out there, but testing them takes time. I'll do it later.
Get NetCDF
get the prebuild binaries NetCDF 3.6.1 beta 1.
You will need tools like ncdump anyway, so just get them all. WCS Wrapper uses netcdf.dll, which has to be on path.
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://capita.wustl.edu: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=fieldSubset:* selects variables to be returned from the NetCFD, '*' gets all, &RangeSubset=fieldSubset:Spam;fieldSubset: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 the default port 80, server was started python ows.py 80. Linux uses port 81, which has to be in the query url.
Live Query Examples:
Linux Server:
Windows Workstation:
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. Thi sis kind of handy, since the window will display incoming queries.
To run this in real production environment, we prefer Linux and Apache web server. Be the first one to do it! webpy.org