diff --git a/bgcval2/timeseries/timeseriesAnalysis.py b/bgcval2/timeseries/timeseriesAnalysis.py index c064cab8..33ff2bb4 100644 --- a/bgcval2/timeseries/timeseriesAnalysis.py +++ b/bgcval2/timeseries/timeseriesAnalysis.py @@ -272,6 +272,7 @@ def loadModel(self): self.modeldetails, regions=self.regions, layers=self.layers, + modeldataD=self.modeldataD, ) for l in self.layers: diff --git a/bgcval2/timeseries/timeseriesTools.py b/bgcval2/timeseries/timeseriesTools.py index 280f6fc9..6dfbd439 100644 --- a/bgcval2/timeseries/timeseriesTools.py +++ b/bgcval2/timeseries/timeseriesTools.py @@ -267,6 +267,9 @@ def __init__(self, layers=[ 'Surface', ], + modeldataD = {}, + metrics = ['mean', ], + meantime = 0, data=''): self.fn = fn if type(nc) == type('filename'): @@ -276,6 +279,9 @@ def __init__(self, self.details = details self.regions = regions self.layers = layers + self.metrics = metrics + self.modeldataD = modeldataD + self.meantime = meantime self.name = self.details['name'] if data == '': data = std_extractData(nc, self.details) self.Fulldata = data @@ -294,7 +300,7 @@ def run(self): depths = {} lays = self.layers[:] lays.reverse() - + for l in lays: try: layer = int(l) @@ -317,6 +323,15 @@ def run(self): continue for region in self.regions: + loadthisregion = 0 + for m in metrics: + if self.modeldataD.get((r, l, m), False) and self.meantime in modeldataD[(r, l, m)]: + # Data arra already exists and This time point's data already exists + continue + # This region does not exist in the processed data, so add it. + loadthisregion +=1 + if loadthisregion == 0: + continue arr, arr_t, arr_z, arr_lat, arr_lon = self.createDataArray( region, layer) if len(arr) == 0: