Can anyone tell me how I get the argument list (see '“args” list below)) into InVEST with the Command line function(cmd) just like the python way (natcap.invest.urban_cooling_model.execute(args)?
Are there perhaps some examples/screenshot how to?
Is it possible to run multiple InVEST Cooling calculations simultaneously?
Just to clarify, are you looking for a listing of the parameter keys into the args dictionary, or are you hoping to be able to run the model at the command-line, like you would some other command-line script? Or are you hoping to run it some other way?
Yes, but there’s unfortunately not a magic solution … parallelism is quite hard to get right!
What I would suggest that you do instead is to use the n_workers key to the args dict. The Urban Cooling Model is built in a way that allows for its tasks to be distributed across multiple CPU cores. It will also only calculate what it needs to calculate when you repeat runs within the same workspace. To use this, add this to your args dict:
args['n_workers'] = 8 # For this number, set it up to 2x the number of CPU cores you have.
If you’re scripting lots of runs of the model, just have them all use the same workspace, just with different file suffixes.
I already have a method for self-generating the args dictionary with the required variable for the urban cooling model. I do this using Python and ArcGIS. Now I am looking for a way to use this args dictionary to run the Urban Cooling Model with the command prompt method. Do you have an example of this?
I’m hoping for a method in which I can merge the args dictionary into a large list(like this[[],[],[][][]]]][]]] and then with the command prompt method execute it. So that is why I am interested in a way to use the command prompt method.
About my second question, how could I then perform this action simultaneously. For example, run multiple args dictionaires at the same time using the command prompt method as described above.
The closest example I can think of would be this tutorial in our API docs that shows how to export a python script (which you’re already doing) and then run it at the command line like so:
python my_script.py
The easiest thing to do is use the n_workers example I mentioned above. This will not only run model tasks in parallel, but it will also avoid recomputing more than it has to. This will make things run much, much faster!
If you really don’t want to use the n_workers approach, your best bet will be to either use python’s multiprocessing library or your shell’s process management features to run models in parallel. Could you provide an example of how you would like for things to run so that I can provide an example that would be helpful to you?
We are experiencing some difficulties with installing the prescribed python modules(wheels) to run Invest Urban Cooling module with python.
Installing the required python modules
I use python version 3.7.8(64). If I search the wheels files as described in your manual then some of these wheels versions aren’t accepted during installation with python and getting all sort of versioning errors. If I were to use a lower version of python, some python modules couldn’t even be found.
So, would it be possible you can put together a package with suitable modules (wheels) for python 3.7.8(64) and make them available which we can then download again.
In addition as written above, Errors occur during installation of certain wheel files. For example, if a wrong version of a python module is found and no suitable other version are there a standard installation location is used, somewhere on the: c:/user/temp/ etc./… Is it possible to adjust this path during installation?
Current situation:
It has become possible for me to install every module as described(almost slight_smile: ) , despite the fact that certain libraries may have wrong versions (gdal, rtree and pygeoprocessing(2.0). If I now run the python’s code I get the following error message( see below).
Any idea where this (keyError:’projection’) came from? I used these files in the invest cooling model-gui and the model got along just fine. I now run the model in python and I get the following error message:
Yeah, getting the versions right for all these packages can be a bear. The error you’re seeing is because a later version of pygeoprocessing is installed than what is supported by the version of InVEST you’re running.
Here’s how I suggest you proceed:
Download and install the wheels contained in this google drive folder. These specific versions should be installed before you continue to the next step.