Skip to content

Commit 4ca0635

Browse files
committed
fix for summary plots plus missing vars
1 parent 261b4f8 commit 4ca0635

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

ctd_comp_plots.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ def comp_plot(glider, ctd):
4141
fig, ax = plt.subplots(2, 2, figsize=(16, 12), sharey="row",)
4242
ax = ax.ravel()
4343
for i, variable in enumerate(("temperature", "salinity", "oxygen_concentration", "chlorophyll")):
44+
if variable not in list(glider) or variable not in list(ctd):
45+
continue
4446
if variable == "oxygen_concentration":
4547
cutoff = 9
4648
else:
@@ -137,7 +139,7 @@ def download_glider_datasets(dataset_ids):
137139
return dataset_dict
138140

139141

140-
def recent_ctds(df_relevant, df_ctd):
142+
def recent_ctds(df_relevant, df_ctd, summary=False):
141143
_log.info("start to process all recent CTDs")
142144
ctd_casts = df_ctd.groupby("cast_no").first()
143145
mintime = ctd_casts.time.min().replace(tzinfo=pytz.utc) - datetime.timedelta(days=1)
@@ -162,7 +164,9 @@ def recent_ctds(df_relevant, df_ctd):
162164
df_relevant = df_relevant.sort_values('minTime (UTC)')
163165
nrt_dict = download_glider_datasets(df_relevant.index)
164166
i = 0
165-
summary_plot(df_relevant, ctd_casts, nrt_dict, df_ctd)
167+
if summary:
168+
summary_plot(df_relevant, ctd_casts, nrt_dict, df_ctd)
169+
return
166170
for mission, ds in nrt_dict.items():
167171
_log.info(f"process: {mission}")
168172
try:
@@ -225,5 +229,6 @@ def summary_plot(df_relevant, ctd_casts, nrt_dict, df_ctd):
225229
df_ctd_table.index = df_ctd_table["time"]
226230
df_ctd = df_ctd_table.sort_index()
227231
recent_ctds(recent_datasets, df_ctd)
232+
recent_ctds(df_datasets, df_ctd, summary=True)
228233
_log.info("completed process all CTDs")
229234

0 commit comments

Comments
 (0)