natcap / invest

InVEST®: models that map and value the goods and services from nature that sustain and fulfill human life.
Apache License 2.0
151 stars 63 forks source link

Wind Energy gives non sensical results when min_distance arg is non 0 #811

Closed dcdenu4 closed 2 years ago

dcdenu4 commented 2 years ago

Rob Griffin pointed out that the Wind Energy model outputs non logical values when the Minimum distance for offshore wind farm installation (min_distance arg_spec) value is non 0. I can confirm this using the model sample data:

{
    "args": {
        "aoi_vector_path": "../../../../Program Files/InVEST_3.10.1_x64/sample_data/WindEnergy/input/New_England_US_Aoi.shp",
        "avg_grid_distance": "4",
        "bathymetry_path": "../../../../Program Files/InVEST_3.10.1_x64/sample_data/Base_Data/global_dem.tif",
        "global_wind_parameters_path": "../../../../Program Files/InVEST_3.10.1_x64/sample_data/WindEnergy/input/global_wind_energy_parameters.csv",
        "land_polygon_vector_path": "../../../../Program Files/InVEST_3.10.1_x64/sample_data/Base_Data/global_polygon.shp",
        "max_depth": "60",
        "max_distance": "200000",
        "min_depth": "3",
        "min_distance": "100",
        "number_of_turbines": "80",
        "results_suffix": "mindist",
        "turbine_parameters_path": "../../../../Program Files/InVEST_3.10.1_x64/sample_data/WindEnergy/input/5_0_turbine.csv",
        "valuation_container": false,
        "wind_data_path": "../../../../Program Files/InVEST_3.10.1_x64/sample_data/WindEnergy/input/ECNA_EEZ_WEBPAR_Aug27_2012.csv"
    },
    "invest_version": "3.10.1",
    "model_name": "natcap.invest.wind_energy"
}

Rob reported values of 42, but I'm seeing outputs look like:

dcdenu4 commented 2 years ago

I think the bug is coming from _create_distance_raster generating a pixel distance raster as opposed to a value distance raster which it claims to do. Then in _mask_by_distance the min_distance and max_distance are being compared, but we're comparing pixels vs meters.

dcdenu4 commented 2 years ago

Oops, wrong button, didn't mean to close

dcdenu4 commented 2 years ago

Started this in my fork under bugfix/811-wind-energy-distance-mask