From 0d83e8b0e94cf1f895303fb2f5573bf4f8108db8 Mon Sep 17 00:00:00 2001 From: lewisblake Date: Tue, 25 Jul 2023 08:20:40 +0000 Subject: [PATCH] clean up and testing --- pyaerocom/aeroval/coldatatojson_helpers.py | 44 ++-------------------- pyaerocom/colocation_auto.py | 5 +-- 2 files changed, 4 insertions(+), 45 deletions(-) diff --git a/pyaerocom/aeroval/coldatatojson_helpers.py b/pyaerocom/aeroval/coldatatojson_helpers.py index 138fb2800..9a59d317e 100644 --- a/pyaerocom/aeroval/coldatatojson_helpers.py +++ b/pyaerocom/aeroval/coldatatojson_helpers.py @@ -1401,53 +1401,15 @@ def process_profile_data( all_stations_subset = _select_period_season_coldata(coldata, per, season) station_subset = all_stations_subset.data[ :, :, all_stations_subset.data.station_name.values == station_name - ] - # subset = _select_period_season_coldata(coldata, per, season) - - # trends_successful = False - # if add_trends and freq != "daily": - # Calculates the start and stop years. min_yrs have a test value of 7 years. Should be set in cfg - # (start, stop) = _get_min_max_year_periods([per]) - - # if stop - start >= trends_min_yrs: - # try: - # subset_time_series = subset.get_regional_timeseries( - # region_id, check_country_meta=use_country - # ) - - # (obs_trend, mod_trend) = _make_trends_from_timeseries( - # subset_time_series["obs"], - # subset_time_series["mod"], - # freq, - # season, - # start, - # stop, - # trends_min_yrs, - # ) - - # trends_successful = True - - # output["obs"][freq][perstr] = np.nanmean(subset_time_series["obs"]) - # output["mod"][freq][perstr] = np.nanmean(subset_time_series["mod"]) + ] # LB: Assumes ordering of station name matches + output["obs"][freq][perstr] = np.nanmean(station_subset.data[0, :, :]) output["mod"][freq][perstr] = np.nanmean(station_subset.data[1, :, :]) + except: msg = f"Failed to access subset timeseries, and will skip." logger.warning(msg) - # LB: I think this should be not needed and covered in the time series above but probably need to double check that - # subset = subset.filter_region( - # region_id=regid, check_country_meta=use_country - # ) - - # stats = _get_extended_stats(subset, use_weights) - - # if add_trends and freq != "daily" and trends_successful: - # # The whole trends dicts are placed in the stats dict - # stats["obs_trend"] = obs_trend - # stats["mod_trend"] = mod_trend - - # except (DataCoverageError, TemporalResolutionError) as e: output["obs"][freq][perstr] = np.nan output["mod"][freq][perstr] = np.nan diff --git a/pyaerocom/colocation_auto.py b/pyaerocom/colocation_auto.py index 076db379c..018a873d2 100644 --- a/pyaerocom/colocation_auto.py +++ b/pyaerocom/colocation_auto.py @@ -1477,10 +1477,7 @@ def _run_helper(self, model_var: str, obs_var: str): if self.save_coldata: self._save_coldata(coldata) - elif isinstance( - coldata, ColocatedDataLists - ): # LB: coming out of here the colocated data objects have the same values, which they should not - breakpoint() + elif isinstance(coldata, ColocatedDataLists): for i_list in coldata: for coldata_obj in i_list: coldata_obj.data.attrs["model_name"] = self.get_model_name()