natcap.invest.hra

Habitat risk assessment (HRA) model for InVEST.

natcap.invest.hra.build_datastack_archive(args, datastack_path)

Build a datastack-compliant archive of all spatial inputs to HRA.

This function is implemented here and not in natcap.invest.datastack because HRA’s inputs are too complicated to describe in ARGS_SPEC. Because the input table and its linked spatial inputs are too custom, it warrants a custom datastack archive-generation function.

Parameters
  • args (dict) – The complete args dict to package up into a datastack archive.

  • datastack_path (string) – The path on disk to where the datastack should be written.

Returns

None

natcap.invest.hra.execute(args)

Habitat Risk Assessment.

Parameters
  • args['workspace_dir'] (str) – a path to the output workspace folder. It will overwrite any files that exist if the path already exists.

  • args['results_suffix'] (str) – a string appended to each output file path. (optional)

  • args['info_table_path'] (str) – a path to the CSV or Excel file that contains the name of the habitat (H) or stressor (s) on the NAME column that matches the names in criteria_table_path. Each H/S has its corresponding vector or raster path on the PATH column. The STRESSOR BUFFER (meters) column should have a buffer value if the TYPE column is a stressor.

  • args['criteria_table_path'] (str) – a path to the CSV or Excel file that contains the set of criteria ranking of each stressor on each habitat.

  • args['resolution'] (int) – a number representing the desired pixel dimensions of output rasters in meters.

  • args['max_rating'] (str, int or float) – a number representing the highest potential value that should be represented in rating in the criteria scores table.

  • args['risk_eq'] (str) – a string identifying the equation that should be used in calculating risk scores for each H-S overlap cell. This will be either ‘Euclidean’ or ‘Multiplicative’.

  • args['decay_eq'] (str) – a string identifying the equation that should be used in calculating the decay of stressor buffer influence. This can be ‘None’, ‘Linear’, or ‘Exponential’.

  • args['aoi_vector_path'] (str) – a path to the shapefile containing one or more planning regions used to get the average risk value for each habitat-stressor combination over each area. Optionally, if each of the shapefile features contain a ‘name’ field, it will be used as a way of identifying each individual shape.

  • args['n_workers'] (int) – the number of worker processes to use for processing this model. If omitted, computation will take place in the current process. (optional)

  • args['visualize_outputs'] (bool) – if True, create output GeoJSONs and save them in a visualization_outputs folder, so users can visualize results on the web app. Default to True if not specified. (optional)

Returns

None.