Error Hydropower Evaluation Annual Water Yield

Hi! I have a problem when I run the annual water yield model with hydropower evaluation. In the Hydropower Water Yield log, the main message is:

2020-10-06 00:15:22,947 Task.add_task(731) ERROR Something went wrong when adding task create_ws_id_vector_output (13), terminating taskgraph.
Traceback (most recent call last):
File “site-packages\taskgraph\Task.py”, line 697, in add_task
File “site-packages\taskgraph\Task.py”, line 1174, in _call
File “site-packages\natcap\invest\hydropower\hydropower_water_yield.py”, line 682, in create_vector_output
File “site-packages\natcap\invest\hydropower\hydropower_water_yield.py”, line 975, in compute_watershed_valuation
File “site-packages\osgeo\ogr.py”, line 4401, in GetField
KeyError: ‘Illegal field requested in GetField()’
2020-10-06 00:15:22,951 model._logged_target(1632) ERROR Exception while executing <function execute at 0x0F583588>
Traceback (most recent call last):
File “site-packages\natcap\invest\ui\model.py”, line 1629, in _logged_target
File “site-packages\natcap\invest\hydropower\hydropower_water_yield.py”, line 604, in execute
File “site-packages\taskgraph\Task.py”, line 697, in add_task
File “site-packages\taskgraph\Task.py”, line 1174, in _call
File “site-packages\natcap\invest\hydropower\hydropower_water_yield.py”, line 682, in create_vector_output
File “site-packages\natcap\invest\hydropower\hydropower_water_yield.py”, line 975, in compute_watershed_valuation
File “site-packages\osgeo\ogr.py”, line 4401, in GetField
KeyError: ‘Illegal field requested in GetField()’
2020-10-06 00:15:22,953 model._logged_target(1635) INFO Execution finished
2020-10-06 00:15:22,955 utils.prepare_workspace(117) INFO Elapsed time: 3m 1.8499999999999943s

I need help for the running model.

Hi @JuanAlejandro

This could be related to a missing input, so I would double check that all of your input files have all the required fields described in the user’s guide. If everything looks correct, please attach the log file and your input files and then I can look into it further!

1 Like

Hi @esoth

With InVEST version 3.7, the result in the watershed about hydropower valuation table, the column hp_energy and hp_val result 0 (zero). With the InVEST version 3.8 (the last version), the model Hydropower Water Yield log, the main message is the last comment.

All input it’s correct (with correct green check). If is necessary, I’m going to send the input.

Hi @JuanAlejandro,

From what you’ve said, I’m not sure what is going wrong, but if you can send the input I’d be happy to try to reproduce the error and figure out if this is a bug. You can share a google drive link here, or email it to me privately: esoth @ stanford.edu

1 Like

Dear Esoth

I just sent to you the link with the input InVEST WaterYield Hydropower at your mail.

1 Like

Hi @JuanAlejandro,

Thanks for sharing your data! I tried running it with the latest version (3.8.9) and did not get the same error.

  • Are you using InVEST version 3.8.9?
  • What operating system are you on?
  • Which files exactly did you select for the raster inputs? I used the w001001.adf file from each raster folder, not sure if that is the correct one.

Hi @esoth

Thanks for your response!

I use InVEST 3.8.9 (the last version available in the Natural Capital Project) and I used the raster with .hrd extension (recomment in the manual).I have MacBook Air 17 but I run the model on Windows partition (with Bootcam in Mac).

When I run the model, the table result (in the hp_power column) result zero (o). Are you similar result?

Hi @JuanAlejandro,

Using the hdf files, I am getting the same issue. The columns consum_vol and consum_mn are all 0 and the columns rsupply_vl, rsupply_mn, hp_energy, and hp_val are all Null. I’m looking into what is causing the issue now and I’ll let you know what I find. Thanks for reporting this!

It turns out that this is a bug that’s happening because all the values in your demand table are 0. When the average demand in a subwatershed (consum_mn) is 0, then rsupply_vol isn’t calculated, and because of that hp_energy and hp_val aren’t calculated.

This is an error in the model: it’s totally valid to have a demand value of 0. We’ll fix this in a future release of InVEST, and I can send you a development build with this issue fixed next week! However, if you intend to update your demand table so that all values are greater than 0, that would solve the immediate problem.

Hi @esoth

That’s right! Now, I’m going to seca the minor value for ( consum_mn ), that just need the valoration hydropower result in the sub watersheds.

I have a question. In the column “height” in the hydropower_table, what’s the meaning height? I don’t understand “The head, measured as the average annual effective height of the water behind each reservoir at the turbine intake. Floating point value in meters”.

Thanks so very much for your responses!

This wording is a bit ambiguous, but since valuation is based on the hydroelectric power generated, and that power generated is a function of the depth of the water flowing through the intake, then it would follow that if the water level behind the dam is low enough to not flow through the intake, then you wouldn’t be generating any electricity and so the height should be relative to the depth of the hydroelectric intake.

I found this image on wikipedia to be helpful in identifying the height:

Let us know if you have any other questions!
James

1 Like

Hi @jdouglass

Thanks so very much for your response! I was need this parameters with the values in the watershed dam of my research for the valoration water fresh ecosystem services.

1 Like

2020-12-21 12:30:18,173 utils.prepare_workspace(111) INFO Writing log messages to D:/InVEST_output\InVEST-Hydropower-Water-Yield-log-2020-12-21–12_30_18.txt
2020-12-21 12:30:18,178 model.logged_target(1626) Level 100 Starting model with parameters:
Arguments for InVEST natcap.invest.hydropower.hydropower_water_yield 3.8.9:
biophysical_table_path D:/InVEST_input/biophysical_table_gura.csv
depth_to_root_rest_layer_path D:/InVEST_input/soil_depth/soil_depth_mm.tif
do_scarcity_and_valuation False
eto_path D:/InVEST_input/et_dir/et_dir/et_1_2014.tif
lulc_path D:/InVEST_input/lulc/lulc/gaya_lulc.tif
n_workers -1
pawc_path D:/InVEST_input/pawc/pawc/pawc_01.tif
precipitation_path D:/InVEST_input/precip_dir/precip_dir/prec_01.tif
results_suffix z

seasonality_constant 3
sub_watersheds_path
watersheds_path D:/InVEST_input/wshd/watersheds.shp
workspace_dir D:/InVEST_output

2020-12-21 12:30:18,508 hydropower_water_yield.execute(269) INFO Validating arguments
2020-12-21 12:30:18,508 validation.wrapped_validate_func(912) DEBUG Using ARG_SPEC for validation
2020-12-21 12:30:18,508 validation.wrapped_validate_func(916) INFO Starting whole-model validation with ARGS_SPEC
2020-12-21 12:30:18,508 validation.timeout(626) INFO Starting file checking thread with timeout=5
2020-12-21 12:30:18,539 validation.timeout(638) INFO File checking thread completed.
2020-12-21 12:30:18,539 validation.validate(795) DEBUG Provided key do_scarcity_and_valuation does not exist in ARGS_SPEC
2020-12-21 12:30:18,539 validation.timeout(626) INFO Starting file checking thread with timeout=5
2020-12-21 12:30:18,592 validation.timeout(638) INFO File checking thread completed.
2020-12-21 12:30:18,592 validation.timeout(626) INFO Starting file checking thread with timeout=5
2020-12-21 12:30:18,592 validation.timeout(638) INFO File checking thread completed.
2020-12-21 12:30:18,592 validation.timeout(626) INFO Starting file checking thread with timeout=5
2020-12-21 12:30:18,608 validation.timeout(638) INFO File checking thread completed.
2020-12-21 12:30:18,608 validation.timeout(626) INFO Starting file checking thread with timeout=5
2020-12-21 12:30:18,608 validation.timeout(638) INFO File checking thread completed.
2020-12-21 12:30:18,608 validation.timeout(626) INFO Starting file checking thread with timeout=5
2020-12-21 12:30:18,608 validation.timeout(638) INFO File checking thread completed.
2020-12-21 12:30:18,608 validation.timeout(626) INFO Starting file checking thread with timeout=5
2020-12-21 12:30:18,623 validation.timeout(638) INFO File checking thread completed.
2020-12-21 12:30:18,623 validation.timeout(626) INFO Starting file checking thread with timeout=5
2020-12-21 12:30:18,623 validation.timeout(638) INFO File checking thread completed.
2020-12-21 12:30:18,646 validation.wrapped_validate_func(963) DEBUG Validation warnings: []
2020-12-21 12:30:20,008 geoprocessing.align_and_resize_raster_stack(752) INFO 1 of 5 aligned: eto_z
.tif
2020-12-21 12:30:20,595 geoprocessing.align_and_resize_raster_stack(752) INFO 2 of 5 aligned: precip_z
.tif
2020-12-21 12:30:21,171 geoprocessing.align_and_resize_raster_stack(752) INFO 3 of 5 aligned: depth_to_root_rest_layer_z
.tif
2020-12-21 12:30:22,175 geoprocessing.align_and_resize_raster_stack(752) INFO 4 of 5 aligned: pawc_z_.tif
2020-12-21 12:30:22,744 geoprocessing.align_and_resize_raster_stack(752) INFO 5 of 5 aligned: clipped_lulc_z_.tif
2020-12-21 12:30:22,744 geoprocessing.align_and_resize_raster_stack(754) INFO aligned all 5 rasters.
2020-12-21 12:30:22,998 hydropower_water_yield.execute(404) DEBUG bio_lucodes {2, 3, 4, 5, 6, 7, -1.0}
2020-12-21 12:30:23,000 hydropower_water_yield._check_missing_lucodes(904) INFO Checking that input tables have landcover codes for every value in the landcover map.
2020-12-21 12:30:23,508 hydropower_water_yield.execute(458) INFO Reclassifying temp_Kc raster
2020-12-21 12:30:23,515 geoprocessing.raster_calculator(375) INFO starting stats_worker
2020-12-21 12:30:23,517 geoprocessing.raster_calculator(381) INFO started stats_worker <Thread(Thread-1142, started daemon 7164)>
2020-12-21 12:30:24,114 geoprocessing.raster_calculator(454) INFO 100.0%% complete
2020-12-21 12:30:24,115 geoprocessing.raster_calculator(457) INFO signaling stats worker to terminate
2020-12-21 12:30:24,116 geoprocessing.raster_calculator(459) INFO Waiting for raster stats worker result.
2020-12-21 12:30:24,116 threading.run(870) DEBUG payload is None, terminating
2020-12-21 12:30:24,686 hydropower_water_yield.execute(470) INFO Reclassifying tmp_root raster
2020-12-21 12:30:24,693 geoprocessing.raster_calculator(375) INFO starting stats_worker
2020-12-21 12:30:24,694 geoprocessing.raster_calculator(381) INFO started stats_worker <Thread(Thread-1143, started daemon 10872)>
2020-12-21 12:30:25,282 geoprocessing.raster_calculator(454) INFO 100.0%% complete
2020-12-21 12:30:25,283 geoprocessing.raster_calculator(457) INFO signaling stats worker to terminate
2020-12-21 12:30:25,283 geoprocessing.raster_calculator(459) INFO Waiting for raster stats worker result.
2020-12-21 12:30:25,283 threading.run(870) DEBUG payload is None, terminating
2020-12-21 12:30:25,809 hydropower_water_yield.execute(484) INFO Reclassifying tmp_veg raster
2020-12-21 12:30:25,839 geoprocessing.raster_calculator(375) INFO starting stats_worker
2020-12-21 12:30:25,841 geoprocessing.raster_calculator(381) INFO started stats_worker <Thread(Thread-1144, started daemon 3428)>
2020-12-21 12:30:26,432 geoprocessing.raster_calculator(454) INFO 100.0%% complete
2020-12-21 12:30:26,433 geoprocessing.raster_calculator(457) INFO signaling stats worker to terminate
2020-12-21 12:30:26,433 geoprocessing.raster_calculator(459) INFO Waiting for raster stats worker result.
2020-12-21 12:30:26,433 threading.run(870) DEBUG payload is None, terminating
2020-12-21 12:30:26,909 hydropower_water_yield.execute(497) INFO Calculate PET from Ref Evap times Kc
2020-12-21 12:30:26,917 geoprocessing.raster_calculator(375) INFO starting stats_worker
2020-12-21 12:30:26,918 geoprocessing.raster_calculator(381) INFO started stats_worker <Thread(Thread-1145, started daemon 10120)>
2020-12-21 12:30:26,950 threading.run(870) DEBUG payload is None, terminating
2020-12-21 12:30:26,950 geoprocessing.raster_calculator(486) INFO Waiting for raster stats worker result.
2020-12-21 12:30:26,951 threading.run(870) WARNING No valid pixels were received, sending None.
2020-12-21 12:30:26,951 Task.add_task(731) ERROR Something went wrong when adding task calculate_pet (5), terminating taskgraph.
Traceback (most recent call last):
File “site-packages\taskgraph\Task.py”, line 697, in add_task
File “site-packages\taskgraph\Task.py”, line 1174, in _call
File “site-packages\pygeoprocessing\geoprocessing.py”, line 424, in raster_calculator
File “site-packages\natcap\invest\hydropower\hydropower_water_yield.py”, line 874, in pet_op
File “<array_function internals>”, line 6, in isclose
File “site-packages\numpy\core\numeric.py”, line 2288, in isclose
TypeError: ufunc ‘isfinite’ not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ‘‘safe’’
2020-12-21 12:30:26,952 model._logged_target(1632) ERROR Exception while executing <function execute at 0x0F5F43D8>
Traceback (most recent call last):
File “site-packages\natcap\invest\ui\model.py”, line 1629, in _logged_target
File “site-packages\natcap\invest\hydropower\hydropower_water_yield.py”, line 507, in execute
File “site-packages\taskgraph\Task.py”, line 697, in add_task
File “site-packages\taskgraph\Task.py”, line 1174, in _call
File “site-packages\pygeoprocessing\geoprocessing.py”, line 424, in raster_calculator
File “site-packages\natcap\invest\hydropower\hydropower_water_yield.py”, line 874, in pet_op
File “<array_function internals>”, line 6, in isclose
File “site-packages\numpy\core\numeric.py”, line 2288, in isclose
TypeError: ufunc ‘isfinite’ not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ‘‘safe’’
2020-12-21 12:30:26,953 model._logged_target(1635) INFO Execution finished
2020-12-21 12:30:26,959 utils.prepare_workspace(117) INFO Elapsed time: 8.78s
“I am getting this error” kindly help me out.

Hi @sk117815,

This looks like a different error, so I’m going to open a new thread for it.