This page describes the convention for the PyWPS plugin to find and expose matlab processes.
Example
function [data] = oil_spill(track, volume) % OIL_SPILL generate a dataset of an oil spill based on a track and total volume % % This is also part of the abstract % % input: % track = linestring % volume = double % % output: % data = file.nc %
Finding processes
Matlab functions can be exposed as WPS processes. The processes are found by putting matlab scripts in the directory that is exposed by the environment variable MATLAB_PROCESSES (analogue to PYWPS_PROCESSES). Matlab processes have the form of a matlab function, stored within a file with the name function.m.
WPS Process properties
The WPS process properties can be specified according to the table below. A process is a function and the properties are introspected from the comments by the following convention.
WPS property |
Matlab implementation |
example |
---|---|---|
identifier |
function name, lower case |
run_model -> run_model |
title |
function name, Title cased, _ replaced by spaces |
run_model -> Run model |
abstract |
first comment line, after CAPITALIZED function name and following comment block |
% FUNCTION some text -> some text |
metadata |
not supported |
|
profile |
not supported |
|
wsdl |
not supported |
|
version |
not supported |
|
service |
always WPS |
|
language |
always en-GB |
|
DataInputs |
list below % input: |
see example and details below |
ProcessOutputs |
list below % output: |
see example and details below |
storeSupported |
always false |
|
statusSupported |
always false |
|
WPS Input properties
The input properties are the function arguments, which properties are introspected from the comments by the following convention.
WPS property |
Matlab implementation |
example |
---|---|---|
identifier |
function name, lower case |
run_model -> run_model |
title |
function name, Title cased, _ replaced by spaces |
run_model -> Run model |
abstract |
first comment line, after CAPITALIZED function name and following comment block |
% FUNCTION some text -> some text |
minOccurs |
always 1 |
|
maxOccurs |
always 1 |
|
Metadata |
not supported |
|
InputForm Choice |
not supported |
|
ComplexData |
SFS types supported, by WKT type: linestring,geometry,point,etc... |
|
LiteralData |
basic types supported: float,int,string |
|
BoundingBox Data |
specified by the word bbox |
|
WPS Matlab JSON input.
Because you can't call matlab functions dynamically we prepare input for the matlab processes in JSON messages.
These JSON messages have the following form.
{'identifier': 'function_name', 'dataInputs' {'var1': [1,2,3], 'var2': [5,6]} }