Difference between revisions of "WCS Wrapper Installation WindowsOP"

From Earth Science Information Partners (ESIP)
 
(257 intermediate revisions by 2 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@seas.wustl.edu hoijarvi@seas.wustl.edu] Phone 314-935-5772(w) or 314-843-6436(h)
+
[http://aq-ogc-services.sourceforge.net Project on SourceForge]
  
==Installation on a Windows 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)
  
THIS PROCEDURE PAGE IS CURRENTLY UNDER UPDATE. YOU MIGHT WANT TO CHECK BACK IN A FEW DAYS.
+
Last updated 2010-12-13
  
WCS Wrapper uses several open source packages. Since we did not check the licences,
+
== Install as Administrator ==
we're not including them to setup package, you have to get them yourself.
 
  
==Get Python==
+
This installation requires admin rights. After installation, you can switch to a user account.
  
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 [http://python.org/download/ python.org/download/] but Windows users may want to use ActiveState version [http://activestate.com/Products/activepython/ activestate.com/Products/activepython/] since it has for example very nice language sensitive editor '''PythonWin'''. The download is free.
+
== Things to Consider About Security ==
  
Since the C and C++ dll's 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 no code that writes on the disk, so running this service should not put your computer in danger.
  
UPDATE:
+
To maximize the security of your computer, consider the following.
  
We recommend '''python 2.6.2.2''' from [http://www.activestate.com/activepython/ ActiveState Python Page] or [http://downloads.activestate.com/ActivePython/windows/2.6/ActivePython-2.6.2.2-win32-x86.msi ActiveState Direct Download.] or you can download from [http://python.org/download/releases/2.6.2/ python.org] but activepython contains some goodies, like PythonWin IDE.
+
* '''Every file in every directory''' you put under C:\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!'''
  
== Get 3rd Party Components ==
+
* Windows Vista and later: Don't run this process with administrative rights. Create a low-rights account like WCS_RUNNER and use that.
 +
 
 +
* Under Windows XP, the WCS_RUNNER account requires administrative privileges. It should not, but it seems that [http://support.microsoft.com/kb/223375 it is required]. Those who know better, please inform the author. Go to ''Control panel / Administrative Tools / Computer management / Local Users and Groups''. Add a new user, add '''administrators''' to groups and make password non-expiring, not changeable.
 +
 
 +
== Get Python 2.6.6 ==
 +
 
 +
'''Attention. Activestate download is not available, so download from official site or wait that we support python 2.7'''
 +
 
 +
We recommend latest '''python 2.6.6''' from [http://www.activestate.com/activepython/downloads ActiveState Python download pa
 +
ge] or [http://downloads.activestate.com/ActivePython/releases/2.6.6.18/ActivePython-2.6.6.18-win32-x86.msi ActiveState Direct Download] or you can download from [http://www.python.org/download/releases/2.6.6/ official site] but activepython contains some goodies, like very nice language sensitive editor '''PythonWin'''.
 +
 
 +
Since the C and C++ dll's are 32 bit, get a '''32 bit''' python even if you have 64 bit machine. If requested, we will support 64 bit binaries too.
 +
 
 +
== Get the Datafed WCS Wrapper ==
 +
 
 +
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 [http://sourceforge.net/projects/aq-ogc-services/files/ download page] in another tab.
 +
 
 +
If you are serving cubes from NetCDF files, get '''win32-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 = (win32-ows-1.3.1.zip) - (netcdf support) + (sample point provider)
 +
 
 +
Unzip it/both into your installation folder '''C:\OWS'''. You can install to other folders, this is just used 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 module '''nc3''' ''(not in point)''. ''Web'' is the WCS framework.
  
'''UPDATING, these are not online yet'''
+
Notice:
  
[http://datafed.net/ows/OWS_3rdparty.zip OWS_3rdparty.zip]
+
Linux is using '''PyNIO''' for '''NetCDF''' access from python. Since '''PyNIO''' is not supported under Windows, a subset '''datafed/minio''', was developed for windows. Using C based libraries enables delivering large amounts of data efficiently. Python is used only for query parsing, making minimal impact in speed.  
  
Unzip the file.
+
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.
  
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.
+
== Get 3rd Party Components ==
  
'''Install webpy'''
+
Download [http://sourceforge.net/projects/aq-ogc-services/files/win32-3rdparty-1.2.0.zip/download win32-3rdparty-1.2.0.zip].
  
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.
+
Unzip the file. You'll see
  
'''Install NetCDF'''
+
* runtime
 +
* web.py-0.33
 +
* activepython.txt
 +
* install_webpy.bat
 +
* lxml-2.2.4.win32-py2.6.exe
 +
* numpy-1.4.1-win32-superpack-python2.6.exe
 +
* OWS version 1.3.x
  
The netcdf folder has no setup program. The install_netcdf.bat simply contains instructions where to copy files.
+
Installing: all the files are in the 3rd party bundle, you don't need to go to web during installation.
  
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. [http://www.unidata.ucar.edu/software/netcdf/docs/index.html UNIDATA NetCDF docs] has more information about these utilities. [http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-install Main installation page] may be useful too.
+
* OWS version 1.3.x is just marking the version of this distribution.
  
== Get Web.py framework ==
+
* Copy all the files from '''runtime''' to C:\OWS\datafed. The NetCDF is not an unofficial build, so do not replace your old NetCDF dll's with it. ''(Not required in point)''
  
WCS Wrapper uses web.py framework. [http://webpy.org/install webpy.org/install is latest, but use 0.22 below].
+
* activepython.txt is already done.
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''' [http://webpy.org/static/web.py-0.22.tar.gz GET 0.22 here]. I'll upgrade to 0.3 as soon as I have time.
+
* Install webpy [[Image:webpy_favicon.png]] Run batch file '''install_webpy.bat''', it will print about two pages informational messages. There should be no warnings or errors. [http://webpy.org webpy home]  
  
Web.py is delivered in unix style .tar.gz file. Under windows, I recommend [http://www.7-zip.org/ 7-zip] to unzip it. You have to first unzip the gnu zip '.tar.gz' to '.tar' and then unzip
+
* Install lxml by running the setup program '''lxml-2.2.4.win32-py2.6.exe''', use default answer for everything. The lxml package is already in version 2.2.6, but the windows builds are not ready. [http://codespeak.net/lxml/ lxml home] [http://pypi.python.org/pypi/lxml/2.2.4 download page] [http://pypi.python.org/packages/2.6/l/lxml/lxml-2.2.4.win32-py2.6.exe#md5=d58763332ea0043b2e145e15a7b878fb direct download link]
the .tar file into normal folder.
 
  
Go to main directory and type '''python setup.py install'''
+
* Install numpy 1.4.1 by running numpy-1.4.1-win32-superpack-python2.6.exe. Numpy is a great library for array manipulation. [http://numpy.scipy.org/ numpy home] [http://sourceforge.net/projects/numpy/files/ sourceforge download page] [https://sourceforge.net/projects/numpy/files/NumPy/1.4.1/numpy-1.4.1-win32-superpack-python2.6.exe/download direct download link] ''(Not required in point)''
  
<html>
 
<p>
 
<a href="http://webpy.org"><img src="http://webpy.unleashed.pl/logo/7.png" />
 
</p>
 
</html>
 
  
== Get the Python Xml package, lxml ==
 
  
It's hosted at [http://codespeak.net/lxml/ codespeak.net/lxml/]. Somehow, I have had difficulties accessing it with Firefox, IE seems to work.
+
'''Disclaimer''':  ''(Not required in point)'' The C:\OWS\datafed\netcdf.dll is a custom compiled from [[Image:Unidata_favicon.png]] [ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4.1.2-beta1.tar.gz netcdf-4.1.2-beta1] and all the documented library calls are not be present. The bundled ncgen.exe and ncdump.exe are compiled for this purpose, nctest.exe is not there. It's heavily unit tested under datafed OWS framework, for other purposes use with caution.
  
WCS Wrapper uses it in XML processing. It's best to download the pre-compiled windows package from [http://pypi.python.org/pypi/lxml/ pypi.python.org/pypi/lxml/]
 
  
WCS Wrapper is tested with 1.3.6. Run the [http://pypi.python.org/packages/2.5/l/lxml/lxml-1.3.6.win32-py2.5.exe#md5=c71d386d46237dbe951ed42b8d99157e EXE] to install. Again, newer versions are out there, but testing them takes time. I'll do it later.
+
The datafed folder also contains utilities '''ncdump.exe''' and '''ncgen.exe''' Especially ncdump is very useful when creating or inspecting netcdf files. The page [http://www.unidata.ucar.edu/software/netcdf/docs/index.html UNIDATA NetCDF docs] has more information about these utilities. [http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-install Main installation page] may be useful too.
  
== Get NetCDF ==
+
== Configure Firewall PYTHONPATH  ==
  
[http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-install Main installation page]
+
Since your computer is probably running a firewall, and if it isn't it should, it's necessary to allow python to act as a server for incoming connections. For Windows firewall on XP:
  
get the [http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-install/Getting-Prebuilt-DLL.html#Getting-Prebuilt-DLL prebuild binaries NetCDF 3.6.1 beta 1].
+
* Open Control panel/Windows Firewall
 +
* Exceptions tab
 +
* Add Program...
 +
* "Python Interactive Shell" or browse for C:\python26\python.exe
 +
* Hit OK
  
You will need tools like ncdump anyway, so just get them all. WCS Wrapper uses netcdf.dll,
+
Make sure that '''C:\OWS''' and '''C:\OWS\web''' are in your '''PYTHONPATH''' variable. Create it via Control Panel
which has to be on path.
+
/ System / Advanced / Environment Variables. Pythonpath looks just like PATH.
  
== Get WCS Wrapper ==
+
Run command prompt, start / run, "cmd.exe". Type "SET PYTHONPATH". If you see '''PYTHONPATH=C:\OWS;C:\OWS\web''' you're OK.
  
From [http://datafed.net/ows/datafed_ows.zip datafed.net/ows/datafed_ows.zip]. Unzip
+
== Start the Server ==
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'''
+
To see your IP address, type
  
The folder datafed contains ''datafed'' package, which contains tools for ISO 8601 time
+
    C:\OWS\web>ipconfig
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
+
    Windows IP Configuration
/ System / Advanced / Environment Variables
+
    Ethernet adapter Local Area Connection:
 +
        Connection-specific DNS Suffix  . : gateway.2wire.net
 +
        IP Address. . . . . . . . . . . . : 192.168.1.65
 +
        Subnet Mask . . . . . . . . . . . : 255.255.255.0
 +
        Default Gateway . . . . . . . . . : 192.168.1.254
  
Run command prompt, start / run, "cmd.exe". Type "SET PYTHONPATH". If you see '''PYTHONPATH=C:\OWS''' you're OK
+
Your public IP address is 192.168.1.65
  
 
Change Directory to '''C:\OWS\web''' folder and type '''python ows.py'''. You have now your server running, listening port 8080.
 
Change Directory to '''C:\OWS\web''' folder and type '''python ows.py'''. You have now your server running, listening port 8080.
Line 94: Line 124:
 
You can pass the port as parameter. '''python ows.py 80''' listens the standard port 80.
 
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.
+
Open [http://localhost:8080 http://localhost:8080] and you should see the home page. Congratulations if you got this far. Now we need to install some data to serve. replace localhost with your IP address.
 +
 
 +
If the server won't start, try to set the path explicit  ''(Not required in point)'':
 +
 
 +
    set path=C:\OWS\datafed;%PATH%
 +
 
 +
to make sure, that correct versions of NetCDF and HDF dynamic link libraries are used.
 +
 
 +
== Putting your data into CF Compatible NetCDF Files ==
 +
 
 +
''(Not required in point)'' This is for getting the demo run only, more detailed instructions on how to serve '''cube''' and '''point''' data is documented at [[WCS_Wrapper_Configuration| WCS Wrapper Configuration]]
 +
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].
 +
 
 +
Setting up the demo dataset:
 +
 
 +
'''C:\OWS\web\static\testprovider\''' contains files:
 +
* [http://localhost:8080/static/testprovider/CubeA.ncml CubeA.ncml] and [http://localhost:8080/static/testprovider/CubeA.nc CubeA.nc]
 +
* [http://localhost:8080/static/testprovider/CubeB.ncml CubeB.ncml] and [http://localhost:8080/static/testprovider/CubeB.nc CubeB.nc]
 +
* [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]
  
== Creating Service from a single NetCDF file ==
+
* [http://localhost:8080/static/testprovider/index.html index.html]
 +
* [http://localhost:8080/static/testprovider/wcs_capabilities.conf wcs_capabilities.conf]
  
'''C:\OWS\web\static\testprovider\''' contains files '''CubeA_ncml.xml''', '''CubeA.py''' and '''CubeA.nc'''
+
*'''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.
  
*'''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.
+
So do the following:
*'''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.
+
    cd C:\OWS\web\static\testprovider
 +
    create_all
 +
 
 +
activepython registers python.exe as default program for .py files, so you don't need to say ''python CubeA.py''
 +
 
 +
Now you have data to serve.
 +
 
 +
== Extract metadata from the NetCDF Files ==
 +
 
 +
Change directory to  and issue command
 +
 
 +
    cd C:\OWS\web
 +
    owsadmin wcs_prepare -ao
 +
 
 +
This program extracts the metadata from the netcdf files. Each provider will get a 'metadata.dat' giving fast access to coverages, fields and dimensionality.
 +
 
 +
The WCS Service is now ready.
 +
 
 +
== Test Your WCS server ==
 +
 
 +
GetCapabilities query for NetCDF: http://localhost:8080/testprovider?service=WCS&acceptversions=1.1.2&Request=GetCapabilities
 +
or from the [http://128.252.202.19:8080/testprovider?service=WCS&version=1.1.2&Request=GetCapabilities external server]
 +
 
 +
GetCapabilities query for point: http://localhost:8080/point?service=WCS&acceptversions=1.1.2&Request=GetCapabilities
 +
or from the [http://128.252.202.19:8080/point?service=WCS&version=1.1.2&Request=GetCapabilities external server]
 +
 
 +
 
 +
DescribeCoverage query for NetCDF: http://localhost:8080/testprovider?service=WCS&version=1.1.2&Request=DescribeCoverage&identifiers=CubeA or from the [http://128.252.202.19:8080/testprovider?service=WCS&version=1.1.0&Request=DescribeCoverage&identifiers=CubeA external server]
 +
 
 +
DescribeCoverage query for point: http://localhost:8080/point?service=WCS&version=1.1.2&Request=DescribeCoverage&identifiers=SURF_MET or from the [http://128.252.202.19:8080/point?service=WCS&version=1.1.0&Request=DescribeCoverage&identifiers=SURF_MET external server]
 +
 
 +
 
 +
GetCoverage query for NetCDF: http://localhost:8080/testprovider?service=WCS&version=1.1.2&Request=GetCoverage&identifier=CubeA&BoundingBox=-180,-90,180,90,urn:ogc:def:crs:OGC:2:84&TimeSequence=2007-01-01&RangeSubset=*&format=image/netcdf&store=true or from the [http://128.252.202.19:8080/testprovider?service=WCS&version=1.1.2&Request=GetCoverage&identifier=CubeA&BoundingBox=-180,-90,180,90,urn:ogc:def:crs:OGC:2:84&TimeSequence=2007-01-01&RangeSubset=*&format=image/netcdf&store=true external server]
 +
 
 +
GetCoverage query for point http://localhost:8080/point?service=WCS&request=getCoverage&version=1.1.2&identifier=SURF_MET&BoundingBox=-130,24,-50,40,urn:ogc:def:crs:OGC:2:84&TimeSequence=2009-09-01T15:00:00&RangeSubset=TEMP&format=text/csv&store=true
 +
[http://128.252.202.19:8080/point?service=WCS&request=getCoverage&version=1.1.2&identifier=SURF_MET&BoundingBox=-130,24,-50,40,urn:ogc:def:crs:OGC:2:84&TimeSequence=2009-09-01T15:00:00&RangeSubset=TEMP&format=text/csv&store=true external server]
  
 
Sections of the WCS url:
 
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.
+
*'''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\'''.  
+
*'''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.
+
* for NetCDF:
*RangeSubset='''fieldSubset:*''' selects variables to be returned from the NetCFD, '*' gets all, &RangeSubset='''fieldSubset:Spam;fieldSubset:Eggs''' gets variables '''Spam''' and '''Eggs'''
+
**'''&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.
 
+
**RangeSubset='''*''' selects variables to be returned from the NetCFD, '*' gets all, &RangeSubset='''Spam;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]
+
**'''&format=image/netcdf&store=true''' specifies, that the result will be a NetCDF file that is stored in the server and can later be fetched via from an url. These are now the only supported options.
 +
* for point:
 +
** Coverage is often a database and RangeSubset selects a value column. This is not necessarily so, since configuring SQL is much more flexible than configuring NetCDF
  
 
The wcs GetCoverage returns an Xml envelope
 
The wcs GetCoverage returns an Xml envelope
Line 116: Line 205:
 
     <pre><span class="pi">&lt;?xml version="1.0" encoding="UTF-8"?&gt;</span>
 
     <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
 
&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">
+
     class="attribute-value">"http://www.opengis.net/wcs/1.1" </span><span class="attribute-name">
         xmlns:ows</span>=<span class="attribute-value">"http://www.opengis.net/ows" </span><span
+
         xmlns:ows11</span>=<span class="attribute-value">"http://www.opengis.net/ows/1.1" </span><span
 
             class="attribute-name">xmlns:xlink</span>=<span class="attribute-value">"http://www.w3.org/1999/xlink"</span>&gt;
 
             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">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">ows11:Title</span>&gt;Select * From CubeA&lt;/<span class="end-tag">ows11: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">ows11: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">ows11: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">ows11:Identifier</span>&gt;<strong>CubeA</strong>&lt;/<span class="end-tag">ows11:Identifier</span>&gt;
         &lt;<span class="start-tag">Reference</span><span class="attribute-name"> xlink:href</span>=<span
+
         &lt;<span class="start-tag">ows11: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-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">xlink:role</span>=<span class="attribute-value">"urn:ogc:def:role:WCS:1.1:coverage"</span><span
Line 132: Line 221:
 
</html>
 
</html>
  
Of all the standard supported options, '''&format=image/netcdf&store=true'''
+
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'''
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.
 
and it will be deleted in ten minutes. The number after coverage is a generated sequence number.
  
Line 142: Line 230:
 
*Every '''variable''' inside '''NetCDF''' becomes a '''field'''
 
*Every '''variable''' inside '''NetCDF''' becomes a '''field'''
  
== Creating Metadata ==
+
== GetCoverage query with '''store=false''' ==
  
The metadata queries of WCS, '''GetCoverage''' and '''DescribeCoverage''' need to be precompiled.
+
for NetCDF: http://128.252.202.19:8080/testprovider?service=WCS&version=1.1.2&Request=GetCoverage&identifier=CubeA&BoundingBox=-180,-90,180,90,urn:ogc:def:crs:OGC:2:84&TimeSequence=2007-01-01&RangeSubset=*&format=image/netcdf&store=false
  
Run the following commands:
+
for point http://128.252.202.19:8080/point?service=WCS&request=getCoverage&version=1.1.2&identifier=SURF_MET&BoundingBox=-130,24,-50,40,urn:ogc:def:crs:OGC:2:84&TimeSequence=2009-09-01T15:00:00&RangeSubset=TEMP&format=text/csv&store=false
:: 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.
+
These queries return both the xml envelope and cube file bundled together in mime-multipart format.  
  
They will create files '''C:\OWS\web\static\testprovider\wcs_1.1.0_capabilities.xml'''
+
'''All the browsers don't work with this. Firefox can open it, Internet Explorer can't.'''
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 [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]
+
== Stopping the 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.
+
Press ctrl+C to terminate the server, or if you are running as a scheduled task, end the task. This is a development web server, there is no shutdown command.
  
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.
+
== Running in the background ==
  
== Creating a Service from periodical NetCDF files. ==
+
This executable is meant to be a test server for developers. Therefore it does not support running as a service. Leaving your workstation on all the time is possible, but then you will have the server window open all the time, which maybe is nice for monitoring, but usually quite annoying.
  
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.
+
But you can run any command line program in the background.
  
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.
+
Go to control panel and open "Scheduled Tasks".  
  
'''Live Query Examples:'''
+
* Click on "add scheduled task."
  
Linux Server:  
+
* Pick C:\OWS\web\ows.py as the executable.
:[http://niceguy.wustl.edu:81/HTAP?service=WCS&version=1.1.0&Request=GetCapabilities GetCapabilities]
 
:[http://niceguy.wustl.edu:81/HTAP?service=WCS&version=1.1.0&Request=DescribeCoverage&identifier=HTAP_GEMAQ-v1p0 DescribeCoverage]
 
:[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]
 
  
Windows Workstation:
+
* Check "When my computer starts" as the scheduling"
:[http://128.252.167.125/HTAP?service=WCS&version=1.1.0&Request=GetCapabilities GetCapabilities]
 
:[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:
+
* Choose a proper user name. With Windows XP and earlier the user needs to be an Administrator.
  
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.
+
* Check box "open advanced properties..."
  
Unzip it to the '''C:\OWS''' folder, the zip file contains directories
+
Change the properties:
'''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'''.
+
* The default port is 8080. On the task tab, add port number to the program C:\OWS\web\ows.py 8081
  
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.
+
* On settings tab, check off the "Stop the task if ..." box
  
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].
+
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.
 +
 
 +
* [https://sites.google.com/site/geosspilot2/air-quality-and-health-working-group/aq-use-case-2-deploy-component--service/install-datafed-netcdf-ogc-wcs Implementation of netCDF Server at Northrop Grumman]
  
Notice that it starts with http://localhost:8080/
+
== Put your own data online ==
  
The server returns a short XML document, which contains a link into the query result,
+
* [[WCS_Wrapper_Configuration| WCS Wrapper Configuration]]: Common information about the server
you can download it by copying the url to your browser.
+
* [[WCS_Wrapper_Configuration_for_Point_Data]]: How to serve SQL-based point data.
 +
* [[WCS_Wrapper_Configuration_for_Cubes]]: How to serve NetCDF-CF based cube data.
  
Test from another computer using your own IP address or domain name http://123.456.789.123:8080/
+
== Running high traffic sites with IIS ==
  
== index.html Pages ==
+
These instructions are based on [http://webpy.org/cookbook/iis7_iis6_windows_pyisapie Deploying web.py on IIS7 via PyISAPIe]
  
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.
+
=== Hack around a bug ===
  
The server is at '''C:\OWS\web\static\index.html''', which will be displayed from url [http://localhost:8080/ http://localhost:8080/]
+
Unfortunately webpy has a slight problem. You need to edit C:\Python26\Lib\site-packages\web\wsgi.py and add '''return False'''
 +
to '''_is_dev_mode''' function. Make it look exactly like
  
Every provider should have a index.html like  '''C:\OWS\web\static\testprovider\index.html''' which will be displayed from [http://localhost:8080/testprovider http://localhost:8080/testprovider]
+
    def _is_dev_mode():
 +
        return False
  
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.
+
With 4 space indentation as in the source code and case sensitive '''False'''
  
'''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:
+
=== Create New Application Pool ===
  
:: python C:\OWS\web\owsadmin.py unix_nl "C:\OWS\web\static\testprovider\index.html"
+
Go to IIS management console, and create a new Application pool.
 +
 
 +
* In 64 bit machines allow 32 bit applications.
 +
* Disable rapid-fail protection.
 +
* In IIS7
 +
** Disable managed code, no .NET version
 +
** Classic pipeline
 +
** Create a new local user like OWS_RUNNER, and assign the applicationpool to run under that username. Do not make it power user or administrator, just a user is enough.
 +
Give the user read/execute permissions under C:\OWS and additional write permissions under C:\OWS\web\static
 +
 
 +
=== Create OWS Website ===
 +
 
 +
* New website, name it OWS
 +
* port 8080 or something unique, anyway not the standard 80, which will interfere with existing stuff.
 +
* Site path something like C:\OWS\web so that ''static'' folder is directly under it.
 +
* Permissions: Read, Run Scripts, Execute
 +
* If the installation is to another directory than C:\OWS, edit the OWS\web\web.config file, change the PyISAPIe.dll path to yours.
 +
* If a provider starts with /S, add it to the OWS\web\web.config file. Providers with other letters are configured automatically with wildcards.
 +
* Edit OWS\web\config.py and change '''log_webpy_to_file = True''' for enabling logging via IIS
 +
 
 +
== Significant changes since version 1.2 ==
 +
 
 +
* Unix and Windows code base have been unified.
 +
 
 +
* filtering by any dimension works now. You can choose pressure or wavelength.
 +
 
 +
* Performance for querying large cubes as improved.
 +
 
 +
* Query Caching was implemented: Identical queries will return the same temporary file.
 +
 
 +
== Significant changes since version 1.1 ==
  
Use your html editing tool support if possible.
+
* Tested with activestate python 2.6.5.14 and 2.6.5.15, Earlier versions of python 2.6 may work.
  
== Running in the background ==
+
* Unix and Windows style newlines bug is still present.
  
This executable is meant to be a test server for developers. Therefore it does not support running as a service.
+
* Bug fixes to xml documents
  
But you can run any command line program in the background:
+
* added optional wcs_capabilities.conf files for wcs metadata.
  
Go to control panel and open "Scheduled Tasks".  
+
Finally we have xml schemas that actually work. 1.1.1 and 1.1.2 documents can be validated properly. This also exposed a huge number of wrong names ans namespaces in the capabilities and describecoverage documents. If you have code that used to read 1.1.0 xml, it needs to be updated.
  
Click on "add scheduled task."
+
== Significant changes since version 1.0 ==
  
pick C:\OWS\web\ows.py as the executable.
+
* Python version
  
Check "When my computer starts" as the scheduling"
+
python 2.5 will not work for you, use 2.6
  
Choose a proper user name
+
* Unix and Windows style newlines.
  
Change the properties:
+
With python 2.5, webpy development server required, that text files have Unix-style end of line marker, plain '''LF''' and not the Windows convention '''CR-LF'''. This was a bug deep in python libraries, and is fixed in 2.6.
  
* The default port is 8080. On the task tab, add port number to the program C:\OWS\web\ows.py 8081
+
The owsadmin.py script still supports turning files to unix and windows convention.
  
* on settings tab, check off the "Stop the task if ..." box
+
:: python C:\OWS\web\owsadmin.py unix_nl "C:\OWS\web\static\testprovider\index.html"
  
You can now start the task and end it from the "Scheduled tasks" form.
+
* errorneous "fieldsubset:" prefix
  
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.
+
The WCS query used to have fieldsubset: prefix, this was incorrect and is fixed. It also means, that old queries that used fieldsubsets won't work anymore. Update your links.
  
To run this in real production environment, we prefer Linux and Apache web server. Be the first one to do it! [http://webpy.org/ webpy.org]
+
* Bug fixes to queries
  
 +
Some filters returned incorrect results. One good reason to upgrade.
  
* [https://sites.google.com/site/geosspilot2/air-quality-and-health-working-group/aq-use-case-2-deploy-component--service/install-datafed-netcdf-ogc-wcs Implementation of netCDF Server at Northrop Grumman]
+
== Moved from WCS Server for CF (GEO-AQ-CoP==
 +
* These two services are in the same computer: htap.icg.kfa-juelich.de. The two completely different services are created just putting the netcdf files to folders HTAP_FC_pressure and MACC_bnds. They are just ordinary folders: the folder name is used as service name. http://geo-aq-cop.org/node/1316/
 +
* The HTAP_FC_pressure GetCapabilities contains plenty of coverages. For example GISS-PUCCINI-modelEaer_FC3SA_metm comes simply from the file GISS-PUCCINI-modelEaer_FC3SA_metm.nc which is in the HTAP_FC_pressure folder. One of the data variables is cnvflxup(time,lev,lat,lon) and that becomes automatically a field.

Latest revision as of 11:29, October 12, 2012

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

Install as Administrator

This installation requires admin rights. After installation, you can switch to a user account.

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 no 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 C:\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!
  • Windows Vista and later: Don't run this process with administrative rights. Create a low-rights account like WCS_RUNNER and use that.
  • Under Windows XP, the WCS_RUNNER account requires administrative privileges. It should not, but it seems that it is required. Those who know better, please inform the author. Go to Control panel / Administrative Tools / Computer management / Local Users and Groups. Add a new user, add administrators to groups and make password non-expiring, not changeable.

Get Python 2.6.6

Attention. Activestate download is not available, so download from official site or wait that we support python 2.7

We recommend latest python 2.6.6 from [http://www.activestate.com/activepython/downloads ActiveState Python download pa ge] or ActiveState Direct Download or you can download from official site but activepython contains some goodies, like very nice language sensitive editor PythonWin.

Since the C and C++ dll's are 32 bit, get a 32 bit python even if you have 64 bit machine. If requested, we will support 64 bit binaries too.

Get the Datafed WCS Wrapper

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 win32-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 = (win32-ows-1.3.1.zip) - (netcdf support) + (sample point provider)

Unzip it/both into your installation folder C:\OWS. You can install to other folders, this is just used 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 module nc3 (not in point). Web is the WCS framework.

Notice:

Linux is using PyNIO for NetCDF access from python. Since PyNIO is not supported under Windows, a subset datafed/minio, was developed for windows. 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

Download win32-3rdparty-1.2.0.zip.

Unzip the file. You'll see

  • runtime
  • web.py-0.33
  • activepython.txt
  • install_webpy.bat
  • lxml-2.2.4.win32-py2.6.exe
  • numpy-1.4.1-win32-superpack-python2.6.exe
  • OWS version 1.3.x

Installing: all the files are in the 3rd party bundle, you don't need to go to web during installation.

  • OWS version 1.3.x is just marking the version of this distribution.
  • Copy all the files from runtime to C:\OWS\datafed. The NetCDF is not an unofficial build, so do not replace your old NetCDF dll's with it. (Not required in point)
  • activepython.txt is already done.
  • Install webpy Webpy favicon.png Run batch file install_webpy.bat, it will print about two pages informational messages. There should be no warnings or errors. webpy home
  • Install lxml by running the setup program lxml-2.2.4.win32-py2.6.exe, use default answer for everything. The lxml package is already in version 2.2.6, but the windows builds are not ready. lxml home download page direct download link


Disclaimer: (Not required in point) The C:\OWS\datafed\netcdf.dll is a custom compiled from Unidata favicon.png netcdf-4.1.2-beta1 and all the documented library calls are not be present. The bundled ncgen.exe and ncdump.exe are compiled for this purpose, nctest.exe is not there. It's heavily unit tested under datafed OWS framework, for other purposes use with caution.


The datafed folder also contains utilities ncdump.exe and ncgen.exe Especially ncdump is very useful when creating or inspecting netcdf files. The page UNIDATA NetCDF docs has more information about these utilities. Main installation page may be useful too.

Configure Firewall PYTHONPATH

Since your computer is probably running a firewall, and if it isn't it should, it's necessary to allow python to act as a server for incoming connections. For Windows firewall on XP:

  • Open Control panel/Windows Firewall
  • Exceptions tab
  • Add Program...
  • "Python Interactive Shell" or browse for C:\python26\python.exe
  • Hit OK

Make sure that C:\OWS and C:\OWS\web are in your PYTHONPATH variable. Create it via Control Panel / System / Advanced / Environment Variables. Pythonpath looks just like PATH.

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

Start the Server

To see your IP address, type

   C:\OWS\web>ipconfig
   Windows IP Configuration
   Ethernet adapter Local Area Connection:
       Connection-specific DNS Suffix  . : gateway.2wire.net
       IP Address. . . . . . . . . . . . : 192.168.1.65
       Subnet Mask . . . . . . . . . . . : 255.255.255.0
       Default Gateway . . . . . . . . . : 192.168.1.254

Your public IP address is 192.168.1.65

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.

Open http://localhost:8080 and you should see the home page. Congratulations if you got this far. Now we need to install some data to serve. replace localhost with your IP address.

If the server won't start, try to set the path explicit (Not required in point):

   set path=C:\OWS\datafed;%PATH%

to make sure, that correct versions of NetCDF and HDF dynamic link libraries are used.

Putting your data into CF Compatible NetCDF Files

(Not required in point) This is for getting the demo run only, more detailed instructions on how to serve cube and point data is documented at WCS Wrapper Configuration How to use the wrapper libraries can be found in related page Creating NetCDF-CF Files.

Setting up the demo dataset:

C:\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 C:\OWS\web\static\testprovider
   create_all

activepython registers python.exe as default program for .py files, so you don't need to say python CubeA.py

Now you have data to serve.

Extract metadata from the NetCDF Files

Change directory to and issue command

   cd C:\OWS\web
   owsadmin wcs_prepare -ao

This program extracts the metadata from the netcdf files. Each provider will get a 'metadata.dat' giving fast access to coverages, fields and dimensionality.

The WCS Service is now ready.

Test Your WCS server

GetCapabilities query for NetCDF: http://localhost:8080/testprovider?service=WCS&acceptversions=1.1.2&Request=GetCapabilities or from the external server

GetCapabilities query for point: http://localhost:8080/point?service=WCS&acceptversions=1.1.2&Request=GetCapabilities or from the external server


DescribeCoverage query for NetCDF: http://localhost:8080/testprovider?service=WCS&version=1.1.2&Request=DescribeCoverage&identifiers=CubeA or from the external server

DescribeCoverage query for point: http://localhost:8080/point?service=WCS&version=1.1.2&Request=DescribeCoverage&identifiers=SURF_MET or from the external server


GetCoverage query for NetCDF: http://localhost:8080/testprovider?service=WCS&version=1.1.2&Request=GetCoverage&identifier=CubeA&BoundingBox=-180,-90,180,90,urn:ogc:def:crs:OGC:2:84&TimeSequence=2007-01-01&RangeSubset=*&format=image/netcdf&store=true or from the external server

GetCoverage query for point http://localhost:8080/point?service=WCS&request=getCoverage&version=1.1.2&identifier=SURF_MET&BoundingBox=-130,24,-50,40,urn:ogc:def:crs:OGC:2:84&TimeSequence=2009-09-01T15:00:00&RangeSubset=TEMP&format=text/csv&store=true external server

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\.
  • for NetCDF:
    • &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.
    • RangeSubset=* selects variables to be returned from the NetCFD, '*' gets all, &RangeSubset=Spam;Eggs gets variables Spam and Eggs.
    • &format=image/netcdf&store=true specifies, that the result will be a NetCDF file that is stored in the server and can later be fetched via from an url. These are now the only supported options.
  • for point:
    • Coverage is often a database and RangeSubset selects a value column. This is not necessarily so, since configuring SQL is much more flexible than configuring NetCDF

The wcs GetCoverage returns an Xml envelope

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

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

GetCoverage query with store=false

for NetCDF: http://128.252.202.19:8080/testprovider?service=WCS&version=1.1.2&Request=GetCoverage&identifier=CubeA&BoundingBox=-180,-90,180,90,urn:ogc:def:crs:OGC:2:84&TimeSequence=2007-01-01&RangeSubset=*&format=image/netcdf&store=false

for point http://128.252.202.19:8080/point?service=WCS&request=getCoverage&version=1.1.2&identifier=SURF_MET&BoundingBox=-130,24,-50,40,urn:ogc:def:crs:OGC:2:84&TimeSequence=2009-09-01T15:00:00&RangeSubset=TEMP&format=text/csv&store=false

These queries return both the xml envelope and cube file bundled together in mime-multipart format.

All the browsers don't work with this. Firefox can open it, Internet Explorer can't.

Stopping the Server

Press ctrl+C to terminate the server, or if you are running as a scheduled task, end the task. This is a development web server, there is no shutdown command.

Running in the background

This executable is meant to be a test server for developers. Therefore it does not support running as a service. Leaving your workstation on all the time is possible, but then you will have the server window open all the time, which maybe is nice for monitoring, but usually quite annoying.

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. With Windows XP and earlier the user needs to be an Administrator.
  • 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.

Put your own data online

Running high traffic sites with IIS

These instructions are based on Deploying web.py on IIS7 via PyISAPIe

Hack around a bug

Unfortunately webpy has a slight problem. You need to edit C:\Python26\Lib\site-packages\web\wsgi.py and add return False to _is_dev_mode function. Make it look exactly like

   def _is_dev_mode():
       return False

With 4 space indentation as in the source code and case sensitive False

Create New Application Pool

Go to IIS management console, and create a new Application pool.

  • In 64 bit machines allow 32 bit applications.
  • Disable rapid-fail protection.
  • In IIS7
    • Disable managed code, no .NET version
    • Classic pipeline
    • Create a new local user like OWS_RUNNER, and assign the applicationpool to run under that username. Do not make it power user or administrator, just a user is enough.

Give the user read/execute permissions under C:\OWS and additional write permissions under C:\OWS\web\static

Create OWS Website

  • New website, name it OWS
  • port 8080 or something unique, anyway not the standard 80, which will interfere with existing stuff.
  • Site path something like C:\OWS\web so that static folder is directly under it.
  • Permissions: Read, Run Scripts, Execute
  • If the installation is to another directory than C:\OWS, edit the OWS\web\web.config file, change the PyISAPIe.dll path to yours.
  • If a provider starts with /S, add it to the OWS\web\web.config file. Providers with other letters are configured automatically with wildcards.
  • Edit OWS\web\config.py and change log_webpy_to_file = True for enabling logging via IIS

Significant changes since version 1.2

  • Unix and Windows code base have been unified.
  • filtering by any dimension works now. You can choose pressure or wavelength.
  • Performance for querying large cubes as improved.
  • Query Caching was implemented: Identical queries will return the same temporary file.

Significant changes since version 1.1

  • Tested with activestate python 2.6.5.14 and 2.6.5.15, Earlier versions of python 2.6 may work.
  • Unix and Windows style newlines bug is still present.
  • Bug fixes to xml documents
  • added optional wcs_capabilities.conf files for wcs metadata.

Finally we have xml schemas that actually work. 1.1.1 and 1.1.2 documents can be validated properly. This also exposed a huge number of wrong names ans namespaces in the capabilities and describecoverage documents. If you have code that used to read 1.1.0 xml, it needs to be updated.

Significant changes since version 1.0

  • Python version

python 2.5 will not work for you, use 2.6

  • Unix and Windows style newlines.

With python 2.5, webpy development server required, that text files have Unix-style end of line marker, plain LF and not the Windows convention CR-LF. This was a bug deep in python libraries, and is fixed in 2.6.

The owsadmin.py script still supports turning files to unix and windows convention.

python C:\OWS\web\owsadmin.py unix_nl "C:\OWS\web\static\testprovider\index.html"
  • errorneous "fieldsubset:" prefix

The WCS query used to have fieldsubset: prefix, this was incorrect and is fixed. It also means, that old queries that used fieldsubsets won't work anymore. Update your links.

  • Bug fixes to queries

Some filters returned incorrect results. One good reason to upgrade.

Moved from WCS Server for CF (GEO-AQ-CoP

  • These two services are in the same computer: htap.icg.kfa-juelich.de. The two completely different services are created just putting the netcdf files to folders HTAP_FC_pressure and MACC_bnds. They are just ordinary folders: the folder name is used as service name. http://geo-aq-cop.org/node/1316/
  • The HTAP_FC_pressure GetCapabilities contains plenty of coverages. For example GISS-PUCCINI-modelEaer_FC3SA_metm comes simply from the file GISS-PUCCINI-modelEaer_FC3SA_metm.nc which is in the HTAP_FC_pressure folder. One of the data variables is cnvflxup(time,lev,lat,lon) and that becomes automatically a field.