Help interpreting carbon model KeyError

What is the issue or question you have?

invest 3.11.0

I do not understand the error that I get running the carbon model.

I am running carbon model with a landcover .tif and carbonpools .csv file, the model appears to run, and it writes 3 intermediate files, but fails to complete.

here is the last lines of the output in the invest program

11/20/2022 01:17:02  pygeoprocessing.geoprocessing INFO     100.0% complete
11/20/2022 01:17:02  pygeoprocessing.geoprocessing INFO     Waiting for raster stats worker result.
11/20/2022 01:17:03  natcap.invest.utils ERROR    Exception while executing natcap.invest.carbon
Traceback (most recent call last):
  File "natcap\invest\utils.py", line 165, in prepare_workspace
  File "natcap\invest\cli.py", line 486, in main
  File "natcap\invest\carbon.py", line 334, in execute
  File "natcap\invest\carbon.py", line 335, in 
KeyError: 'c_soil'

Running it in python I get the following error (my invest environment runs SDR just fine):

 (lucode, float(carbon_pool_table[lucode][pool_type]))

KeyError: 'c_soil'


ERROR 1: PROJ: proj_create_from_database: C:\Program Files\PostgreSQL\14\share\contrib\postgis-3.2\proj\proj.db contains DATABASE.LAYOUT.VERSION.MINOR = 0 whereas a number >= 2 is expected. It comes from another PROJ installation.
ERROR 1: PROJ: proj_create_from_database: C:\Program Files\PostgreSQL\14\share\contrib\postgis-3.2\proj\proj.db contains DATABASE.LAYOUT.VERSION.MINOR = 0 whereas a number >= 2 is expected. It comes from another PROJ installation.
ERROR 1: PROJ: proj_create_from_database: C:\Program Files\PostgreSQL\14\share\contrib\postgis-3.2\proj\proj.db contains DATABASE.LAYOUT.VERSION.MINOR = 0 whereas a number >= 2 is expected. It comes from another PROJ installation.
ERROR 1: PROJ: proj_create_from_database: C:\Program Files\PostgreSQL\14\share\contrib\postgis-3.2\proj\proj.db contains DATABASE.LAYOUT.VERSION.MINOR = 0 whereas a number >= 2 is expected. It comes from another PROJ installation.

What do you expect to happen?

I wanted the carbon model to run to completion

What have you tried so far?

invest program for windows, inves tin python (spyder, invest build from conda forge)

Attach the logfile here:

InVEST-natcap.invest.carbon-log-2022-11-20–01_04_35.txt (9.7 KB)

I’ll answer this one myself…

It turns out I omitted the C_soil column in my carbon pools table. I thought since I had no data, I could omit it. Not true: I now have a column of 0 as C_oil, and the model runs! Great Success!

4 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.