Skip to content

Commit

Permalink
Updated file paths in run_ogcore_example.py
Browse files Browse the repository at this point in the history
  • Loading branch information
rickecon committed Aug 24, 2024
1 parent 0b420f0 commit 4dc4868
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions run_examples/run_ogcore_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from ogcore.utils import safe_read_pickle
import matplotlib.pyplot as plt

# Use a custom matplotlib style file for plots
style_file_url = (
"https://raw.githubusercontent.com/PSLmodels/OG-Core/"
+ "master/ogcore/OGcorePlots.mplstyle"
Expand All @@ -28,12 +29,15 @@ def main():
num_workers = min(multiprocessing.cpu_count(), 7)
print("Number of workers = ", num_workers)
client = Client(n_workers=num_workers, threads_per_worker=1)
run_start_time = time.time()

# Directories to save data
CUR_DIR = os.path.dirname(os.path.realpath(__file__))
base_dir = os.path.join(CUR_DIR, BASELINE_DIR)
reform_dir = os.path.join(CUR_DIR, REFORM_DIR)
save_dir = os.path.join(CUR_DIR, "OG-Core-Example")
base_dir = os.path.join(save_dir, "OUTPUT_BASELINE")
reform_dir = os.path.join(save_dir, "OUTPUT_REFORM")

# Start timer on overall run time: baseline + reform
run_start_time = time.time()

# Set some OG model parameters
# See default_parameters.json for more description of these parameters
Expand Down Expand Up @@ -121,13 +125,13 @@ def main():

# create plots of output
op.plot_all(
base_dir, reform_dir, os.path.join(CUR_DIR, "run_example_plots")
base_dir, reform_dir, os.path.join(save_dir, "OG-Core_example_plots")
)

print("total time was ", (time.time() - run_start_time))
print("Percentage changes in aggregates:", ans)
# save percentage change output to csv file
ans.to_csv(os.path.join(CUR_DIR, "ogcore_example_output.csv"))
ans.to_csv(os.path.join(save_dir, "OG-Core_example_output.csv"))
client.close()


Expand Down

0 comments on commit 4dc4868

Please sign in to comment.