Skip to content

Commit

Permalink
Merge pull request #41 from digitalearthpacific/add-simple-area-loggi…
Browse files Browse the repository at this point in the history
…ng-task

Add a simple logging area/task runner
  • Loading branch information
alexgleith authored Jan 3, 2024
2 parents de51856 + c7ed77b commit 7d51a7e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions dep_tools/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,23 @@ def run(self):
self.logger.debug([self.id, "complete", paths])

return paths


class SimpleLoggingAreaTask(AreaTask):
def run(self):
self.logger.info("Preparing to load data")
input_data = self.loader.load(self.area)
self.logger.info(f"Found {len(input_data.time)} timesteps to load")

self.logger.info("Preparing to process data")
processor_kwargs = {}
if self.processor.send_area_to_processor:
processor_kwargs["area"] = self.area
output_data = self.processor.process(input_data, **processor_kwargs)
self.logger.info(f"Processed data will have a result of shape: {[output_data.dims[d] for d in ['x', 'y']]}")

self.logger.info("Processing and writing data...")
paths = self.writer.write(output_data, self.id)
self.logger.info(f"Succesfully wrote data to {len(paths)} paths")

return paths

0 comments on commit 7d51a7e

Please sign in to comment.