Getting the toolbox
The free and open source python ODV toolbox can be downloaded from
when you Join OpenEarth, download the tools with SubVersion and add them to your python path.
Loading, merging and parsing ODV sparse file
For setting up WPS for remote processing of collections of ODV files a python io library
pyodv has been created. Within this library (as a folder), the file pyodv.py contains the ODV class, which contains useful methods for ODV collections loading, merging and parsing. Please also see our MATLAB toolbox odv for ODV files.
NB. If you are working within
pyodv.* is not needed. This is valid here and after along the following tutorial.
An overview of the contents (spatial extent, temporal range, parameters) of the
Odv object can be displayed with
due to the
html function inside the
Odv object, it will display something like this
Alternatively, for a single parameter, functions like
odvspar2*() can help you to handle your odv parameter object as a pandas Dataframe or json.
Loading, merging and parsing ODV collections from a Spatial Database
Lately, Spatial DB's like PostGIS on PostgreSQL have been increasingly used to handle large collections of ODV files. A mixed approach to store and parse data in and from the Spatial DB is the use of:
OpenEarth general-scope function sqlfunctions.py makes extensive use of the first package. On the other hand, OpenEarth odv2orm*.py functions have strong dependencies with the second model. The advantage of the first method is to run a SQL query string as inputs. The second methods provides user-defined python classes to represent database tables and python class objects to represent rows in those tables, which means working with Python objects instead of SQL queries. The latter method is based on odv2orm_model, odv2orm_initialize, odv2orm_populate, odv2orm_query, to respectively define an object-relational model, initiate the database, populate the database tables with rows, query the database. As with the odv sparse file, an object from pyodv.Odv class is returned using the class methods.
ODV object (retried from DB or odv sparse file) can be viewed as html
ODV.html() or as formatted command line text
print(ODV). Several plotting functions are available. In general, functions look like
(file_name,ODV_object,parameter_name,z_name).These four parameters represent the minimum number of input arguments. file_name is the output file name; ODV_object is the fore-mentioned pyodv.ODV class object; parameter_name and z_name are respectively the
P01 name of the chemical/physical parameter and depth definition, both according to BODC vocabulary. Last obligatory input is made necessary by the presence of several depth definitions based on Length/Pressure. Optional arguments are: parameter limits, z limits, time interval, Matplotlib colormap string, parameter in a log10 scale, uniform color string, marker type, markersize, alpha value. Further information is contained in python function headers and
Trajectory data can be plotted as a map in .png and .kmz images (circles or columns), with x: Lon, y: Lat, cbar: Parameter. Ldb info is provided via a .nc on the
Plotting a vertical profile, with x: Parameter, y: Depth, cbar: Time.
Plotting a timeseries, with x: Time, y: Parameter, cbar: Depth.
Plotting a timeseries of vertical profiles, with x: Time, y: Depth, cbar: Parameter.
pydov as WPS
On our test server we host pyodv with some server-side data files as WPS. On the server the pyodv WPS wrappers are hosted here
whereas a copy of the pyodv toolbox is here
It is deployed with NGINX as web server, and uwsgi as application server, see Setting up pyWPS in combination with uwsgi and nginx. As local server on a Windows environment, a WPS server can be installed following this tutorial.
The WPS can be accessed on a test server via:
We designed WPS for pyodv similar to the WxS services, please see pyWPSodv.
This toolbox is being developed as part of EMODnet chemistry 2.