Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
b8raoult committed Nov 23, 2024
1 parent 80f65ec commit 52121bb
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 18 deletions.
11 changes: 1 addition & 10 deletions src/ai_models/inputs/interpolate.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,7 @@ def __call__(self, ds):
result = []
for f in tqdm.tqdm(ds, delay=0.5, desc="Interpolating", leave=False):
data = ekr.interpolate(f.to_numpy(), dict(grid=self.source), dict(grid=self.grid))
template = f

if self._reduced_gg:
# template is missing the pl matrix required to output a reduced_gg grib
# this is a hack to let earthkit generate it for us
template = None
keys = ("shortName", "levelist", "date", "time", "step", "number")
self.metadata.update({key: f._metadata[key] for key in keys if key in f._metadata})

out.write(data, template=template, **self.metadata)
out.write(data, template=f, **self.metadata)

out.close()

Expand Down
6 changes: 1 addition & 5 deletions src/ai_models/inputs/opendata.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@

LOG = logging.getLogger(__name__)

CONSTANTS = (
"z",
"sdor",
"slor",
)
CONSTANTS = ("z", "sdor", "slor")

CONSTANTS_URL = "https://get.ecmwf.int/repository/test-data/ai-models/opendata/constants-{resol}.grib2"

Expand Down
3 changes: 0 additions & 3 deletions src/ai_models/outputs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ def output(self):

def write(self, data, *args, check=False, **kwargs):

if kwargs.get("param") in ("cp", "tp"):
kwargs["edition"] = 1

try:
handle, path = self.output.write(data, *args, **kwargs)

Expand Down

0 comments on commit 52121bb

Please sign in to comment.