Skip to content

Commit 2390436

Browse files
Deployment 28. More logging added to app.py.
1 parent 5ac030c commit 2390436

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

dash_app/app.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,9 @@ def map(year, ssp, tech, subtech, feature, is_ccs, coolingtype, capacity_factor,
218218
tab_id, layer_catalogue
219219
):
220220

221-
start = time.time()
221+
logger.info(f"Map callback initiated.")
222+
223+
# start = time.time()
222224
year = str(year)
223225
query_df = tech_pathways_df.query("ui_ssp in @ssp and \
224226
ui_year in @year and \
@@ -233,15 +235,16 @@ def map(year, ssp, tech, subtech, feature, is_ccs, coolingtype, capacity_factor,
233235
row = query_df.iloc[0]
234236
cols = ['ssp', 'ui_year', 'tech', 'subtype', 'feature', 'is_ccs', 'cooling_type', 'cap_factor']
235237
result_string = "_".join(str(row[col]) for col in cols)
236-
237-
print(f"{ZARRPATH}/{result_string}")
238+
239+
logger.info(f"Zarr path. {ZARRPATH}/{result_string}")
238240
store = s3.get_mapper(f"{ZARRPATH}/{result_string}") # reading from the cloud adds two seconds (hopefully this speeds up)
241+
logger.info(f"Read in zarr data. {store}")
239242
ds = xr.open_zarr(store) # had to remove consolidated=True, but otherwise works
240243
# folder_path = f"{ZARRPATH}/{result_string}"
241244
# ds = xr.open_zarr(folder_path)
242245
df = ds.to_dataframe()
243-
end = time.time()
244-
print(end-start)
246+
# end = time.time()
247+
# print(end-start)
245248

246249
if btn_text == "button2": # dark
247250
styling_dict = {"land": [48, 105, 59],
@@ -259,7 +262,7 @@ def map(year, ssp, tech, subtech, feature, is_ccs, coolingtype, capacity_factor,
259262
if ctx.triggered:
260263
fig_div = plot_map(df_coors_long=df, fpaths=fpaths, styling_dict=styling_dict) # takes 2.6 seconds
261264
mapped_time = time.time()
262-
print("Plot Map: ", mapped_time-start)
265+
logger.info(f"Map created.")
263266

264267
return fig_div
265268

dash_app/definitions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
if CONNECT_TO_LAMBDA:
3838

39-
print("DEPLOYMENT 26")
39+
print("DEPLOYMENT 28")
4040

4141
SERVE_LOCALLY = False
4242

0 commit comments

Comments
 (0)