Skip to content

Commit

Permalink
edits following review
Browse files Browse the repository at this point in the history
  • Loading branch information
nfarabullini committed Dec 6, 2024
1 parent d73e4f4 commit 2c18429
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
7 changes: 1 addition & 6 deletions model/common/src/icon4py/model/common/grid/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,7 @@ def offset_providers(self):

@utils.chainable
def with_connectivities(self, connectivity: Dict[gtx.Dimension, field_alloc.NDArray]):
self.connectivities.update(
{
d: k.ndarray.astype(gtx.int32) if hasattr(k, "ndarray") else k.astype(gtx.int32)
for d, k in connectivity.items()
}
)
self.connectivities.update({d: k.astype(gtx.int32) for d, k in connectivity.items()})
self.size.update({d: t.shape[1] for d, t in connectivity.items()})

@utils.chainable
Expand Down
18 changes: 5 additions & 13 deletions model/common/src/icon4py/model/common/grid/icon.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
from typing import Final

import gt4py.next as gtx
import numpy as np

from icon4py.model.common import constants, dimension as dims, utils
from icon4py.model.common.grid import base, horizontal as h_grid
from icon4py.model.common.utils import gt4py_field_allocation as field_alloc


log = logging.getLogger(__name__)
Expand Down Expand Up @@ -129,20 +129,12 @@ def __eq__(self, other: "IconGrid"):
def with_start_end_indices(
self,
dim: gtx.Dimension,
start_indices: field_alloc.NDArray,
end_indices: field_alloc.NDArray,
start_indices: np.ndarray,
end_indices: np.ndarray,
):
log.debug(f"Using start_indices {dim} {start_indices}, end_indices {dim} {end_indices}")
self._start_indices[dim] = (
start_indices.ndarray.astype(gtx.int32)
if hasattr(start_indices, "ndarray")
else start_indices.astype(gtx.int32)
)
self._end_indices[dim] = (
end_indices.ndarray.astype(gtx.int32)
if hasattr(end_indices, "ndarray")
else end_indices.astype(gtx.int32)
)
self._start_indices[dim] = start_indices.astype(gtx.int32)
self._end_indices[dim] = end_indices.astype(gtx.int32)

@utils.chainable
def with_global_params(self, global_params: GlobalGridParams):
Expand Down

0 comments on commit 2c18429

Please sign in to comment.