Skip to content

Commit

Permalink
clean up and testing
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisblake committed Jul 25, 2023
1 parent fe896b0 commit 0d83e8b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 45 deletions.
44 changes: 3 additions & 41 deletions pyaerocom/aeroval/coldatatojson_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 1 addition & 4 deletions pyaerocom/colocation_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 0d83e8b

Please sign in to comment.