Hi sibylles, that’s a good start!
To run an InVEST model from the command line, you need to specify the model name, the path to a datastack (a JSON file that specifies the inputs), and the path to a workspace directory (where you want the output files to go).
The format looks like this:
invest -vvv run <modelname> -d <datastack json file> -w <output_workspace>
and you can get more info about commands and options in the Invest CLI documentation (and/or by running invest --help
).
You can store your input files anywhere on your computer. The key to feeding those inputs to the model is the datastack JSON file.
To understand what an InVEST datastack looks like, I’d recommend looking at the sample data. If you haven’t already downloaded the InVEST sample data, you can get it from the InVEST Downloads page. Follow the link to Individual Sample Datasets for InVEST, then select pollination.zip
to download sample data that can be used to run the pollination model. If you open the file pollination_willamette.invs.json
, you’ll see a JSON representation of the inputs (args
) required by the pollination model. To run the model with your own data, you will need to create a JSON file with this same format, where the value of each arg is the path to an input file.
I’d also recommend running the model with the sample data first, just to make sure things are working as expected. So, for example, if you are inside the pollination
sample data directory, you can run invest -vvv run pollination -d pollination_willamette.invs.json -w ../path/to/output-directory
(where ../path/to/output-directory
is the relative path to a directory where you want the output files to go).