InVEST python read in pollination_willamette.invs.json

Hello @sibylles ,

Yes, you can provide all of your input parameters to the InVEST pollination model through this JSON file. Filepaths can be relative or absolute paths. See below for a few examples.

As @edavis mentioned in another thread, you would use the datastack file from the command-line by adding the -d flag and providing the path to your datastack file there:

Relative path example

When using relative paths, the paths are relative to the location of the .json file. So if this .json file is located at C:\datastack.invest.json, then farms.shp would be expected to be found at C:\farms.shp. The guild table would be expected to be found at C:\my_folder\guild_table.csv.

{
    "args": {
        "farm_vector_path": "farms.shp",
        "guild_table_path": "my_folder/guild_table.csv",
        "landcover_biophysical_table_path": "landcover_biophysical_table.csv",
        "landcover_raster_path": "landcover.tif",
        "results_suffix": ""
    },
    "invest_version": "3.7.0",
    "model_name": "natcap.invest.pollination"
}

Absolute path example

These json files can also have filepaths defined as absolute paths, specifying where, exactly, on disk the file is located. Using absolute paths, you could store your JSON file anywhere on the hard drive and be able to access files anywhere on your hard drive.

{
    "args": {
        "farm_vector_path": "C:\InVEST_data\Pollination\farms.shp",
        "guild_table_path": "C:\InVEST_data\Pollination\guild_table.csv",
        "landcover_biophysical_table_path": "C:\InVEST_data\Pollination\landcover_biophysical_table.csv",
        "landcover_raster_path": "C:\InVEST_data\Pollination\landcover.tif",
        "results_suffix": ""
    },
    "invest_version": "3.7.0",
    "model_name": "natcap.invest.pollination"
}

Hope this helps,
James