reVeal.cli.score_weighted.run#

run(grid, attributes, score_name, out_dir, _local=True)[source]#

Calculate a composite score from specified attributes and weights.

Convert specified attribute values of input grid to a scale of 0 to 1 using the specified method(s). Outputs a new GeoPackage containing the input grid with added attributes for scored attributes.

Parameters:
  • grid (str) – Path to vector dataset for which attribute scoring will be performed. Must be an existing vector dataset in a format that can be opened by pyogrio. Does not strictly need to be a grid, or even a polygon dataset, but must be a vector dataset.

  • attributes (list) – List of dictionaries, each specifying the name of an attribute to be included in the composite weighted score, and a corresponding weight. Each dictionary should have the following keys:

    • attribute: String indicating the name of the attribute to include in the composite weight.

    • weight: Float in the range of >0, <=1 indicating the weight to apply to the attribute in the composite weighted score.

    Note

    Note that weights across all attributes must sum to 1.

  • score_name (str) – Name of the output column in which the resulting weighted scores will be stored.

    Note

    If this column exists in the input grid, it will be overwritten.

  • out_dir (str) – Output parent directory. Results will be saved to a file named “grid_scores.gpkg”.

  • _local (bool) – Flag indicating whether the code is being run locally or via HPC job submissions. NOTE: This is not a user provided parameter - it is determined dynamically by based on whether config[“execution_control”][“option”] == “local” (defaults to True if not specified).