Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Commit

Permalink
wip build zarr
Browse files Browse the repository at this point in the history
  • Loading branch information
floriankrb committed Feb 14, 2024
2 parents 6fe8a50 + 4951f96 commit 0c9cb16
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ecml_tools/create/functions/accumulations.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def accumulations(context, dates, **request):
r = normalise_time_to_hours(r)

if DEBUG:
print(f"load_source({source_name}, {r}")
print(f"load_source({source_name}, {r}")
ds = ds + load_source(source_name, **r)
return ds

Expand Down
4 changes: 3 additions & 1 deletion ecml_tools/create/functions/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@ def normalise_time_to_hours(r):


def constants(context, dates, **request):
param = request["param"]

template = get_template_field(request)

print(f"✅ load_source(constants, {template}, {request}")
return load_source("constants", source_or_dataset=template, **request)
return load_source("constants", source_or_dataset=template, date=dates, param=param)


execute = constants
Expand Down
4 changes: 4 additions & 0 deletions ecml_tools/create/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ def _build_coords(self):
assert isinstance(self.owner.context, Context), type(self.owner.context)
assert isinstance(self.owner, Result), type(self.owner)
assert hasattr(self.owner, "context"), self.owner
assert hasattr(self.owner, "datasource"), self.owner
assert hasattr(self.owner, "get_cube"), self.owner
self.owner.datasource

from_data = self.owner.get_cube().user_coords
from_config = self.owner.context.order_by
Expand Down Expand Up @@ -423,6 +425,7 @@ def __repr__(self):


def import_function(name):
name = name.replace("-", "_")
here = os.path.dirname(__file__)
path = os.path.join(here, "functions", f"{name}.py")
spec = importlib.util.spec_from_file_location(name, path)
Expand All @@ -434,6 +437,7 @@ def import_function(name):


def is_function(name):
name = name.replace("-", "_")
here = os.path.dirname(__file__)
path = os.path.join(here, "functions", f"{name}.py")
return os.path.exists(path)
Expand Down
2 changes: 1 addition & 1 deletion ecml_tools/create/loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def __init__(self, config, **kwargs):

self.groups = build_groups(*self.main_config.loop)
print("✅ GROUPS")
print(self.groups, self.main_config.loop)
# print(self.groups, self.main_config.loop)

self.output = build_output(self.main_config.output, parent=self)
self.input = self.build_input()
Expand Down

0 comments on commit 0c9cb16

Please sign in to comment.