pyaerocom icon indicating copy to clipboard operation
pyaerocom copied to clipboard

use_meteorological_seasons has no effect on diurnal statistics

Open charlienegri opened this issue 5 months ago • 1 comments

use_meteorological_seasons plays a role only in the computations that make use of _select_period_season_coldata

since the diurnal statistics are computed in a way that never makes use of this function, this means that at the moment use_meteorological_seasons has no effect on them, whatever its value.

unclear if this should be changed or not, it is relevant only for experiments that

  • have use_diurnal=True
  • span more than one year

but if so use_meteorological_seasons should be passed to create_diurnal_weekly_data_object, and new logic needs to be coded into this function.

the relevant code is:

for yr in yearkeys:
        data = data_allyears.where(data_allyears["time.year"] == yr, drop=True)
        for seas in seasons:
            rep_week_ds = xr.Dataset()
            if resolution == "seasonal":
                mon_slice = data.where(data["time.season"] == seas, drop=True)
            elif resolution == "yearly":
                mon_slice = data

so there is a loop on years and a nested loop on seasons, which means that at the moment for a given year data_allyears.where(data_allyears["time.year"] == yr, drop=True) will cut out the D relevant for DJF of that year if the intention is use_meteorological_seasons = True

charlienegri avatar Jul 03 '25 06:07 charlienegri

As of now I don't think this is a major issue. Very few situations require multiyear evaluations with hourly. The EMEP reader even has a check that raises an error if one ask it to read multiple years.

Of course we might want to add the possibility for multiple years, hourly. So let's keep this open, and discuss later if this is something we want

dulte avatar Jul 08 '25 09:07 dulte