Skip to content

Commit

Permalink
start and end times represent now the correct time step size
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Jurgen Griesfeller committed Jan 2, 2024
1 parent 7d10049 commit 6c28e13
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
13 changes: 11 additions & 2 deletions src/pyaro_readers/aeronetsdareader/AeronetSdaTimeseriesReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@

FILE_MASK = "*.ONEILL_lev*"

TS_TYPE_DIFFS = {
"daily": np.timedelta64(12, "h"),
"instantaneous": np.timedelta64(0, "s"),
"points": np.timedelta64(0, "s"),
"monthly": np.timedelta64(15, "D"),
}


class AeronetSdaTimeseriesReader(AutoFilterReaderEngine.AutoFilterReader):
def __init__(
Expand All @@ -67,6 +74,7 @@ def __init__(
filters=[],
fill_country_flag: bool = FILL_COUNTRY_FLAG,
tqdm_desc: [str, None] = None,
ts_type: str = "daily",
):
"""open a new csv timeseries-reader
Expand Down Expand Up @@ -209,8 +217,9 @@ def __init__(
day, month, year = row[DATE_NAME].split(":")
datestring = "-".join([year, month, day])
datestring = "T".join([datestring, row[TIME_NAME]])
start = np.datetime64(datestring)
end = start
time_dummy = np.datetime64(datestring)
start = time_dummy - TS_TYPE_DIFFS[ts_type]
end = time_dummy + TS_TYPE_DIFFS[ts_type]

ts_dummy_data = {}
for variable in DATA_VARS:
Expand Down
17 changes: 13 additions & 4 deletions src/pyaro_readers/aeronetsunreader/AeronetSunTimeseriesReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@

FILL_COUNTRY_FLAG = False

TS_TYPE_DIFFS = {
"daily": np.timedelta64(12, "h"),
"instantaneous": np.timedelta64(0, "s"),
"points": np.timedelta64(0, "s"),
"monthly": np.timedelta64(15, "D"),
}


class AeronetSunTimeseriesReader(AutoFilterReaderEngine.AutoFilterReader):
def __init__(
Expand All @@ -56,16 +63,17 @@ def __init__(
filters=[],
fill_country_flag: bool = FILL_COUNTRY_FLAG,
tqdm_desc: [str, None] = None,
ts_type: str = "daily",
):
"""open a new csv timeseries-reader
"""open a new Aeronet timeseries-reader
:param filename: str
:param filters:
:param fill_country_flag:
:param tqdm_desc:
:param filename_or_obj_or_url: path-like object to csv-file
input file looks like this:
input file looks like this (daily file; times noted are middle times):
AERONET Version 3;
Cuiaba
Version 3: AOD Level 2.0
Expand Down Expand Up @@ -157,8 +165,9 @@ def __init__(
day, month, year = row[DATE_NAME].split(":")
datestring = "-".join([year, month, day])
datestring = "T".join([datestring, row[TIME_NAME]])
start = np.datetime64(datestring)
end = start
time_dummy = np.datetime64(datestring)
start = time_dummy - TS_TYPE_DIFFS[ts_type]
end = time_dummy + TS_TYPE_DIFFS[ts_type]

ts_dummy_data = {}
for variable in DATA_VARS:
Expand Down

0 comments on commit 6c28e13

Please sign in to comment.