Skip to content

Commit

Permalink
profile layer limits also included
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisblake committed Jul 11, 2023
1 parent efad233 commit c557370
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions pyaerocom/aeroval/obsentry.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def __init__(self, **kwargs):
self.is_superobs = False
self.only_superobs = False
self.colocation_layer_limts = None
self.profile_layer_limits = None

self.read_opts_ungridded = {}

Expand Down
10 changes: 9 additions & 1 deletion pyaerocom/colocation_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def colocate_vertical_profile_gridded(
use_climatology_ref=False,
resample_how=None,
colocation_layer_limits=None,
profile_layer_limits=None,
**kwargs,
):
"""
Expand Down Expand Up @@ -93,7 +94,11 @@ def colocate_vertical_profile_gridded(

if not all(["start" and "end" in keys for keys in colocation_layer_limits]):
raise KeyError(
"start and end must be provided for each vertical layer in colocate_vertical_profile_gridded"
"start and end must be provided for colocation in each vertical layer in colocate_vertical_profile_gridded"
)
if not all(["start" and "end" in keys for keys in profile_layer_limits]):
raise KeyError(
"start and end must be provided for displaying profiles in each vertical layer in colocate_vertical_profile_gridded"
)

dataset_ref = data_ref.contains_datasets[0]
Expand Down Expand Up @@ -259,6 +264,9 @@ def colocate_vertical_profile_gridded(

# Make a copy of the station data and resample it to the mean based on hourly resolution. Needs testing!
tmp_obs_stat = obs_stat.copy()
# add the station altitude to the altitudes so everything is against Above Sea Level (ASL)
tmp_obs_stat.altitude += tmp_obs_stat.station_coords["altitude"]

tmp_obs_stat[var_ref] = (
tmp_obs_stat[var_ref][
(vertical_layer["start"] <= tmp_obs_stat.altitude)
Expand Down
4 changes: 3 additions & 1 deletion pyaerocom/colocation_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ def __init__(
self.obs_filters = {}
self._obs_is_vertical_profile = False
self.colocation_layer_limits = None
self.profile_layer_limits = None

self.read_opts_ungridded = {}

Expand Down Expand Up @@ -1417,7 +1418,8 @@ def _prepare_colocation_args(self, model_var: str, obs_var: str):
ts_type = self._get_colocation_ts_type(model_data.ts_type, obs_data.ts_type)
args.update(ts_type=ts_type)
if self.obs_is_vertical_profile:
args.update(colocation_layer_limits=self.colocation_layer_limits)
args.update(colocation_layer_limits=self.colocation_layer_limits,
profile_layer_limits=self.profile_layer_limits)
return args

def _check_dimensionality(self, args):
Expand Down

0 comments on commit c557370

Please sign in to comment.