Using Diva-on-web as a web-service

From GHER

(Difference between revisions)
Jump to: navigation, search
(Analysis)
Line 32: Line 32:
The stats root element may contain a warning or an error element with a message if a problem occurred.
The stats root element may contain a warning or an error element with a message if a problem occurred.
 +
 +
== Fit ==
 +
 +
 +
GET request to run DIVA fit:
 +
 +
http://url_prefix/fit
 +
 +
 +
=== Response ===
 +
 +
Returned XML file:
 +
<diva>
 +
  <stats>
 +
    <stat id='len'>10.3516045</stat>
 +
    <stat id='stn'>1.08679</stat>
 +
    <stat id='varbak'>33.2446</stat>
 +
    <stat id='quality'>0.963967</stat>
 +
    <plot>Data/1234-88b8c0cd7e_divafit.png</plot>
 +
  </stats>
 +
</diva>
 +
 +
=== Parameters ===
 +
 +
;sessionid: id from previous upload
 +
== Analysis ==
== Analysis ==
Line 51: Line 77:
=== Response ===
=== Response ===
-
Returned XMS file:
+
Returned XML file:
  <?xml version="1.0"?>
  <?xml version="1.0"?>
Line 67: Line 93:
  </stats>
  </stats>
  </layers>
  </layers>
-
 
== Download ==
== Download ==

Revision as of 11:23, 27 October 2016

Diva-on-web can be used as a web-service using the following GET or POST calls. The URL prefix is http://gher-diva.phys.ulg.ac.be/web-vis/Python/web/ (but it is not a complete URL).

Contents

Upload

POST request to upload the data to be interpolated to the diva-on-web service.

http://url_prefix/upload

Parameters

data
text file send to the server encoded as multipart/form-data. (see http://code.activestate.com/recipes/146306/ for an exemple in Python). The format of the fext file is described here.

Response

A simple XML file:

<?xml version="1.0"?>
<stats>
  <! -- number of observations received -->
  <stat id='obs_count'>%d</stat>
  <! -- min longitude -->
  <stat id='obs_x0'>%g</stat>
  <! -- max longitude -->
  <stat id='obs_x1'>%g</stat>
  <! -- min latitude -->
  <stat id='obs_y0'>%g</stat>
  <! -- max latitude -->
  <stat id='obs_y1'>%g</stat>
  <! -- identifier of the session -->
  <stat id='sessionid'>%s</stat>
</stats>

The stats root element may contain a warning or an error element with a message if a problem occurred.

Fit

GET request to run DIVA fit:

http://url_prefix/fit


Response

Returned XML file:

<diva>
 <stats>
   <stat id='len'>10.3516045</stat>
   <stat id='stn'>1.08679</stat>
   <stat id='varbak'>33.2446</stat>
   <stat id='quality'>0.963967</stat>
   <plot>Data/1234-88b8c0cd7e_divafit.png</plot>
 </stats>
</diva>

Parameters

sessionid
id from previous upload


Analysis

GET request to make an analysis:

http://url_prefix/make_analysis

Parameters

sessionid
id from previous upload
len
correlation length (arc degrees)
stn
signal to noise ratio (non-dimensional)
x0,x1,dx
first and last longitude values and resolution of the grid
y0,y1,dy
idem for latitude
level
depth level

Response

Returned XML file:

<?xml version="1.0"?>
<layers>
 <! -- identifier of the results -->
 <result src='%s' />
 <stats>
 <! -- minimum value of the analysis -->
 <stat id='vmin'>%g</stat>
 <! -- maximum value of the analysis -->
 <stat id='vmax'>%g</stat>
 <! -- number of observations used -->
 <stat id='stat_obs_count_used'>%g</stat>
 <stat id='stat_posteriori_stn'>%g</stat>
</stats>
</layers>

Download

GET request to download the results:

http://url_prefix/download

Parameters

fieldname
identifier of the results

Response

The requested file in NetCDF format

Web Map Service

A graphical representation of the interpolated layer can also be requested using the WMS protocol. The layer name is composed by:

 layer = fieldname + '#analyzed_field'

For example:

http://gher-diva.phys.ulg.ac.be/web-vis/Python/web/diva_on_web?LAYERS=1234-efea26fb2_analysis_diva_gebco_20_2_-180_180_3_-72_87_3.nc%23analyzed_field&TRANSPARENT=true&FORMAT=image%2Fpng&STYLES=method%3Apcolor_flat%2Bncontours%3A40%2Binverted%3Afalse%2Bcmap%3Ajet%2Bvmin%3A-5.43691%2Bvmax%3A30.0554&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=-180,-90,180,90&WIDTH=512&HEIGHT=256

More info is available at OceanBrowser WMS Server.

Python example

An example script in python with sample data http://gher-diva.phys.ulg.ac.be/web-vis/Data/temperature_argo.txt.

Personal tools