Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix aerovaldb profiles arguments issue #1317

Merged
merged 1 commit into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions pyaerocom/aeroval/coldatatojson_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@
station_names=coldata.data.station_name.values,
periods=periods,
seasons=seasons,
obs_name=obs_name,
var_name_web=var_name_web,
)

logger.info(
Expand Down Expand Up @@ -276,6 +278,8 @@
station_names: ArrayLike = None,
periods: tuple[str, ...] = None,
seasons: tuple[str, ...] = None,
obs_name: str = None,
var_name_web: str = None,
):
if region_names is None and station_names is None:
raise ValueError("Both region_id and station_name can not both be None")
Expand All @@ -289,8 +293,16 @@
periods=periods,
seasons=seasons,
)

self.exp_output.add_profile_entry(data, profile_viz, periods, seasons)
location = region_names[regid]
self.exp_output.add_profile_entry(

Check warning on line 297 in pyaerocom/aeroval/coldatatojson_engine.py

View check run for this annotation

Codecov / codecov/patch

pyaerocom/aeroval/coldatatojson_engine.py#L296-L297

Added lines #L296 - L297 were not covered by tests
data,
profile_viz,
periods,
seasons,
location=location,
network=obs_name,
obsvar=var_name_web,
)

# Loop through stations
for station_name in station_names:
Expand All @@ -302,7 +314,15 @@
seasons=seasons,
)

self.exp_output.add_profile_entry(data, profile_viz, periods, seasons)
self.exp_output.add_profile_entry(

Check warning on line 317 in pyaerocom/aeroval/coldatatojson_engine.py

View check run for this annotation

Codecov / codecov/patch

pyaerocom/aeroval/coldatatojson_engine.py#L317

Added line #L317 was not covered by tests
data,
profile_viz,
periods,
seasons,
location=station_name,
network=obs_name,
obsvar=var_name_web,
)

def _process_stats_timeseries_for_all_regions(
self,
Expand Down
15 changes: 12 additions & 3 deletions pyaerocom/aeroval/experiment_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,14 @@
)

def add_profile_entry(
self, data: ColocatedData, profile_viz: dict, periods: list[str], seasons: list[str]
self,
data: ColocatedData,
profile_viz: dict,
periods: list[str],
seasons: list[str],
location,
network,
obsvar,
):
"""Adds an entry for the colocated data to profiles.json.

Expand All @@ -1041,7 +1048,9 @@
seasons (list[str]): seasons to compute over (e.g., All, DJF, etc.)
"""
with self.avdb.lock():
current = self.avdb.get_profiles(self.proj_id, self.exp_id, default={})
current = self.avdb.get_profiles(

Check warning on line 1051 in pyaerocom/aeroval/experiment_output.py

View check run for this annotation

Codecov / codecov/patch

pyaerocom/aeroval/experiment_output.py#L1051

Added line #L1051 was not covered by tests
self.proj_id, self.exp_id, location, network, obsvar, default={}
)
current = recursive_defaultdict(current)

for freq, coldata in data.items():
Expand Down Expand Up @@ -1084,4 +1093,4 @@
}
current[model_name] = round_floats(current[model_name])

self.avdb.put_profiles(current, self.proj_id, self.exp_id)
self.avdb.put_profiles(current, self.proj_id, self.exp_id, location, network, obsvar)

Check warning on line 1096 in pyaerocom/aeroval/experiment_output.py

View check run for this annotation

Codecov / codecov/patch

pyaerocom/aeroval/experiment_output.py#L1096

Added line #L1096 was not covered by tests
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ classifiers = [
]
requires-python = ">=3.10"
dependencies = [
"aerovaldb == 0.0.15",
"aerovaldb==0.0.17",
"scitools-iris>=3.8.1",
"xarray>=2022.12.0",
"cartopy>=0.21.1",
Expand Down