Difference between revisions of "WCS Wrapper Installation LinuxOP"

From Earth Science Information Partners (ESIP)
 
(48 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
[[WCS_Access_to_netCDF_Files| Back to WCS Wrapper]]   
 
[[WCS_Access_to_netCDF_Files| Back to WCS Wrapper]]   
  
Questions and Comments should be directed to Kari Hoijarvi [mailto:hoijarvi@me.wustl.edu hoijarvi@me.wustl.edu 314-935 5772]
+
[http://aq-ogc-services.sourceforge.net Project on SourceForge]
  
==Installation on a Linux workstation or server:==
+
Questions and comments should go to [http://sourceforge.net/p/aq-ogc-services/discussion/ sourceforge discussions], bug reports to [http://sourceforge.net/p/aq-ogc-services/tickets/ sourceforge tickets]. Urgent issues can be asked from Kari Hoijarvi 314-935-6099(w) or 314-843-6436(h)
  
WCS Wrapper uses several open source packages. Since we did not check the licences,
+
Last updated 2010-12-13
we're not including them to setup package, you have to get them yourself.
 
  
==Get Python==
+
== Things to Consider About Security ==
Preferably '''2.5.1''' since this system has not been tested with earlier versions. You can get it from [http://python.org/download/ 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.
+
The web.py framework and WCS service code has been written with security in mind, and there are no known security bugs. There is little code that writes on the disk, so running this service should not put your computer in danger.
  
== Get Web.py framework ==
+
To maximize the security of your computer, consider the following.
  
WCS Wrapper uses version 0.22 of the web.py framework, which is not the newest version, so get it from [http://pypi.python.org/packages/source/w/web.py/web.py-0.22.tar.gz python.org].
+
* '''Every file in every directory''' you put under OWS/web/static becomes '''readable by anybody'''. This is by design, since the whole framework is meant to publish public data. '''Do not put confidential information under OWS folder!'''
  
After extraction, go to main directory and type '''python setup.py install'''
+
* Don't run the process as root. Create a low-rights account like WCS_RUNNER and use that.  
  
 +
'''Do you want to install as public or private?'''
  
<html>
+
The place to install is usually by default:
<p>
 
<a href="http://webpy.org"><img src="http://webpy.unleashed.pl/logo/7.png" />
 
</p>
 
</html>
 
  
== Get the Python Xml package, lxml ==
+
    /usr/local
  
lxml requires two packages before installation: libxslt and libxml
+
Installing to this directory, you will make the software packages available for everyone in that computer. It will also overwrite older versions, which is usually desirable but contains risks, or overwrite newer versions, which is usually not desirable. You need root privileges to install to /usr/local
  
Datafed OWS is tested with [ftp://xmlsoft.org/libxslt/libxslt-1.1.22.tar.gz Libxslt 1.1.22] and [ftp://xmlsoft.org/libxslt/libxml2-2.6.30.tar.gz Libxml 2.6.30].  Other versions are available from [ftp://xmlsoft.org/libxslt/ here].  Both packages include a makefile and INSTALL file with instructions.
+
Anyway, overwriting anything may break some other software, so in that case it is recommended to install somewhere else and not make the package automatically public. In that case, you don't need root privileges.
  
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".
+
== Get Python 2.6.6 ==
  
Lxml is hosted at [http://codespeak.net/lxml/ codespeak.net/lxml/]. Somehow, I have had difficulties accessing it with Firefox, IE seems to work.  WCS Wrapper uses it in XML processing.
+
[[Image:Python-logo.gif]]
  
== Get NetCDF ==
+
We recommend latest '''python 2.6.6''' from [http://www.activestate.com/activepython/downloads ActiveState Python download page] or [http://downloads.activestate.com/ActivePython/releases/2.6.6.17/ActivePython-2.6.6.17-linux-x86.tar.gz ActiveState Direct Download] or you can download from [http://www.python.org/download/releases/2.6.6/ official site].
  
[http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-install Main installation page]
+
Since python is usually installed in posix-like systems, this step may be skipped. Other versions of python 2.x may work, but python 3.x won't yet.  
  
Get the source package [ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf.tar.gz here].
+
32 bit as well as 64 bit installations have been done and work as expected. This is more of an issue for 3rd party software in any case, so make sure you install the correct versions of the required packages (as far as they contain compiled code) or python might not be able to load them.
  
Quick installation instructions are available
+
Install with command
[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.lib, which has to be on path, so run export PATH="$PATH:/path/to/netcdf"
+
    # ./install.sh -I /usr/local
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 ==
+
Warning: This will overwrite your existing python. It may or may not be OK to upgrade, but hardly good to downgrade. You can install several versions of python in the same machine and then edit your environment variables to use the desired version.
  
From [http://datafed.net/ows/datafed_ows.zip datafed.net/ows/datafed_ows.zip]. Unzip
+
== Get easy_install for python ==
it into your installation folder, let's use '''/usr/local/OWS''' as an example.
 
  
You should have two directories '''/usr/local/OWS/datafed''' and '''/usr/local/OWS/web'''
+
Follow instructions at [http://pypi.python.org/pypi/setuptools#rpm-based-systems easy_install]. In this case download was [http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11-py2.6.egg#md5=bfa92100bd772d5a213eedd356d64086 setuptools-0.6c11-py2.6.egg] and the next command installed it:
  
Download [http://niceguy.wustl.edu/nc3/nc3.so The Linux nc3 package] to your datafed directory.
+
    # sh setuptools-0.6c11-py2.6.egg
  
The folder datafed contains ''datafed'' package, which contains tools for ISO 8601 time
+
== Get the Datafed WCS Wrapper ==
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 PYTHONPATH="$PYTHONPATH:/usr/local/OWS"
+
A good place to install is /usr/local/OWS but any other is OK.
  
run "export" and check the PYTHONPATH.  You should see at least "/usr/local/OWS/:/usr/local/lib/python2.5/site-packages"
+
If you have modified the default '''OWS/web/static/index.html'', make sure '''not to overwrite''' it. Keep the main copy elsewhere and copy it back.
  
Change Directory to '''/usr/local/OWS/web''' folder and type '''python ows.py'''. You have now your server running, listening port 8080.
+
Open the [http://sourceforge.net/projects/aq-ogc-services/files/ download page] in another tab.
  
You can pass the port as parameter. '''python ows.py 80''' listens the standard port 80.
+
If you are serving cubes from NetCDF files, get '''linux-ows-1.3.1.zip''' or later. This distribution contains point data support also. If you are serving only point data, you can just download '''ows-point-1.3.1.zip'''.
  
Congratulations, you have your server running. Now we need to install some data to serve.
+
    ows-point-1.3.1.zip = (linux-ows-1.3.1.zip) - (netcdf support) + (sample point provider)
  
== Creating Service from a single NetCDF file ==
+
Issue command
  
'''/OWS/web/static/testprovider/''' contains files '''CubeA_ncml.xml''', '''CubeA.py''' and '''CubeA.nc'''
+
    unzip linux-ows-1.3.1.zip
  
*'''CubeA_ncml.xml''' is a [http://www.unidata.ucar.edu/software/netcdf/ncml/v2.2/Tutorial.html NetCDF Markup Language] description of the test coverage.
+
Move the contents of the directory linux-ows-1.3.1 to '''OWS'''. You can install to other directories, this is just used as an example.
*'''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:
+
You will to have directories '''OWS/datafed''' and '''OWS/web'''
*'''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:''' [http://localhost:8080/testprovider?service=WCS&version=1.1.0&Request=GetCoverage&identifier=CubeA&BoundingBox=-180,-90,180,90,urn:ogc:def:crs:OGC:2:84&TimeSequence=2007-01-01&RangeSubset=fieldSubset:*&format=image/netcdf&store=true test query]
+
The directory datafed contains ''datafed'' package, which contains tools for ISO 8601 time
 +
parsing and some other utilities. ''Web'' is the WCS framework.
  
The wcs GetCoverage returns an Xml envelope
+
Notice:  
<html>
 
    <pre><span class="pi">&lt;?xml version="1.0" encoding="UTF-8"?&gt;</span>
 
&lt;<span class="start-tag">Coverages</span><span class="attribute-name"> xmlns</span>=<span
 
    class="attribute-value">"http://www.opengis.net/wcs/1.1/ows" </span><span class="attribute-name">
 
        xmlns:ows</span>=<span class="attribute-value">"http://www.opengis.net/ows" </span><span
 
            class="attribute-name">xmlns:xlink</span>=<span class="attribute-value">"http://www.w3.org/1999/xlink"</span>&gt;
 
    &lt;<span class="start-tag">Coverage</span>&gt;
 
        &lt;<span class="start-tag">ows:Title</span>&gt;Select * From CubeA&lt;/<span class="end-tag">ows:Title</span>&gt;
 
        &lt;<span class="start-tag">ows:Abstract</span>&gt;Where boundingbox=-180,-90,180,90,urn:ogc:def:crs:OGC:2:84 and timesequence=2007-01-01&lt;/<span class="end-tag">ows:Abstract</span>&gt;
 
        &lt;<span class="start-tag">Identifier</span>&gt;<strong>CubeA</strong>&lt;/<span class="end-tag">Identifier</span>&gt;
 
        &lt;<span class="start-tag">Reference</span><span class="attribute-name"> xlink:href</span>=<span
 
            class="attribute-value">"<strong>http://localhost:8080/static/cache/CubeA_1.nc</strong>" </span><span
 
                class="attribute-name">xlink:role</span>=<span class="attribute-value">"urn:ogc:def:role:WCS:1.1:coverage"</span><span
 
                    class="attribute-name">/</span>&gt;
 
    &lt;/<span class="end-tag">Coverage</span>&gt;
 
&lt;/<span class="end-tag">Coverages</span>&gt;
 
</pre>
 
</html>
 
  
Of all the standard supported options, '''&format=image/netcdf&store=true'''
+
Using C based libraries enables delivering large amounts of data efficiently. Python is used only for query parsing, making minimal impact in speed.  
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:'''
+
Although the built-in webserver is intended mainly for development, you can use it to serve data from your own workstation just fine. For high load sites, look [http://webpy.org/install webpy.org/install] documentation how to integrate webpy with apache server etc.
  
*Every '''folder''' under '''static''' becomes a '''provider'''. Providers are unrelated. There can be any number of providers.
+
== Get 3rd Party Components ==
*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 ==
+
=== WebPy ===
  
The metadata queries of WCS, '''GetCoverage''' and '''DescribeCoverage''' need to be precompiled.
+
* [[Image:Webpy.png]]
 +
 
 +
Install webpy 0.34 or newer.
 +
 
 +
    easy_install web.py
 +
 
 +
More detailed instructions are at [http://webpy.org/download webpy download].
 +
 
 +
=== lxml ===
 +
 
 +
* [[Image:Tagpython.png]]
 +
 
 +
Install lxml 2.2.8 or 2.3.x
 +
 
 +
 
 +
    easy_install lxml
 +
 
 +
In this case, Red Hat 4.1.1-52, the command installed 2.3.beta1
 +
 
 +
More detailed instructions are at [http://codespeak.net/lxml/installation.html lxml installation instructions].
 +
 
 +
=== NumPy ===
 +
 
 +
* [[Image:Numpy_logo.png]]
 +
 
 +
Install numpy 1.5.1 from [http://sourceforge.net/projects/numpy/files/NumPy/ Numpy Files]. Currently there is no easy_install.
 +
 
 +
Linux testing is done with 1.5.1, but if you have 1.4.1 installed, it should work. The commands issued were:
 +
 
 +
    wget http://sourceforge.net/projects/numpy/files/NumPy/1.5.1/numpy-1.5.1.tar.gz/download
 +
    tar xvf  numpy-1.5.1.tar.gz
 +
    cd numpy-1.5.1
 +
    python setup.py install
 +
 
 +
If you don't have a fortran compiler installed, for example ''gfortran'' on Debian, you will get warnings. You can ignore them, since fortran is not used.
 +
 
 +
=== PyNIO ===
 +
 
 +
[http://www.pyngl.ucar.edu/Nio.shtml PyNIO Home page]
 +
 
 +
Choose your operating system from [http://www.pyngl.ucar.edu/Download/list_pynio_binaries.shtml list of PyNIO binaries], write down the file name you want to download.
 +
 
 +
Start at [http://www.pyngl.ucar.edu/Download/ download] and follow the instructions. You need to request an account. Then you need to go to [http://www.earthsystemgrid.org/] and click on
 +
 
 +
[[Image:NCL_download.png]]
 +
 
 +
Then download '''PyNIO Version 1.4.0''', Choose '''PyNIO Version 1.4.0 precompiled binaries, OPeNDAP-enabled'''. Click on '''Download files for this collection''' and Accept license. You'll get a list of different supported systems,
 +
 
 +
This version of PyNIO is compiled with 4.1.1 which has a known bug which occurs if all of the following conditions are true:
 +
 
 +
* writing a variable of any type with more than 2**32 values
 +
* the variable must have 2 or more dimensions
 +
* the platform on which the file is written must be 32-bit
 +
* the file can be either classic format or 64-bit offset format
 +
* the values to be written must begin beyond the first 2**32 values
 +
 
 +
In this case, a file offset is computed for writing using 32-bit arithmetic for a multiply, but it should be using 64-bit arithmetic. This results in an undetected integer overflow and can overwrite data earlier in the file, without an error or warning.
 +
 
 +
This has been fixed in 4.1.2 beta 1. If you need to process very large files, you need to compile PyNIO yourself using [ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4.1.2-beta1.tar.gz netcdf-4.1.2-beta1] or later.
 +
 
 +
=== wsgilog ===
  
Run the following commands:
+
[http://pypi.python.org/pypi/wsgilog/ WsgiLog] (0.1) is optional, only if you want to log webpy output to a file.
:: 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'''
+
    easy_install wsgilog
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 [http://localhost:8080/testprovider?service=WCS&version=1.1.0&Request=GetCapabilities GetCapabilities] and [http://localhost:8080/testprovider?service=WCS&version=1.1.0&Request=DescribeCoverage&identifier=CubeA DescribeCoverage CubeA]
+
== Install and Start the OWS Server ==
  
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 [http://webpy.org/install webpy.org/install] documentation how to set up a high load site.
+
=== Install ===
  
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.
+
* Unpack to your desired working directory. These instructions assume that your working directory is ''/usr/local/'', and these instructions assume you unzipped to ''/usr/local/OWS'' directory.
 +
* Add the path of the extracted ''OWS'' directory to your ''PYTHONPATH'' environment variable.
 +
** IIf you followed the above example, ''PYTHONPATH'' should contain ''/usr/local/OWS'' to find the OWS/datafed package.
 +
* Go to ''OWS/web'' and execute ''python ows.py'' and a server should be running on http://localhost:8080/ ready to be used.
 +
** A different port can be passed to the server as an argument, ''python ows.py 8601'' is used in the test code, don't use it.
 +
** You will have to create the log directory ''/var/log/ows'' (lowercase ows!) before running the server for the first time.
 +
** If the server is not being run as root, the user that runs it needs write access to the log directory.
 +
* You can stop the server by pressing ctrl-c in the console window.
 +
* To make the server available automatically at boot time, you can use an init script, an example script that starts the OWS server in a screen session as another user is available [http://repositories.icg.kfa-juelich.de/downloads/ows.sh here].
 +
* Typescript of installation on fresh and minimal [http://debian.org Debian] stable is [http://repositories.icg.kfa-juelich.de/downloads/debian_typescript.txt here].
  
== Creating a Service from periodical NetCDF files. ==
+
=== Putting your data into CF Compatible 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.
+
''(Not required in point)'' This is for getting the demo run only.
  
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.
+
How to use the wrapper libraries can be found in related page
 +
[http://wiki.esipfed.org/index.php/Creating_NetCDF_CF_Files Creating NetCDF-CF Files].
  
'''Live Query Examples:'''
+
Setting up the demo dataset:
  
Linux Server:  
+
'''OWS/web/static/testprovider/''' contains files:
:[http://niceguy.wustl.edu:81/HTAP?service=WCS&version=1.1.0&Request=GetCapabilities GetCapabilities]
+
* [http://localhost:8080/static/testprovider/CubeA.ncml CubeA.ncml] and [http://localhost:8080/static/testprovider/CubeA.nc CubeA.nc]
:[http://niceguy.wustl.edu:81/HTAP?service=WCS&version=1.1.0&Request=DescribeCoverage&identifier=HTAP_GEMAQ-v1p0 DescribeCoverage]
+
* [http://localhost:8080/static/testprovider/CubeB.ncml CubeB.ncml] and [http://localhost:8080/static/testprovider/CubeB.nc CubeB.nc]  
:[http://niceguy.wustl.edu:81/HTAP?service=WCS&version=1.1.0&Request=GetCoverage&identifier=GEMAQ-v1p0&BoundingBox=260,32,280,48,urn:ogc:def:crs:OGC:2:84&TimeSequence=2001-01-01T12:00:00Z&RangeSubset=fieldSubset:vmr_no2&format=image/netcdf&store=true GetCoverage]
+
* [http://localhost:8080/static/testprovider/CubeB.ncml H5D.ncml] and [http://localhost:8080/static/testprovider/CubeB.nc H5D.nc]
 +
* [http://localhost:8080/static/testprovider/create_all.py create_all.py]
  
Windows Workstation:
+
* [http://localhost:8080/static/testprovider/index.html index.html]
:[http://128.252.167.125/HTAP?service=WCS&version=1.1.0&Request=GetCapabilities GetCapabilities]
+
* [http://localhost:8080/static/testprovider/wcs_capabilities.conf wcs_capabilities.conf]
:[http://128.252.167.125/HTAP?service=WCS&version=1.1.0&Request=DescribeCoverage&identifier=HTAP_GEMAQ-v1p0 DescribeCoverage]
 
:[http://128.252.167.125/HTAP?service=WCS&version=1.1.0&Request=GetCoverage&identifier=GEMAQ-v1p0&BoundingBox=260,32,280,48,urn:ogc:def:crs:OGC:2:84&TimeSequence=2001-01-01T12:00:00Z&RangeSubset=fieldSubset:vmr_no2&format=image/netcdf&store=true GetCoverage]
 
  
How to set this up on your site:
+
*'''CubeA.ncml''' is a [http://www.unidata.ucar.edu/software/netcdf/ncml/v2.2/Tutorial.html NetCDF Markup Language] description of the test coverage, same for teh rest of the .ncml files. The .nc files are files that are created from using the ncml as instructions.
 +
*'''create_all.py''' is a script that creates the empty cube files and then fills it with test data. It servers as an example code how to create your own CF 1.0 compatible files. It has no user interface, just run it.
  
Download our HTAP test package from [http://datafed.net/ows/datafed_ows_HTAP.zip" datafed.net/ows/datafed_ows_HTAP.zip]. It only has two days of data to make download small.
+
So do the following:
  
Unzip it to the '''/usr/local/OWS''' folder, the zip file contains directories
+
    cd /usr/local/OWS/web/static/testprovider
'''/usr/local/OWS/GEMAQ-v1p0''', '''/usr/local/OWS/GEOSChem-v45''' and '''/usr/local/OWS/web/static/HTAP/'''
+
    python create_all.py
  
The dataset name is '''HTAP'''. The coverages are '''GEMAQ-v1p0''' and '''GEOSChem-v45'''.
+
Now you have data to serve.
  
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).
+
=== Creating Metadata ===
  
Try this [http://localhost:8080/HTAP?service=WCS&version=1.1.0&Request=GetCoverage&identifier=GEMAQ-v1p0&BoundingBox=260,32,280,48,urn:ogc:def:crs:OGC:2:84&TimeSequence=2001-01-01T12:00:00Z&RangeSubset=fieldSubset:vmr_no2&format=image/netcdf&store=true test query].
+
The metadata queries of WCS, '''GetCoverage''' and '''DescribeCoverage''' need to be precompiled.
  
Notice that it starts with http://localhost:8080/
+
Run the following commands:
  
The server returns a short XML document, which contains a link into the query result,
+
    cd /usr/local/OWS/web
you can download it by copying the url to your browser.
+
    python owsadmin.py wcs_prepare -o testprovider
  
Test from another computer using your own IP address or domain name http://123.456.789.123:8080/
+
or to extract metadata for all the providers:
  
== index.html Pages ==
+
    python owsadmin.py wcs_prepare -ao
  
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.
+
-o is for optimize, -a prepares every provider
  
The server is at '''/usr/local/OWS/web/static/index.html''', which will be displayed from url [http://localhost:8080/ http://localhost:8080/]
+
it will create file '''/usr/local/OWS/web/static/testprovider/metadata.dat'''.
  
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 http://localhost:8080/testprovider]
+
Try now test queries [http://localhost:8080/testprovider?service=WCS&acceptversions=1.1.2&Request=GetCapabilities GetCapabilities] and [http://localhost:8080/testprovider?service=WCS&version=1.1.2&Request=DescribeCoverage&identifier=CubeA DescribeCoverage CubeA]
  
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.
+
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 [http://webpy.org/install webpy.org/install] documentation how to set up a high load site.
  
'''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:
+
== Where to go next ==
  
:: python /usr/local/OWS/web/owsadmin.py unix_nl "/usr/local/OWS/web/static/testprovider/index.html"
+
See [http://wiki.esipfed.org/index.php/WCS_Wrapper_Installation_WindowsOP#Put_your_own_data_online Windows Installation] for some platform-neutral information about installation.
  
Use your html editing tool support if possible.
+
How to create data for serving is documented at [[WCS_Wrapper_Configuration| WCS Wrapper Configuration]]

Latest revision as of 09:20, December 23, 2010

Back to WCS Wrapper

Project on SourceForge

Questions and comments should go to sourceforge discussions, bug reports to sourceforge tickets. Urgent issues can be asked from Kari Hoijarvi 314-935-6099(w) or 314-843-6436(h)

Last updated 2010-12-13

Things to Consider About Security

The web.py framework and WCS service code has been written with security in mind, and there are no known security bugs. There is little code that writes on the disk, so running this service should not put your computer in danger.

To maximize the security of your computer, consider the following.

  • Every file in every directory you put under OWS/web/static becomes readable by anybody. This is by design, since the whole framework is meant to publish public data. Do not put confidential information under OWS folder!
  • Don't run the process as root. Create a low-rights account like WCS_RUNNER and use that.

Do you want to install as public or private?

The place to install is usually by default:

   /usr/local

Installing to this directory, you will make the software packages available for everyone in that computer. It will also overwrite older versions, which is usually desirable but contains risks, or overwrite newer versions, which is usually not desirable. You need root privileges to install to /usr/local

Anyway, overwriting anything may break some other software, so in that case it is recommended to install somewhere else and not make the package automatically public. In that case, you don't need root privileges.

Get Python 2.6.6

Python-logo.gif

We recommend latest python 2.6.6 from ActiveState Python download page or ActiveState Direct Download or you can download from official site.

Since python is usually installed in posix-like systems, this step may be skipped. Other versions of python 2.x may work, but python 3.x won't yet.

32 bit as well as 64 bit installations have been done and work as expected. This is more of an issue for 3rd party software in any case, so make sure you install the correct versions of the required packages (as far as they contain compiled code) or python might not be able to load them.

Install with command

   # ./install.sh -I /usr/local

Warning: This will overwrite your existing python. It may or may not be OK to upgrade, but hardly good to downgrade. You can install several versions of python in the same machine and then edit your environment variables to use the desired version.

Get easy_install for python

Follow instructions at easy_install. In this case download was setuptools-0.6c11-py2.6.egg and the next command installed it:

   # sh setuptools-0.6c11-py2.6.egg

Get the Datafed WCS Wrapper

A good place to install is /usr/local/OWS but any other is OK.

If you have modified the default OWS/web/static/index.html, make sure not to overwrite' it. Keep the main copy elsewhere and copy it back.

Open the download page in another tab.

If you are serving cubes from NetCDF files, get linux-ows-1.3.1.zip or later. This distribution contains point data support also. If you are serving only point data, you can just download ows-point-1.3.1.zip.

   ows-point-1.3.1.zip = (linux-ows-1.3.1.zip) - (netcdf support) + (sample point provider)

Issue command

   unzip linux-ows-1.3.1.zip

Move the contents of the directory linux-ows-1.3.1 to OWS. You can install to other directories, this is just used as an example.

You will to have directories OWS/datafed and OWS/web

The directory datafed contains datafed package, which contains tools for ISO 8601 time parsing and some other utilities. Web is the WCS framework.

Notice:

Using C based libraries enables delivering large amounts of data efficiently. Python is used only for query parsing, making minimal impact in speed.

Although the built-in webserver is intended mainly for development, you can use it to serve data from your own workstation just fine. For high load sites, look webpy.org/install documentation how to integrate webpy with apache server etc.

Get 3rd Party Components

WebPy

  • Webpy.png

Install webpy 0.34 or newer.

   easy_install web.py

More detailed instructions are at webpy download.

lxml

  • Tagpython.png

Install lxml 2.2.8 or 2.3.x


   easy_install lxml

In this case, Red Hat 4.1.1-52, the command installed 2.3.beta1

More detailed instructions are at lxml installation instructions.

NumPy

  • Numpy logo.png

Install numpy 1.5.1 from Numpy Files. Currently there is no easy_install.

Linux testing is done with 1.5.1, but if you have 1.4.1 installed, it should work. The commands issued were:

   wget http://sourceforge.net/projects/numpy/files/NumPy/1.5.1/numpy-1.5.1.tar.gz/download
   tar xvf  numpy-1.5.1.tar.gz
   cd numpy-1.5.1
   python setup.py install

If you don't have a fortran compiler installed, for example gfortran on Debian, you will get warnings. You can ignore them, since fortran is not used.

PyNIO

PyNIO Home page

Choose your operating system from list of PyNIO binaries, write down the file name you want to download.

Start at download and follow the instructions. You need to request an account. Then you need to go to [1] and click on

NCL download.png

Then download PyNIO Version 1.4.0, Choose PyNIO Version 1.4.0 precompiled binaries, OPeNDAP-enabled. Click on Download files for this collection and Accept license. You'll get a list of different supported systems,

This version of PyNIO is compiled with 4.1.1 which has a known bug which occurs if all of the following conditions are true:

  • writing a variable of any type with more than 2**32 values
  • the variable must have 2 or more dimensions
  • the platform on which the file is written must be 32-bit
  • the file can be either classic format or 64-bit offset format
  • the values to be written must begin beyond the first 2**32 values

In this case, a file offset is computed for writing using 32-bit arithmetic for a multiply, but it should be using 64-bit arithmetic. This results in an undetected integer overflow and can overwrite data earlier in the file, without an error or warning.

This has been fixed in 4.1.2 beta 1. If you need to process very large files, you need to compile PyNIO yourself using netcdf-4.1.2-beta1 or later.

wsgilog

WsgiLog (0.1) is optional, only if you want to log webpy output to a file.

    easy_install wsgilog

Install and Start the OWS Server

Install

  • Unpack to your desired working directory. These instructions assume that your working directory is /usr/local/, and these instructions assume you unzipped to /usr/local/OWS directory.
  • Add the path of the extracted OWS directory to your PYTHONPATH environment variable.
    • IIf you followed the above example, PYTHONPATH should contain /usr/local/OWS to find the OWS/datafed package.
  • Go to OWS/web and execute python ows.py and a server should be running on http://localhost:8080/ ready to be used.
    • A different port can be passed to the server as an argument, python ows.py 8601 is used in the test code, don't use it.
    • You will have to create the log directory /var/log/ows (lowercase ows!) before running the server for the first time.
    • If the server is not being run as root, the user that runs it needs write access to the log directory.
  • You can stop the server by pressing ctrl-c in the console window.
  • To make the server available automatically at boot time, you can use an init script, an example script that starts the OWS server in a screen session as another user is available here.
  • Typescript of installation on fresh and minimal Debian stable is here.

Putting your data into CF Compatible NetCDF Files

(Not required in point) This is for getting the demo run only.

How to use the wrapper libraries can be found in related page Creating NetCDF-CF Files.

Setting up the demo dataset:

OWS/web/static/testprovider/ contains files:

  • CubeA.ncml is a NetCDF Markup Language description of the test coverage, same for teh rest of the .ncml files. The .nc files are files that are created from using the ncml as instructions.
  • create_all.py is a script that creates the empty cube files and then fills it with test data. It servers as an example code how to create your own CF 1.0 compatible files. It has no user interface, just run it.

So do the following:

   cd /usr/local/OWS/web/static/testprovider
   python create_all.py

Now you have data to serve.

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_prepare -o testprovider

or to extract metadata for all the providers:

   python owsadmin.py wcs_prepare -ao

-o is for optimize, -a prepares every provider

it will create file /usr/local/OWS/web/static/testprovider/metadata.dat.

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.

Where to go next

See Windows Installation for some platform-neutral information about installation.

How to create data for serving is documented at WCS Wrapper Configuration