Skip to content

Commit

Permalink
Fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
tehrengruber committed Feb 1, 2024
1 parent 158ab1f commit a951b82
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
24 changes: 12 additions & 12 deletions model/common/src/icon4py/model/common/grid/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,18 @@ def num_edges(self) -> int:
def num_levels(self) -> int:
pass

@cached_property
def offset_providers(self):
offset_providers = {}
for key, value in self.offset_provider_mapping.items():
try:
method, *args = value
offset_providers[key] = method(*args) if args else method()
except MissingConnectivity:
warnings.warn(f"{key} connectivity is missing from grid.", stacklevel=2)

return offset_providers

@builder
def with_connectivities(self, connectivity: Dict[Dimension, np.ndarray]):
self.connectivities.update({d: k.astype(int) for d, k in connectivity.items()})
Expand Down Expand Up @@ -123,17 +135,5 @@ def get_offset_provider(self, name):
else:
raise Exception(f"Offset provider for {name} not found.")

@cached_property
def offset_providers(self):
offset_providers = {}
for key, value in self.offset_provider_mapping.items():
try:
method, *args = value
offset_providers[key] = method(*args) if args else method()
except MissingConnectivity:
warnings.warn(f"{key} connectivity is missing from grid.", stacklevel=2)

return offset_providers

def update_size_connectivities(self, new_sizes):
self.size.update(new_sizes)
4 changes: 2 additions & 2 deletions model/common/src/icon4py/model/common/test_utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def _test_validation(self, grid, backend, input_data):

self.PROGRAM.with_backend(backend)(
**input_data,
offset_provider=grid.offset_providers(),
offset_provider=grid.offset_providers,
)
for out in self.OUTPUTS:
name, refslice, gtslice = (
Expand All @@ -195,7 +195,7 @@ def _test_execution_benchmark(self, pytestconfig, grid, backend, input_data, ben
benchmark(
self.PROGRAM.with_backend(backend),
**input_data,
offset_provider=grid.get_all_offset_providers(),
offset_provider=grid.offset_providers,
)

else:
Expand Down

0 comments on commit a951b82

Please sign in to comment.