If you're looking for the documentation for padm v1, you can find it here
API-reference v2
This web service aims to allow applications with access to run geography
locked particle dispersion models (PADM) for running oil spill simulations.
Check what models that are available and invoke the methods marked Mandatory and Order
which means you need to call the mandatory methods in the right order to be successful and
to get the results out.
Overall, you create a workarea in which the model will execute. This is a short lived resource but you can get the results out continuously as the model runs.
Additionally you can make the resulting resource more permanent and store results in a repository which can keep them up till 2 years but a limit of 500 stored simulations per application account
Forcing section describes when the model have data.
This version (v2) is the latest of PADM web service
Model
Find out available models to execute
GET /model/v2
Workarea
Create a model workarea. Mandatory, Order 1
This workarea will expire after 24 hours from creation date.
POST /workarea/v2
Output: URL location of workarea
Set model version. Mandatory, Order 2
Look in the /model URL for available values.
POST /workarea/v2/{id}/op/version
Input: String padmVersion, String modelSetupVersion, String forcingVersion
Output: none
Set model setting. Mandatory, Order 3
Setting fields are the following:
Field |
Info |
Possible values |
Dependency |
start |
Start and End fields must match with models available fields and max 10 days simulation. See forcing section. Dates must be in UTC/GMT and as text 'YYYY-mm-DD HH:mm:ss' |
Example 2011-01-01 01:00:00 |
end and forwardCalculation |
end |
Start and End fields must match with models available fields and max 10 days simulation. See forcing section. Dates must be in UTC/GMT and as text 'YYYY-mm-DD HH:mm:ss' |
Example 2011-01-02 01:00:00 |
start and forwardCalculation |
forwardCalculation |
Forward or backward simulation |
true, false |
start date must be bigger then end date if forward, fresh can only be true if forward |
outletType |
See below for further explanation |
POINT, LINE, AREA, MULTIPOINT |
outletType must match with valid outletPoints |
outletPoints |
The number of outlet points used for outlet |
1-20000 |
Value must match when setting model coordinates as well as outletType |
forecastMethod |
Derives from the models padmVersion under model resource. |
HIRLAM, ECMWF |
if version is NS03_HIRLAM_2.7 then forecastMethod must be HIRLAM |
calculationType |
Specifies what main classes to should be used |
See possible values below |
substance |
substance |
Specifies substances |
See possible values below |
calculationType |
fresh |
Condition of substance |
true, false |
forwardCalculation = false cannot have fresh = true |
winddrag |
Percentage of how much wind will affect |
0.00 - 100.0 |
only used with calculationType = Floating object / Algae and substance = Floating algae, file |
depth |
Start depth, unit meter |
Integer >= 0, for surface use depth = 0 |
none |
instantaneous |
Is an outlet instantaneous or not |
true, false |
amount amountUnit, duration, durationUnit |
amount |
How much oil in value if instantaneous = true else Total amount or rate |
Double |
amountUnit |
amountUnit |
Unit used for amount |
if instantaneous = true then m3, tonnes else m3, tonnes, m3/hour, tonnes/hour, m3/day, tonnes/day |
amount |
duration |
How much oil in value |
Double |
Only used together with instantaneous = false. Needs an durationUnit |
durationUnit |
Unit used for duration |
hours, days |
duration |
uncertainty |
Used to add an uncertainty value to forecast, hindcast used in simulation |
true,false |
none |
calculationMode |
The number of particles to represent the outlet when in simulation. Fast = 200, Normal = 500, Detailed = 2000 |
Fast, Normal, Detailed |
none |
outlet type
POINT, which matches exactly 1 coordinate (see setting coordinates below)
LINE, which matches min 2, 500 max coordinates)
AREA, which matches min 3, 10000 max coordinates
MULTIPOINT, which matches min 1, 20000 max coordinates, typically used together
with calculationType Floating object / Algae and substance Floating object, file or Floating algae, file.
calculation type and substance
calculationType values
- Oil classes
- Oil, specific
- Floating object / Algae
Given Oil classes then substance can be either of
- Light oils (0-100 cSt)
- Medium oils (100-1000 cSt)
- Heavy oils (>1000 cSt)
Given Oil, specific then substance can be either of
- GASOLINE
- JET FUEL AND KEROSINE
- LIGHT DIESEL FUEL
- FUEL OIL NO. 2
- LIGHT-MEDIUM CRUDE
- LUBRICATING OIL
- INTERMEDIATE OIL
- BUNKER B
- BUNKER C
- HEAVY CRUDE
- ASPHALT
- ORIMULSION (TEST)
- HIGH VISCOSITY FUEL OIL (TEST)
- BALDER (IKU-96)
- EKOFISK BLEND 2000
- GRANE (SINTEF)
- GULLFAKS A-B
- GULLFAKS SOER (IKU)
- KRISTIN_CORR
- NORNE (IKU)
- OSEBERG A (IKU)
- SLEIPNER (IKU)
- STATFJORD A
- ULA (IKU)
- VALHALL 2000
- AASGARD 2002
- DUC (IKU)
- SIRI
- SOUTH ARNE 5C
- SOUTH ARNE 13C
- FUEL OIL NO 6LS (IKU)
- IF 180-LS ESSO (SINTEF)
- IF 180-NS ESSO (SINTEF)
- IF-180 SHELL
- IF-380 HEAVY FUEL OIL
- IF-30 BUNKER (IKU)
- MARINE DIESEL (IKU)
- IFO 380 FU SHAN HAI
Given Floating object / Algae then substance can be either of
- Floating object, file
- Floating algae, file
This is used when doing algae or object calculations. When using Floating object / Algae, outletType needs to be MULTIPOINT.
POST /workarea/v2/{id}/op/setting
Input Content-type: application/xml application/json
Output: none
Set model coordinates. Mandatory, Order 4
EPSG:3857 (WGS84 Mercator) Latitude and Longitude values, see structure in example below. Note that the number of coordinates must match outlettype field in setting xml above.
POST /workarea/v2/{id}/op/coordinates
Input Content-type: application/json or application/xml see example below
Output: none
Set boom coordinates.
Sets booms with individual depths on each boom.
Example with one boom at depth 2.5 meters:
{
"type": "FeatureCollection",
"features": [
{
"type" : "Feature",
"properties" : {
"depth" : 2.5
},
"geometry" : {
"type" : "LineString",
"coordinates" : [[19.1, 56.0], [19.2, 56.1], [19.1, 56.1], [19.2, 56.2]]
}}]}
POST /workarea/v2/{id}/op/booms
Input Content-type: application/json (GeoJson)
Output: none
Example, using curl, for creating a workarea, setting model version, setting and coordinates:
We assume that the base url is https://padm.smhi.se
We assume that the result workarea Id = a0a280f8-4e0c-4877-86d8-afe26e1a908e
We assume that the start and end dates are valid
1) curl -u user:pwd -X POST -v https://padm.smhi.se/workarea/v2
2) curl -u user:pwd -X POST -v -d 'padmVersion=NS03_HIRLAM_2.7&modelSetupVersion=NS03_HIRLAM&forcingVersion=NS03_HIRLAM' https://padm.smhi.se/workarea/v2/a0a280f8-4e0c-4877-86d8-afe26e1a908e/op/version
3) curl -u user:pwd -v -X POST -H 'Content-type: application/xml'
-d '<simulation>
<forecastMethod>HIRLAM</forecastMethod>
<outletType>AREA</outletType>
<forwardCalculation>true</forwardCalculation>
<start>2014-08-07 00:00:00</start>
<end>2011-08-08 00:00:00</end>
<calculationType>Oil classes</calculationType>
<substance>Medium oils (100-1000 cSt)</substance>
<fresh>true</fresh><winddrag>0.00</winddrag>
<outletPoints>3</outletPoints>
<depth>0</depth>
<instantaneous>true</instantaneous>
<amount>100</amount>
<amountUnit>m3</amountUnit>
<duration>24</duration>
<durationUnit>hours</durationUnit>
<uncertainty>false</uncertainty>
<calculationMode>Normal</calculationMode>
</simulation>'
https://padm.smhi.se/workarea/v2/a0a280f8-4e0c-4877-86d8-afe26e1a908e/op/setting
or for json
curl -u user:pwd -X POST -v -H 'Content-type: application/json' -d '{ "forecastMethod": "HIRLAM", "outletType": "AREA","forwardCalculation": "true", "start": "2014-08-07 00:00:00", "end": "2014-08-08 00:00:00", "calculationType": "Oil classes", "substance": "Medium oils (100-1000 cSt)", "fresh": "true", "winddrag": "0.00", "outletPoints": "3", "depth": "0", "instantaneous": "true", "amount": "100", "amountUnit": "m3", "duration": "24","durationUnit": "hours","uncertainty": "false","calculationMode": "Normal" }'
https://padm.smhi.se/workarea/v2/a0a280f8-4e0c-4877-86d8-afe26e1a908e/op/setting
4) curl -u user:pwd -v -X POST -H 'Content-type: application/xml'
-d '<coordinates>
<coordinate>
<latitude>58.417118072509766</latitude>
<longitude>19.15887451171875</longitude>
</coordinate>
<coordinate>
<latitude>58.396942138671875</latitude>
<longitude>19.311656951904297</longitude>
</coordinate>
<coordinate>
<latitude>58.338314056396484</latitude>
<longitude>19.394878387451172</longitude>
</coordinate>
</coordinates>'
https://padm.smhi.se/workarea/v2/a0a280f8-4e0c-4877-86d8-afe26e1a908e/op/coordinates
or for json
curl -u user:pwd -v -X POST -H 'Content-type: application/json'
-d '{"coordinate": [{"latitude": "58.417118072509766","longitude": "19.15887451171875"},
{"latitude": "58.396942138671875","longitude": "19.311656951904297"},
{"latitude": "58.338314056396484","longitude": "19.394878387451172"}]}'
https://padm.smhi.se/workarea/v2/a0a280f8-4e0c-4877-86d8-afe26e1a908e/op/coordinates
Get a list of model simulation files
GET /workarea/v2/{id}
Output: text list of files
Get a model simulation file
GET /workarea/v2/{id}/{filename}
Output: output file stream
Runner
Run a model simulation. Mandatory, Order 5
Used for running a model simulation. Note: Make sure to use header Content-type application/x-www-form-urlencoded since the workareaId is a urlencoded string.
POST /runner/v2
Input: workareaId
Output: none
Example: curl -u usr:pass -v -X POST -d 'workareaId=a0a280f8-4e0c-4877-86d8-afe26e1a908e' https://padm.smhi.se/runner/v2
Get a the models progress status.
This is the preferred resource for checking execution status of model
GET /runner/v2/{id}/progress
Output: Response will be a json with fields as below
status
Execution status text which be one of the following:
CREATEDInitial workarea for model has been created
QUEUED model has recieved a run request, which adds the model to a run queue
INITIAL model process starting up
PARTIAL model process is running but not done
COMPLETE model process is complete and successful
ERROR model process has error
partialStep will in status PARTIAL show model execution step as a number string
Get a model process status. [Depricated]
Old version. Use check above instead.
GET /runner/v2/{id}
Output: Response will be 200 and execution status text which be one of the following:
INITIAL model process starting up
PARTIAL model process is running but not done
ERROR model process has error
COMPLETE model process is complete and successful
Get a model simulation result status. [Depricated]
Old version. Use check above instead.
GET /workarea/v2/{id}/op/resultfileStatus
Output: Model result status text as a datetime string
Results from workarea
Get metadata on cloud Mandatory, Order 6
Used to get metadata on cloud like start and end step.
GET /workarea/v2/{id}/cloud
Output Content-type: application/json
Example: {"minStep":1,"maxStep":13,"startDate":1407414600000,"endDate":1407425400000,"secondsBetweenSteps":900}
Get a range of model simulation result clouds. Mandatory, Order 7
Used to get a range of the simulation results as json.
latitude and longitude is the center position of oil particles. template is for each particle in "particles". level is how many meters below surface.
Returns 404 if result steps are not available. Get the models progress status partialStep to get last executed cloud when the model is running.
Returns 500 if model has failed.
GET /workarea/v2/{id}/cloud/v2/{startCloudNr}/{endCloudNr}
Output Content-type: application/json
Example: {"clouds":[{"id":1,"latitude":55.9493,"longitude":18.3252,"datetime":"2014-08-07 12:30","template":["lat","lon","level","category"],"particles":[[55.9492,18.3252,0,2],[55.9493,18.3253,0,2], [55.9502,18.3229,0,2]]}]}
Get a range of model simulation result clouds. [Depricated]
Old version. Used to get a range of the simulation results as json.
GET /workarea/v2/{id}/cloud/{startCloudNr}/{endCloudNr}
Output Content-type: application/json
Get the trajectory of the cloud
Used to get the trajectory of the simulation results as json.
GET /workarea/v2/{id}/cloud/trajectory
Output Content-type: application/json
Get graph data of the simulation
Used to get the graph data of the simulation results as json.
GET /workarea/v2/{id}/graph
Output Content-type: application/json
Get the boom objects
Used to get the boom objects as a geojson.
GET /workarea/v2/{id}/cloud/boom
Output Content-type: application/json (GeoJson)
Repository
Store model simulation result into repository.
Default expire date 1 month. Use this to store results in a more permanent URL. Expired results will be deleted from system.
This can be prolonged by calling set expire resource up till 2 years
POST /repository/v2
Input: workareaURI
Optional input: reporitoryId (used for storing results to fixed location)
Output: URL repository location.
Example 1:
calling https://padm.smhi.se/repository/v2
with
workareaURI = https://padm.smhi.se/workarea/v2/a0a280f8-4e0c-4877-86d8-afe26e1a908e
gives
https://padm.smhi.se/repository/v2/a0a280f8-4e0c-4877-86d8-afe26e1a908e
Example 2:
calling https://padm.smhi.se/repository/v2
with
workareaURI = https://padm.smhi.se/workarea/v2/a0a280f8-4e0c-4877-86d8-afe26e1a908e
and
repositoryId = bbb280f8-4e0c-4877-86d8-afe26e1a908e
gives
https://padm.smhi.se/repository/v2/bbb280f8-4e0c-4877-86d8-afe26e1a908e
Get the model simulation clouds
GET /repository/v2/{id}
Output: text list of cloud resource URIs
Get expire date of this repository simulation
GET /repository/v2/{id}/expire
Output: text date
Set expire date, max 2 years into the future.
Expired results will be deleted from system.
POST /repository/v2/{id}/op/expire
Input: date
Output: none
Get a range of model simulation result clouds.
Used to get a range of the simulation results as json.
GET /repository/v2/{id}/cloud/{startCloudNr}/{endCloudNr}
Output Content-type: application/json
Get the trajectory of the cloud
Used to the trajectory of the simulation results as json or xml.
GET /repository/v2/{id}/cloud/trajectory
Output Content-type: application/json
Get graph data of the simulation
Used to get the graph data of the simulation results as json.
GET /repository/v2/{id}/graph
Output Content-type: application/json
Get the boom objects
Used to get the boom objects as json or xml.
GET /repository/v2/{id}/cloud/booms
Output Content-type: application/json
Get a model simulation results setting
GET /repository/v2/{id}/setting
Output Content-type: application/xml
Get a model simulation results table
GET /repository/v2/{id}/table
Output Content-type: application/xml
Forcing
Get available dates for model forcing, display text.
Use the forcing version found under /model/v2.
GET /forcing/v2/output/{forcingVersion}/displayText
Input: forcing version
Output: Readable text of available dates
Get available dates for model forcing, dates.
Use the forcing version found under /model/v2.
GET /forcing/v2/output/{forcingVersion}/availableTimes
Input: forcing version
Output: Comma seperated unix timestamp text availableFrom date, availableTo date