Skip to content

Commit

Permalink
update archiveType logic in ensgeoseries
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkjames committed Jul 19, 2024
1 parent a09cc2e commit d549558
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions pyleoclim/core/ensemblegeoseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

import warnings

from collections import Counter

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
Expand Down Expand Up @@ -86,6 +88,19 @@ def __init__(self, series_list,label=None,lat=None,lon=None,elevation=None,archi

super().__init__(series_list,label)

# Assign archiveType if it isn't passed and it is present in all series in series_list
if archiveType is None:
if not all([isinstance(ts, GeoSeries) for ts in series_list]):
pass
else:
archiveList = [str(ts.archiveType) for ts in series_list]
#Check that they're all the same
if all([a == archiveList[0] for a in archiveList]):
archiveType = archiveList[0]
#If they aren't, pick the most common one
else:
archiveType = Counter(archiveList).most_common(1)[0][0]

if lat is None:
# check that all components are GeoSeries
if not all([isinstance(ts, GeoSeries) for ts in series_list]):
Expand Down Expand Up @@ -614,13 +629,13 @@ def dashboard(self, figsize=[11, 8], gs=None, plt_kwargs=None, histplt_kwargs=No
plt_kwargs.update({'ax': ax['ts']})
# use the defaults if color/markers not specified

if self.series_list[0].archiveType is not None:
archiveType = lipdutils.LipdToOntology(self.series_list[0].archiveType)
if self.archiveType is not None:
archiveType = lipdutils.LipdToOntology(self.archiveType)
if archiveType not in lipdutils.PLOT_DEFAULT.keys():
print(archiveType)
archiveType = 'Other'
else:
archiveType = 'Other'

# if 'marker' not in plt_kwargs.keys():
# plt_kwargs.update({'marker': lipdutils.PLOT_DEFAULT[archiveType][1]})
if 'curve_clr' not in plt_kwargs.keys():
Expand Down

0 comments on commit d549558

Please sign in to comment.