Create a draft scenario
create_scenarioCreate a DRAFT scenario (no build, no run) and report its mesh-triangle estimate.
POSTs /projects//scenarios/ with the write fields, then GETs the
scenario detail — the create response carries NO estimate; the detail's
mesh_triangle_count_estimate (+ _breakdown) does. Returns a compact
record (the same fields get_scenario answers with): id, name, the FK ids
as stored, resolution, duration, computed_status (created = no run
yet), the estimate and its breakdown, the price (compute_cost_estimate
in USD, vcpu_hours_estimate), inflow_anchor_mismatch, and
http_status. Next step: build_scenario (which asks for
confirm=true above 100,000 triangles). Nothing is meshed or queued here.
Units: resolution — on the SCENARIO and on every MeshRegion FEATURE — is
a LENGTH in metres; ANUGA maximum_triangle_area = resolution²/2 (FloatField
default 100, not nullable; 0 makes the estimate None), and the estimate
prices both the same way (TASK-3186). The smallest value becomes the raster
cell size. A MeshRegion feature must carry resolution_units = m (features
drawn in the map are marked automatically); an unmarked one makes the build
answer 422 MESH_REGION_UNITS_UNMARKED, naming the conversion an operator runs.
The server does NOT validate that the FK ids belong to project_id —
pass the row ids attach_input_layer / get_terrain returned for THIS
project. Every FK is nullable at create time, and the build fails later
on a scenario with no terrain, or with neither an inflow nor a rainfall.
A boundary whose row has no features (the default 'Boundary 01' before
attach_input_layer) is accepted here and refused by build_scenario. The
estimate is None when resolution is 0; an estimate of 0 with a real
boundary is a very coarse mesh, not an error.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Scenario name | |
| inflow | No | Inflow row id (optional; the build needs an inflow OR a rainfall) | |
| terrain | No | Terrain id (get_terrain → terrain.id); the build fails without one | |
| boundary | No | Boundary row id (attach_input_layer kind=boundary → row_id) | |
| building | No | Building row id (optional) | |
| duration | Yes | Simulation duration in seconds (e.g. 43200 = 12 h) | |
| friction | No | Friction row id (optional) | |
| rainfall | No | Rainfall row id (optional; the build needs an inflow OR a rainfall) | |
| structure | No | Deprecated alias of `building` (TASK-3586); ignored when `building` is given. | |
| project_id | Yes | The project ID | |
| resolution | Yes | Mesh resolution as a LENGTH in metres (ANUGA maximum_triangle_area = resolution²/2). Coarser (larger) = fewer triangles: on a ~13 km² boundary 36-40 m gives ~16-20k triangles, 10 m ~255k, 1 m ~25M (refused by the API). | |
| description | No | Free-text description (optional) | |
| mesh_region | No | MeshRegion row id (optional): finer meshing inside its polygons, each feature's `resolution` a LENGTH in metres (see the units note). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||