Datastack json file

Dear coummunity

After successfully installed InVEST Python on my MAC I tried to run the pollination model directly from the command line:
invest -vvv run pollination -d -w <output_workspace>

I am unsure how to establish “dadtdastack json file”. Is it right that I first need to prepare a folder with all the input data for the pollination model and then to provide the path within ? for the output I think it is the same, the path to my output folder.

Kind regards
Sibylle

Hi @sibylles , there are a couple different ways to create that datastack JSON file. First, you can find an example of that file with the sampledata for an invest model. Look in the model’s sampledata folder for the “.json” file. Open it in a text editor and you will see that it contains the filenames and paths to the input data, which happen to be located in the same folder as the JSON file.

You can setup your own datastack JSON file in a text editor. Or
you could use the Workbench to create the file for you by setting up your model run in the Workbench and then using the “Save as…” button in the sidebar to save a JSON file.

Since you have been working to setup a python environment, it is also worth mentioning that you could set up your model run in a python script instead of using the command line interface. If you use a python script, then you do not need a JSON file, instead you define the inputs for the model as a Python dictionary in your script. See an example here: Tutorial: Batch Processing on Windows — InVEST 3.14.2.post1+g1c98e3a.d20240530 documentation

You can also create a sample python script using the Workbench interface, again, by using the “Save as…” button after you setup your model.

The Python script approach is an alternative to the command-line interface approach described here: The InVEST CLI — InVEST 3.14.2.post1+g1c98e3a.d20240530 documentation

1 Like

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