Issue with using Python to conduct SDR model

Hello community,

I’m trying to execute the SDR model using Python.

So far, I’ve installed and set up the InVEST Python Environment by following the steps from this tutorial.

Additionally, I’m using the Python script saved from the GUI, where all the parameters seem functional and return calculated results.

Here’s the Python script saved from the GUI:
execute_invest_sdr.zip (1.2 KB)

Dataset link: https://drive.google.com/file/d/1jqnS97q_9b00jpzR2xo-hbdTuz4mh7ce/view?usp=sharing

However, when I try to execute the same parameters in the command line (cmd), it returns an empty result.

Does anyone have any advice on how to resolve this?

Thanks in advance, and have a great day!

Here is the log that I get from the cmd while executing the script.
cmd process.txt (13.7 KB)

Hi @TP6tw, thanks for sharing the details of your issue! I looked at the log, and it seems the model stopped executing before completion, which is why you’re seeing empty results. Unfortunately, there’s no error message in the log to indicate why this happened.

I suspect this may have been a crash at the system level, in which case, we may be able to find more information in the Windows Event Log. You can find this by searching for Event Log in the Start Menu. Then, in the left-hand column, check either the Application or System logs, and look for a crash with a timestamp that matches the end of the program’s execution. There should be some additional debug information about what went wrong. If you share what you find there, we’ll be happy to take a look and help you find a solution.

Hi @edavis, thanks for your reply.

Here is the Event log, seems like the error stems from a module named gdal305.dll

Chun Wei
InVEST Event Log.txt (2.4 KB)

Hi @TP6tw ,

Thanks for your patience with this! And thank you for the event log. As we suspected, the fault is happening in the GDAL binary, although the specific failure is not immediately clear. This kind of error is usually because of a difference in GDAL versions relative to what was installed or compiled in your environment.

When reading through your post, I also see that you were using an older tutorial page that has some outdated instructions on how to install the natcap.invest package. As a next step, could you try following these instructions instead to create a new environment and see if that works as expected? Here is the tutorial link: Installing the InVEST Python Package — InVEST 3.14.2.post160+g9973dad.d20241022 documentation

The key is just to use the InVEST package, installed from conda-forge. You could create a new environment with this command:

conda create -n invest-env -c conda-forge natcap.invest

And then activate your environment with:

conda activate invest-env