I am an undergraduate working on the Carbon Storage and Sequestration Invest model for an honors capstone project on kelp forest valuation. I am having trouble identifying the errors that keep appearing when I run it and what they mean, such as saying there are no corresponding entries in the value map, in adding a task, etc., to see what to change, and hopefully have a successful next try. I am attaching the log text file below.
Thank you all for any support you might be able to provide!
Thanks for trying @Isabella_Smith , but that link requires an Apple account to access it. Instead of a web link, you can use the Upload function of the forum interface to upload it directly to this thread.
That said, you mention that you’re getting errors like this in your first post:
there are no corresponding entries in the value map
Have you tried using the Search function of the forum to look for other posts related to this error? It has been discussed many times, and you might find the answers you need in those posts.
Thanks for uploading the log file @Isabella_Smith. The specific error says this:
TypeError: Missing or NA value in ‘lucode’ column in Carbon Pools table.
So have you verified that all of the rows in Carbon pools.csv have values for the field “lucode”? If any are missing, you must make sure that each row corresponds to one of the land cover classes in the land use/land cover raster, and the “lucode” value in the table is the same as the integer Value for each class in the raster.
If you feel like they are all correct, please send a link to your data and i’ll check it out. Here’s an easy way to create a complete datastack using the Workbench interface, and you can upload that datastack somewhere that we have access to.
I have, yeah, from past attempts at running the model, it seems everything is correct, it’s just this error that I’m unsure of what the issue might be. I’m not sure if it’s that I need to add the exact nan/Na value from the raster map or that there might need to be a change in the nan/Na values in the raster map itself. Here’s a link to the data
Thanks for providing the datastack. There are two landcover rasters, each of which has values of only 0 and 1. The carbon pool table has values of NA, 0, 1 and 2. Are you intending for a value of 0 to indicate “nonkelp” in the landcover raster? Or a value of 2? That’s the first thing to clarify, so that your table lucodes and values can properly match your raster values.
There should not be an entry in the carbon pool table for “no data”, and no lucode of “NA”. The lucode field should only contain the valid integer values in the raster that correspond with landcover classes (so 0 and 1).
When i removed the NA entry from the carbon pool table, i got the following error:
File “pygeoprocessing\geoprocessing.py”, line 2428, in _map_dataset_to_value_op
pygeoprocessing.geoprocessing.ReclassificationMissingValuesError: The following 1 raster values [nan] from “C:\Temp\forums\Carbon_Isabella\invest_carbon_datastack\data\lulc_bas_path_raster\all_kelp_current.tif” do not have corresponding entries in the value map: {np.int64(0): 0.0, np.int64(1): 0.62, np.int64(2): 0.0}.
This is because the NoData value in your rasters is “nan”, which is not a valid value, and the model does not handle. The NoData value should be a numeric value that is not used by your landcover classes. As the User Guide says:
Every raster that is used as input to InVEST models must have a numeric data value assigned to the raster’s NoData value. This NoData value must not be considered valid model data. For example, the Land use/land cover raster might have valid land use codes of 1 through 30, so you could choose a NoData value of 9999. The value “nan” IS NOT a valid NoData value, and will produce an error when running models. You can check the NoData value by looking at the raster’s Properties in a GIS.
So you need to set the NoData value in your landcover rasters to something like 99 instead of “nan”, then try running the model again. When i did this, it ran successfully.
So yes, the non-kelp will be indicated as the value of 0, and the kelp will be the value of 1. We will also change the nan to a value like 99 as you suggested in the raster to correspond. But would that value still be a separate column before the 0 and 1, with the same name being no data?
No, the NoData value is not included in the biophysical table. NoData is a special value stored in the raster, which is treated specially by the software. When it’s defined correctly, the model knows that it represents background pixels that are not part of the analysis.