natcap.invest.ui_server
A Flask app with HTTP endpoints used by the InVEST Workbench.
- natcap.invest.ui_server.build_datastack_archive()
Writes a compressed archive of invest model input data.
- Body (JSON string):
filepath: string - the target path to save the archive model_id: string (e.g. carbon) the model id args: JSON string of InVEST model args keys and values
- Returns:
message (string): for logging and/or rendering in the UI.
error (boolean): True if an error occurred, otherwise False.
- Return type:
A dictionary with the following key/value pairs
- natcap.invest.ui_server.get_args_enabled()
Gets the return value of an InVEST model’s validate function.
- Body (JSON string):
model_id: string (e.g. carbon) args: JSON string of InVEST model args keys and values
Accepts a language query parameter which should be an ISO 639-1 language code. Validation messages will be translated to the requested language if translations are available, or fall back to English otherwise.
- Returns:
A JSON string.
- natcap.invest.ui_server.get_dynamic_dropdown_options()
Gets the list of dynamically populated dropdown options.
- Body (JSON string):
model_id: string (e.g. carbon) args: JSON string of InVEST model args keys and values
- Returns:
A JSON string.
- natcap.invest.ui_server.get_geometamaker_profile()
Return the user-profile from geometamaker.
- natcap.invest.ui_server.get_invest_getspec()
Gets the MODEL_SPEC dict from an InVEST model.
Body (JSON string): “carbon” Accepts a language query parameter which should be an ISO 639-1 language code. Spec ‘about’ and ‘name’ values will be translated to the requested language if translations are available, or fall back to English otherwise.
- Returns:
A JSON string.
- natcap.invest.ui_server.get_invest_models()
Gets a list of available InVEST models.
Accepts a language query parameter which should be an ISO 639-1 language code. Model names will be translated to the requested language if translations are available, or fall back to English otherwise.
- Returns:
A JSON string
- natcap.invest.ui_server.get_invest_validate()
Gets the return value of an InVEST model’s validate function.
- Body (JSON string):
model_id: string (e.g. carbon) args: JSON string of InVEST model args keys and values
Accepts a language query parameter which should be an ISO 639-1 language code. Validation messages will be translated to the requested language if translations are available, or fall back to English otherwise.
- Returns:
A JSON string.
- natcap.invest.ui_server.get_is_ready()
Returns something simple to confirm the server is open.
- natcap.invest.ui_server.get_supported_languages()
Return a mapping of supported languages to their display names.
- natcap.invest.ui_server.log_model_exit()
- natcap.invest.ui_server.log_model_start()
- natcap.invest.ui_server.post_datastack_file()
Extracts InVEST model args from json, logfiles, or datastacks.
Body (JSON string): path to file
- Returns:
A JSON string.
- natcap.invest.ui_server.save_to_python()
Writes a python script with a call to an InVEST model execute function.
- Body (JSON string):
filepath: string model_id: string (matching a model_id from a MODEL_SPEC) args_dict: JSON string of InVEST model args keys and values
- Returns:
A string.
- natcap.invest.ui_server.set_geometamaker_profile()
Set the user-profile for geometamaker.
- Body (JSON string): deserializes to a dict with keys:
contact license
- natcap.invest.ui_server.write_parameter_set_file()
Writes InVEST model args keys and values to a datastack JSON file.
- Body (JSON string):
filepath: string model_id: string (e.g. carbon) args: JSON string of InVEST model args keys and values relativePaths: boolean
- Returns:
message (string): for logging and/or rendering in the UI.
error (boolean): True if an error occurred, otherwise False.
- Return type:
A dictionary with the following key/value pairs