Skip to content

Commit

Permalink
Select format from multiple L0 input files
Browse files Browse the repository at this point in the history
The format string was previously selected from the last l0 file.
  • Loading branch information
ladsmund committed Aug 16, 2024
1 parent 70c772f commit 92c4184
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/pypromice/process/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,16 @@ def __init__(
n = write.getColNames(self.vars, l)
self.L0.append(utilities.popCols(l, n))

formats = {dataset.attrs["format"].lower() for dataset in self.L0}
if "raw" in formats:
self.format = "raw"
elif "STM" in formats:
self.format = "STM"
elif "tx" in formats:
self.format = "tx"
else:
raise ValueError(f"Unknown formats from l0 datasets: {','.join(formats)}")

self.L1 = None
self.L1A = None
self.L2 = None
Expand Down Expand Up @@ -109,6 +119,7 @@ def getL1(self):
self.L0 = [utilities.addBasicMeta(item, self.vars) for item in self.L0]
self.L1 = [toL1(item, self.vars) for item in self.L0]
self.L1A = reduce(xr.Dataset.combine_first, reversed(self.L1))
self.L1A.attrs["format"] = self.format

def getL2(self):
"""Perform L1 to L2 data processing"""
Expand Down

0 comments on commit 92c4184

Please sign in to comment.