Skip to content

Commit

Permalink
tests fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nfarabullini committed Dec 6, 2024
1 parent 5f0bd7e commit 66fafb5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
16 changes: 7 additions & 9 deletions model/common/src/icon4py/model/common/test_utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,13 @@ def zero_field(
extend: Optional[dict[gt_common.Dimension, int]] = None,
backend=None,
) -> gt_common.Field:
field_domain = {
dim: (
0,
grid.size[dim] + extend[dim]
if (extend is not None) and (dim in extend.keys())
else grid.size[dim],
)
for dim in dims
}
if extend is not None:
field_domain = {
dim: (0, grid.size[dim] + extend[dim] if dim in extend.keys() else grid.size[dim])
for dim in dims
}
else:
field_domain = {dim: (0, grid.size[dim]) for dim in dims}
return constructors.zeros(field_domain, dtype=dtype, allocator=backend)


Expand Down
2 changes: 1 addition & 1 deletion tools/src/icon4pytools/py2fgen/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ class PythonWrapperGenerator(TemplatedGenerator):
{% if _this_node.backend == 'GPU' %}import cupy as cp {% endif %}
from numpy.typing import NDArray
from gt4py.next.iterator.embedded import np_as_located_field
from icon4pytools.py2fgen.settings.config
from icon4pytools.py2fgen.settings import config
xp = config.array_ns
from icon4py.model.common import dimension as dims
Expand Down
2 changes: 1 addition & 1 deletion tools/src/icon4pytools/py2fgen/wrappers/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def construct_icon_grid(
e2c2e = adjust_fortran_indices(e2c2e, offset)

# stacked arrays
c2e2c0 = xp.column_stack((xp.asarray(range(c2e2c.shape[0])), c2e2c))
c2e2c0 = xp.column_stack((xp.asarray(range(c2e2c.shape[0])), c2e2c.ndarray))
e2c2e0 = xp.column_stack((xp.asarray(range(e2c2e.shape[0])), e2c2e.ndarray))

config = base.GridConfig(
Expand Down
3 changes: 2 additions & 1 deletion tools/tests/py2fgen/test_codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@ def test_python_wrapper(dummy_plugin):
import cupy as cp
from numpy.typing import NDArray
from gt4py.next.iterator.embedded import np_as_located_field
import numpy as np
from icon4pytools.py2fgen.settings import config
xp = config.array_ns
from icon4py.model.common import dimension as dims
# logger setup
Expand Down

0 comments on commit 66fafb5

Please sign in to comment.