Difference between revisions of "WCS Wrapper Installation LinuxOP"
m (→Get NetCDF) |
|||
Line 48: | Line 48: | ||
[http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-install/Quick-Instructions-for-Installing-NetCDF-on-Unix.html#Quick-Instructions-for-Installing-NetCDF-on-Unix here] | [http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-install/Quick-Instructions-for-Installing-NetCDF-on-Unix.html#Quick-Instructions-for-Installing-NetCDF-on-Unix here] | ||
− | WCS Wrapper uses netcdf. | + | WCS Wrapper uses netcdf.lib, which has to be on path, so run export PATH="$PATH:/path/to/netcdf" |
For example, if netcdf was installed to /usr/local/src/netcdf-3.6.2, | For example, if netcdf was installed to /usr/local/src/netcdf-3.6.2, | ||
you would run "export PATH="$PATH:/usr/local/src/netcdf-3.6.2" | you would run "export PATH="$PATH:/usr/local/src/netcdf-3.6.2" |
Revision as of 09:44, June 6, 2008
Questions and Comments should be directed to Kari Hoijarvi hoijarvi@me.wustl.edu 314-935 5772
Installation on a Linux workstation or server:
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. You can get it from python.org/download/. Build instructions for Python on Linux are included in the README file. The download is free.
Since the C and C++ object files are 32 bit, get a 32 bit python even if you have 64 bit machine.
Get Web.py framework
WCS Wrapper uses web.py framework, so get it from webpy.org/install. It comes with it's own development server, with is OK for testing and just a few users.
WCS Wrapper is tested using version 0.22
After extraction, go to main directory and type python setup.py install
Get the Python Xml package, lxml
lxml requires two packages before installation: libxslt and libxml
Datafed OWS is tested with Libxslt 1.1.22 and Libxml 2.6.30. Other versions are available from here. Both packages include a makefile and INSTALL file with instructions.
After running make install, the packages are copied to /usr/local/lib/python2.5/site-packages. This folder needs to be on the python path, so run export PYTHONPATH="$PYTHONPATH:/usr/local/lib/python2.5/site-packages".
Lxml is 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.
Get NetCDF
Get the source package here.
Quick installation instructions are available here
WCS Wrapper uses netcdf.lib, which has to be on path, so run export PATH="$PATH:/path/to/netcdf" For example, if netcdf was installed to /usr/local/src/netcdf-3.6.2, you would run "export PATH="$PATH:/usr/local/src/netcdf-3.6.2"
Get WCS Wrapper
From datafed.net/ows/datafed_ows.zip. Unzip it into your installation folder, let's use /usr/local/OWS as an example.
You will to have directories /usr/local/OWS/datafed and /usr/local/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 /usr/local/OWS is in your PYTHONPATH variable. Add it with export PATH="$PATH:/usr/local/OWS"
run "export" and check the PYTHONPATH. You should see at least "/usr/local/OWS/:/usr/local/lib/python2.5/site-packages"
Change Directory to /usr/local/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
/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 /usr/OWS/web/static/testprovider/. *&identifier=CubeA is the name of the NetCDF file. So in this example, /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 /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:
- cd /usr/local/OWS/web
- python owsadmin.py wcs_cap -v 1.1.0 -d localhost testprovider
- python owsadmin.py wcs_desc -v 1.1.0 testprovider
They will create files /usr/local/OWS/web/static/testprovider/wcs_1.1.0_capabilities.xml and /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 /usr/local/OWS folder, the zip file contains directories /usr/local/OWS/GEMAQ-v1p0, /usr/local/OWS/GEOSChem-v45 and /usr/local/OWS/web/static/HTAP/
The dataset name is HTAP. The coverages are GEMAQ-v1p0 and GEOSChem-v45.
Then you need to edit /usr/local/OWS/web/static/HTAP/HTAP_config.py and change the variable netcdf_root_folder to point the directory where chose to install (so far, /usr/local/OWS).
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 /usr/local/OWS/web/static/index.html, which will be displayed from url http://localhost:8080/
Every provider should have a index.html like /usr/local/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 /usr/local/OWS/web/owsadmin.py unix_nl "/usr/local/OWS/web/static/testprovider/index.html"
Use your html editing tool support if possible.