Batch running model with multiple hazard layers

Hi all,

I have about 300 hazard layers that I want to batch-run for a risk analysis. All my input files are shapefiles. My model at the moment looks like this.

[model Taranaki-exposure]
framework = wizard
version = 1.3.0-wizard-v1
input-exposures.layer = Building Taranaki (exposure-layer)
input-exposures.geoprocess = false
input-hazards.layer = All Cliff Projections (hazard-layer)
input-hazards.geoprocess = false
sample.hazards-by = ALL_INTERSECTIONS
sample.hazards-buffer = 10 = *
analysis.sort = event.model = false
analysis.function = is_exposed
analysis.aggregate-consequences = true
analysis.aggregate-consequences-function = count = true‘MODELNAME’,format:‘csv’)[0] = consequence as consequence
report-event-impact.format = csv

[bookmark Building Taranaki (exposure-layer)]
description = Buildings in Taranaki (Source: LINZ)
location = Taranaki-buildings.shp

[bookmark All Cliff Projections (hazard-layer)]
description = .csv file with the location of all cliff projection polygons
location = all.csv

I ran the model and got this error:
model ‘Taranaki-exposure’ (from C:\Riskscape_Projects\getting-started\project.ini) is not valid

  • Problems found with ‘Taranaki-exposure’ identified model
    • Could not apply the answer to the ‘input-hazards.layer’ parameter to your model
      • Geometry attribute required but none found in {id=>Text, location=>Text, model=>Text}

Please let me know if more information is required, and any help with the model code and/or this error would be appreciated.


Hi Igar,

It depends a little on whether you want a single result or 300 separate results. If it’s the latter, you can use riskscape model batch command ( Tip: Use --help to inspect what you can do with the CLI ).

I think in your case you’ll want to try something like:

riskscape model batch Taranaki-exposure --vary-parameter input.hazards.layer --vary-input all.csv


Hi Nick,

Thank you for your reply.

I would prefer to have one output of a .csv and .shp file with the associated risk analysis of each hazard layer file, i.e one .csv and .shp file with 300 rows of data.

I also tried the code provided, but I am still getting the same error.

Hi again,

To start with, let’s make it work with a single hazard layer and go from there. Change the hazard layer bookmark (or add a new one) to be a single shapefile and make sure that’s working.

Once you’ve done that, if I’ve understood correctly, you want to run the model once against your 300 hazard layers to produce a single output that incorporates losses for the exposure layer against all the hazard layers and lists the results in a single csv and shapefile. Is this a probabilistic model? If not, can you give me an idea of what you’re trying to achieve? I.e. do you want to compare the results of 300 different hazard scenarios? Is this a Monte Carlo simuation of 300 different hazard events? Are you hoping to get AAL statistics from the model, or just basic statistics like means or percentiles?

Regardless, if you want a single output that covers running the model across all 300 hazard layers then the approach you need to take will be similar to how we do probabilistic modelling.

We’ve not built this type of modelling in to the wizard (yet) so the process is a bit more involved and goes a bit like this:

  • Get the wizard to produce you a single-event pipeline to work on as a starting point
  • Have a read of the [documentation on probabilistic modelling](Probabilistic modelling — RiskScape 1.5.0 documentation
  • Follow the example in the docs to convert your all.csv file in to a list of hazard layers that the model can run through.
  • Run the model, confirm you’re getting the cross product of exposures X events.
  • Decide how you want to aggregate the data to interpret the results, e.g. compute the mean loss to each exposure across all the hazard layers

Hope that helps, and if it doesn’t, do try to include some more details on what you’re trying to achieve so that we can help you best.


Hi again,

I’ve been talking to one of the other developers here and it looks like we don’t support loading Shapefiles in the manner described in the example. We’ve got it in our TODO list, but not sure when it’s going to be released.

In the meantime, you could try to convert the shapefiles to CSV, but that’s probably not going to work if the geometry within them is polygons. Probably your best bet for now is to use batch mode to run the model individually and then collate the results yourself. If you’re using linux or mac to do the modelling, we can help you with some command-line magic to concatenate the resulting CSVs from batch mode.