Skip to content

Commit

Permalink
Clean up expression and where parsers
Browse files Browse the repository at this point in the history
  • Loading branch information
brynpickering committed Oct 26, 2023
1 parent 3537c52 commit fd57332
Show file tree
Hide file tree
Showing 12 changed files with 527 additions and 735 deletions.
8 changes: 3 additions & 5 deletions src/calliope/backend/backend_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,7 @@ def _add_component(
)

top_level_where = parsed_component.generate_top_level_where_array(
self.inputs,
self._dataset,
self,
align_to_foreach_sets=False,
break_early=break_early,
)
Expand All @@ -297,9 +296,7 @@ def _add_component(
.astype(np.dtype("O"))
)
for element in equations:
where = element.evaluate_where(
self.inputs, self._dataset, initial_where=top_level_where
)
where = element.evaluate_where(self, initial_where=top_level_where)
if break_early and not where.any():
continue

Expand Down Expand Up @@ -462,6 +459,7 @@ def _apply_func(
kwargs=kwargs,
vectorize=True,
keep_attrs=True,
dask="parallelized",
output_dtypes=[np.dtype("O")],
output_core_dims=output_core_dims,
)
Expand Down
Loading

0 comments on commit fd57332

Please sign in to comment.