Summary¶
The full procedure for running a ZEN-garden model is shown in the two scripts below. ZEN-garden can be used (1) with the command-line interface, or (2) by importing the package in a python script.
The two examples below are equivalent. They both download the dataset examples
1_base_case to the current working directory. Then, they run ZEN-garden
on that dataset. Finally, they provide a simple example of how to analyze the
resulting model outputs. In the command-line interface, the model outputs
can be explored using the ZEN-garden visualization platform. In a python script,
the ZEN-garden results class can be used to extract variable values and units.
Both types of analyses are described in detail in the
tutorial on analyzing outputs.
Command line interface¶
The following commands can be used to run an example dataset using the command-line interface.
zen-example --dataset="1_base_case"
zen-garden --dataset="1_base_case"
zen-visualization
The first line downloads the example dataset 1_base_cae to the current working directory. The second line then runs ZEN-garden on this dataset. Finally, the third line opens the visualization platform, which allows users to explore the results of the model. If the visualization platform does not open automatically, you can open it manually by typing http://localhost:8000/ in any browser of your choice.
Python script¶
The following script can be used to run ZEN-garden in python. This script
is equivalent to the one above except that it uses the Results class for
analyzing the results rather than the visualization platform.
from zen_garden import download_example_dataset, run, Results
# dataset name
dataset = "1_base_case"
# download example dataset to current working directory
download_example_dataset(dataset)
# run ZEN-garden
run(dataset=dataset)
# load results
r = Results(f"./outputs/{dataset}")
# extract optimal capacities
print(r.get_total("capacity"))