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

Refactor and reintroduce diurnal processing #927

Merged
merged 1 commit into from
Oct 16, 2023
Merged
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
31 changes: 31 additions & 0 deletions pyaerocom/aeroval/coldatatojson_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
_process_map_and_scat,
_process_regional_timeseries,
_process_sites,
_process_sites_weekly_ts,
_process_statistics_timeseries,
_write_site_data,
_write_stationdata_json,
add_profile_entry_json,
get_heatmap_filename,
get_json_mapname,
Expand Down Expand Up @@ -206,6 +208,15 @@ def process_coldata(self, coldata: ColocatedData):
stats_min_num=stats_min_num,
use_fairmode=use_fairmode,
)
if coldata.ts_type == "hourly" and use_diurnal:
logger.info("Processing diurnal profiles")
self._process_diurnal_profiles(
coldata=coldata,
regions_how=regions_how,
regnames=regnames,
meta_glob=meta_glob,
out_dirs=out_dirs,
)
else:
logger.info("Processing profile data for vizualization")

Expand Down Expand Up @@ -409,3 +420,23 @@ def _process_stats_timeseries_for_all_regions(

outfile_scat = os.path.join(out_dirs["scat"], map_name)
write_json(scat_data, outfile_scat, ignore_nan=True)

def _process_diurnal_profiles(
self,
coldata: ColocatedData = None,
regions_how: str = "default",
regnames=None,
meta_glob: dict = None,
out_dirs: dict = None,
):
(ts_objs_weekly, ts_objs_weekly_reg) = _process_sites_weekly_ts(
coldata, regions_how, regnames, meta_glob
)
outdir = os.path.join(out_dirs["ts/diurnal"])
for ts_data_weekly in ts_objs_weekly:
# writes json file
_write_stationdata_json(ts_data_weekly, outdir)
if ts_objs_weekly_reg != None:
for ts_data_weekly_reg in ts_objs_weekly_reg:
# writes json file
_write_stationdata_json(ts_data_weekly_reg, outdir)