Using Diva-on-web as a web-service

From GHER

Revision as of 13:23, 9 April 2010 by Aida (Talk | contribs)
Jump to: navigation, search

Diva-on-web can be used as a web-service using the following GET calls. The base_url is http://gher-diva.phys.ulg.ac.be/web-vis/Python/web/.

Contents

Upload

Upload the data to be interpolated to the diva-on-web service.

http://base_url/upload

Parameters

data
text file attached to the upload

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.

Analysis

Request an analysis to be performed

http://base_url/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 value and resolution of the grid
y0,y1,dy
idem for latitude
level
depth level

Response

Returned XMS 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

Downloads the result:

http://base_url/download

Parameters

fieldname
identifier of the results

Response

The requested file in NetCDF format


Web Map Service

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

The style attribute contains the following information:

method
plotting method (pcolor, contour or contourf)
ncontours
number of contours (ignored for pcolor)
inverted
true if color-map is inverted
cmap
color map name (http://www.scipy.org/Cookbook/Matplotlib/Show_colormaps)
vmin
minimum of color-map range
vmax
maximum of color-map range

Key and values are separated by a colon and key-value pairs by a plus. The style of the previous example is thus (decoded):

method:pcolor_flat+ncontours:40+inverted:false+cmap:jet+vmin:-5.43691+vmax:30.0554&
Personal tools