Skip to content

Commit

Permalink
Use calibration API to fetch time offset information
Browse files Browse the repository at this point in the history
  • Loading branch information
tukiains committed Oct 3, 2024
1 parent daf736f commit fcd3be8
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/processing/instrument_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,8 @@ def process_cl31(self):
self._call_ceilo2nc("cl31")

def process_cl51(self):
if self.params.site.id == "norunda":
calibration = fetch_calibration(self.params.instrument.pid, self.params.date)
if calibration and calibration.get("data", {}).get("time_offset"):
(
full_paths,
self.uuid.raw,
Expand All @@ -386,11 +387,9 @@ def process_cl51(self):
) = self.download_instrument()
full_paths.sort()
_concatenate_text_files(full_paths, str(self.daily_path))
if self.params.site.id == "norunda" and self.params.date < datetime.date(
2021, 10, 18
):
if calibration and calibration.get("data", {}).get("time_offset"):
logging.info("Shifting timestamps to UTC")
offset_in_hours = -1
offset_in_hours = round(calibration["data"]["time_offset"] / 60)
_fix_cl51_timestamps(str(self.daily_path), offset_in_hours)
self._call_ceilo2nc("cl51")

Expand Down Expand Up @@ -581,7 +580,9 @@ def process_weather_station(self):
)
if self.params.site.id not in supported_sites:
raise NotImplementedError("Weather station not implemented for this site")
if self.params.site.id in ("kenttarova", "bucharest"):

calibration = fetch_calibration(self.params.instrument.pid, self.params.date)
if calibration and calibration.get("data", {}).get("time_offset"):
(full_paths, self.uuid.raw) = self.processor.download_adjoining_daily_files(
self.params, self.raw_dir
)
Expand Down

0 comments on commit fcd3be8

Please sign in to comment.