Skip to content

Commit

Permalink
fix to make daily files read correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Jurgen Griesfeller committed Aug 14, 2023
1 parent a216c5f commit a0056af
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pyaerocom/io/read_eea_aqerep_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ReadEEAAQEREPBase(ReadUngriddedBase):
"""

#: Mask for identifying datafiles
_FILEMASK = "*.csv"
_FILEMASK = "NO*.csv"

#: Version log of this class (for caching)
__version__ = "0.08"
Expand Down Expand Up @@ -410,8 +410,9 @@ def read_file(self, filename, var_name, vars_as_series=False):
# time interpolations later on. Make sure that the data is ordered in time
diff_unsorted = np.diff(data_dict[self.START_TIME_NAME])
sort_flag = False
# just assume hourly data for now
time_diff = np.timedelta64(30, "m")
# use a vectorised time_diff instead of scalar one as before
time_diff = (data_dict[self.END_TIME_NAME][:lineidx]-data_dict[self.START_TIME_NAME][:lineidx]) / 2.

# np.min needs an array and fails with ValueError when a scalar is supplied
# this is the case for a single line file
try:
Expand All @@ -422,7 +423,7 @@ def read_file(self, filename, var_name, vars_as_series=False):
if min_diff < 0:
# data needs to be sorted
ordered_idx = np.argsort(data_dict[self.START_TIME_NAME][:lineidx])
data_out["dtime"] = data_dict[self.START_TIME_NAME][ordered_idx] + time_diff
data_out["dtime"] = data_dict[self.START_TIME_NAME][ordered_idx] + time_diff[ordered_idx]
sort_flag = True
else:
data_out["dtime"] = data_dict[self.START_TIME_NAME][:lineidx] + time_diff
Expand Down

0 comments on commit a0056af

Please sign in to comment.