Skip to content

Commit

Permalink
zero_field helper function edit
Browse files Browse the repository at this point in the history
  • Loading branch information
nfarabullini committed Dec 2, 2024
1 parent a2447c9 commit ecffbf8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions model/common/src/icon4py/model/common/test_utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from dataclasses import dataclass, field
from typing import ClassVar, Optional

import gt4py.next as gtx
import numpy as np
import numpy.typing as npt
import pytest
Expand Down Expand Up @@ -103,8 +102,10 @@ def zero_field(
extend: Optional[dict[gt_common.Dimension, int]] = None,
backend=None,
) -> gt_common.Field:
domain = {d: _shape(grid, dims, extend) for d in dims}
return gtx.zeros(domain, dtype=dtype, allocator=backend)
arr = np.zeros(shape=_shape(grid, *dims, extend=extend))
if dtype:
arr = arr.astype(dtype)
return as_field(dims, arr, allocator=backend)


def constant_field(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ def pytest_addoption(parser):

try:
parser.addoption(
"--dace_orchestration",
action="store_true",
default=False,
help="Performs DaCe orchestration. Any value will enable it.",
Expand Down
2 changes: 1 addition & 1 deletion tools/src/icon4pytools/py2fgen/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@


try:
import dace # type: ignore[import-untyped]
import dace # type: ignore[import-not-found]
from gt4py.next.program_processors.runners.dace import (
run_dace_cpu,
run_dace_cpu_noopt,
Expand Down

0 comments on commit ecffbf8

Please sign in to comment.