Skip to content
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b1db75e
Infrastructure update
egparedes Mar 18, 2026
611cf05
Update stencil tests
egparedes Mar 18, 2026
e3ad5b5
Fix stenciltests using classmethods for reference
egparedes Mar 19, 2026
679a265
Fix format
egparedes Mar 19, 2026
a6fce49
More stencil_test fixes
egparedes Mar 19, 2026
e815473
Fix logic in stencil_tests decorators
egparedes Mar 19, 2026
9215483
Fix parametrized input data fixtures
egparedes Mar 19, 2026
e6069f3
Fix more non-properly decorated tests
egparedes Mar 20, 2026
4b93007
Final cleanups
egparedes Mar 20, 2026
8b2b36a
Merge branch 'main' into feat/minor-stenciltest-fixes
egparedes Mar 20, 2026
769b8e1
Preparation for massive data_alloc -> self.data_alloc conversion
egparedes Mar 27, 2026
352a7cd
StencilTest fixes
egparedes Mar 27, 2026
87d34da
Mass change
egparedes Mar 27, 2026
eaf3f1d
Merge branch 'main' into feat/minor-stenciltest-fixes
egparedes Mar 27, 2026
6eb9172
Fixes after merge
egparedes Mar 27, 2026
1081d86
Add index_field to DataAllocation
egparedes Mar 31, 2026
15d6833
Merge branch 'main' into feat/minor-stenciltest-fixes
egparedes Mar 31, 2026
c57e408
Fix index_field
egparedes Mar 31, 2026
7a19baa
More fixes
egparedes Mar 31, 2026
4082610
Small refactoring and cleanups
egparedes Mar 31, 2026
bfb06b9
More refactorings to unify reference method implementation
egparedes Mar 31, 2026
6d049a4
Fix usages of connectivities instead of grid in reference methods
egparedes Apr 1, 2026
4b2c806
Fix connectivities
egparedes Apr 1, 2026
c10656c
Fix imports
egparedes Apr 1, 2026
b2b50e7
Merge branch 'main' into feat/minor-stenciltest-fixes
egparedes Apr 1, 2026
e4226f6
More cleanups
egparedes Apr 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class TestApplyHorizontalDensityIncrement(stencil_tests.StencilTest):
),
)

@staticmethod
@stencil_tests.static_reference
def reference(
connectivities: dict[gtx.Dimension, np.ndarray],
p_rhodz_new: np.ndarray,
Expand All @@ -43,7 +43,7 @@ def reference(
rhodz_ast2 = np.maximum(0.1 * p_rhodz_new, p_rhodz_new) - p_dtime * tmp
return dict(rhodz_ast2=rhodz_ast2)

@pytest.fixture
@stencil_tests.input_data_fixture
def input_data(self, grid) -> dict:
p_rhodz_new = data_alloc.random_field(grid, dims.CellDim, dims.KDim)
p_mflx_contra_v = data_alloc.random_field(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class TestApplyInterpolatedTracerTimeTendency(stencil_tests.StencilTest):
PROGRAM = apply_interpolated_tracer_time_tendency
OUTPUTS = ("p_tracer_new",)

@staticmethod
@stencil_tests.static_reference
def reference(
connectivities: dict[gtx.Dimension, np.ndarray],
p_tracer_now: np.ndarray,
Expand All @@ -37,7 +37,7 @@ def reference(

return dict(p_tracer_new=p_tracer_new)

@pytest.fixture
@stencil_tests.input_data_fixture
def input_data(self, grid: base.Grid) -> dict:
p_tracer_now = data_alloc.random_field(grid, dims.CellDim, dims.KDim)
p_grf_tend_tracer = data_alloc.random_field(grid, dims.CellDim, dims.KDim)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class TestApplyVerticalDensityIncrement(stencil_tests.StencilTest):
),
)

@staticmethod
@stencil_tests.static_reference
def reference(
connectivities: dict[gtx.Dimension, np.ndarray],
rhodz_ast: np.ndarray,
Expand All @@ -47,7 +47,7 @@ def reference(

return dict(rhodz_ast2=rhodz_ast2)

@pytest.fixture
@stencil_tests.input_data_fixture
def input_data(self, grid: base.Grid) -> dict:
rhodz_ast = data_alloc.random_field(grid, dims.CellDim, dims.KDim)
p_mflx_contra_v = data_alloc.random_field(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class TestAverageHorizontalFluxSubcycling2(stencil_tests.StencilTest):
PROGRAM = average_horizontal_flux_subcycling_2
OUTPUTS = ("p_out_e",)

@staticmethod
@stencil_tests.static_reference
def reference(
connectivities: dict[gtx.Dimension, np.ndarray],
z_tracer_mflx_1_dsl: np.ndarray,
Expand All @@ -34,7 +34,7 @@ def reference(
p_out_e = (z_tracer_mflx_1_dsl + z_tracer_mflx_2_dsl) / float(2)
return dict(p_out_e=p_out_e)

@pytest.fixture
@stencil_tests.input_data_fixture
def input_data(self, grid: base.Grid) -> dict:
z_tracer_mflx_1_dsl = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim)
z_tracer_mflx_2_dsl = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class TestAverageHorizontalFluxSubcycling3(stencil_tests.StencilTest):
PROGRAM = average_horizontal_flux_subcycling_3
OUTPUTS = ("p_out_e",)

@staticmethod
@stencil_tests.static_reference
def reference(
connectivities: dict[gtx.Dimension, np.ndarray],
z_tracer_mflx_1_dsl: np.ndarray,
Expand All @@ -35,7 +35,7 @@ def reference(
p_out_e = (z_tracer_mflx_1_dsl + z_tracer_mflx_2_dsl + z_tracer_mflx_3_dsl) / float(3)
return dict(p_out_e=p_out_e)

@pytest.fixture
@stencil_tests.input_data_fixture
def input_data(self, grid: base.Grid) -> dict:
z_tracer_mflx_1_dsl = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim)
z_tracer_mflx_2_dsl = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class TestComputeAntidiffusiveCellFluxesAndMinMax(stencil_tests.StencilTest):
"z_tracer_min",
)

@staticmethod
@stencil_tests.static_reference
def reference(
connectivities: dict[gtx.Dimension, np.ndarray],
geofac_div: np.ndarray,
Expand Down Expand Up @@ -77,7 +77,7 @@ def reference(
z_tracer_min=z_tracer_min,
)

@pytest.fixture
@stencil_tests.input_data_fixture
def input_data(self, grid) -> dict:
geofac_div = data_alloc.random_field(grid, dims.CellDim, dims.C2EDim)
p_rhodz_now = data_alloc.random_field(grid, dims.CellDim, dims.KDim)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class TestComputeBarycentricBacktrajectory(stencil_tests.StencilTest):
PROGRAM = compute_barycentric_backtrajectory
OUTPUTS = ("p_cell_idx", "p_distv_bary_1", "p_distv_bary_2")

@staticmethod
@stencil_tests.static_reference
def reference(
connectivities: dict[gtx.Dimension, np.ndarray],
p_vn: np.ndarray,
Expand Down Expand Up @@ -79,7 +79,7 @@ def reference(
p_distv_bary_2=p_distv_bary_2,
)

@pytest.fixture
@stencil_tests.input_data_fixture
def input_data(self, grid) -> dict:
p_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim)
p_vt = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class TestComputeBarycentricBacktrajectoryAlt(stencil_tests.StencilTest):
PROGRAM = compute_barycentric_backtrajectory_alt
OUTPUTS = ("p_distv_bary_1", "p_distv_bary_2")

@staticmethod
@stencil_tests.static_reference
def reference(
connectivities: dict[gtx.Dimension, np.ndarray],
p_vn: np.ndarray,
Expand Down Expand Up @@ -72,7 +72,7 @@ def reference(
p_distv_bary_2=p_distv_bary_2,
)

@pytest.fixture
@stencil_tests.input_data_fixture
def input_data(self, grid) -> dict:
p_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim)
p_vt = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class TestComputeFfslBacktrajectory(stencil_tests.StencilTest):
"p_coords_dreg_v_4_lat_dsl",
)

@staticmethod
@stencil_tests.static_reference
def reference(
connectivities: dict[gtx.Dimension, np.ndarray],
p_vn: np.ndarray,
Expand Down Expand Up @@ -145,7 +145,7 @@ def reference(
"p_coords_dreg_v_4_lat_dsl": p_coords_dreg_v_4_lat_dsl,
}

@pytest.fixture
@stencil_tests.input_data_fixture
def input_data(self, grid) -> dict:
p_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim)
p_vt = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class TestComputeFfslBacktrajectoryCounterclockwiseIndicator(stencil_tests.Stenc
PROGRAM = compute_ffsl_backtrajectory_counterclockwise_indicator
OUTPUTS = ("lvn_sys_pos",)

@staticmethod
@stencil_tests.static_reference
def reference(
connectivities: dict[gtx.Dimension, np.ndarray],
p_vn: np.ndarray,
Expand All @@ -44,7 +44,7 @@ def reference(

return dict(lvn_sys_pos=lvn_sys_pos)

@pytest.fixture
@stencil_tests.input_data_fixture
def input_data(self, grid: base.Grid) -> dict:
p_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim)
tangent_orientation = data_alloc.random_field(grid, dims.EdgeDim)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class TestComputeFfslBacktrajectoryLengthIndicator(stencil_tests.StencilTest):
PROGRAM = compute_ffsl_backtrajectory_length_indicator
OUTPUTS = ("opt_famask_dsl",)

@staticmethod
@stencil_tests.static_reference
def reference(
connectivities: dict[gtx.Dimension, np.ndarray],
p_vn: np.ndarray,
Expand All @@ -46,7 +46,7 @@ def reference(

return dict(opt_famask_dsl=opt_famask_dsl)

@pytest.fixture
@stencil_tests.input_data_fixture
def input_data(self, grid) -> dict:
p_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim)
p_vt = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class TestComputeHorizontalTracerFluxFromCubicCoefficients(stencil_tests.Stencil
PROGRAM = compute_horizontal_tracer_flux_from_cubic_coefficients
OUTPUTS = ("p_out_e_hybrid_2",)

@staticmethod
@stencil_tests.static_reference
def reference(
connectivities: dict[gtx.Dimension, np.ndarray],
p_out_e_hybrid_2: np.ndarray,
Expand All @@ -34,7 +34,7 @@ def reference(

return dict(p_out_e_hybrid_2=p_out_e_hybrid_2)

@pytest.fixture
@stencil_tests.input_data_fixture
def input_data(self, grid) -> dict:
p_out_e_hybrid_2 = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim)
p_mass_flx_e = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class TestComputeHorizontalTracerFluxFromLinearCoefficients(stencil_tests.Stenci
PROGRAM = compute_horizontal_tracer_flux_from_linear_coefficients
OUTPUTS = ("p_out_e",)

@staticmethod
@stencil_tests.static_reference
def reference(
connectivities: dict[gtx.Dimension, np.ndarray],
z_lsq_coeff_1: np.ndarray,
Expand Down Expand Up @@ -57,7 +57,7 @@ def reference(

return dict(p_out_e=p_out_e)

@pytest.fixture
@stencil_tests.input_data_fixture
def input_data(self, grid: base.Grid) -> dict:
z_lsq_coeff_1 = data_alloc.random_field(grid, dims.CellDim, dims.KDim)
z_lsq_coeff_2 = data_alloc.random_field(grid, dims.CellDim, dims.KDim)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class TestComputeHorizontalTracerFluxFromLinearCoefficientsAlt(stencil_tests.Ste
PROGRAM = compute_horizontal_tracer_flux_from_linear_coefficients_alt
OUTPUTS = ("p_out_e",)

@staticmethod
@stencil_tests.static_reference
def reference(
connectivities: dict[gtx.Dimension, np.ndarray],
z_lsq_coeff_1: np.ndarray,
Expand Down Expand Up @@ -57,7 +57,7 @@ def reference(

return dict(p_out_e=p_out_e)

@pytest.fixture
@stencil_tests.input_data_fixture
def input_data(self, grid: base.Grid) -> dict:
z_lsq_coeff_1 = data_alloc.random_field(grid, dims.CellDim, dims.KDim)
z_lsq_coeff_2 = data_alloc.random_field(grid, dims.CellDim, dims.KDim)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class TestComputePositiveDefiniteHorizontalMultiplicativeFluxFactor(stencil_test
PROGRAM = compute_positive_definite_horizontal_multiplicative_flux_factor
OUTPUTS = ("r_m",)

@staticmethod
@stencil_tests.static_reference
def reference(
connectivities: dict[gtx.Dimension, np.ndarray],
geofac_div: np.ndarray,
Expand Down Expand Up @@ -53,7 +53,7 @@ def reference(

return dict(r_m=r_m)

@pytest.fixture
@stencil_tests.input_data_fixture
def input_data(self, grid) -> dict:
geofac_div = data_alloc.random_field(grid, dims.CellDim, dims.C2EDim)
p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class TestComputePpm4gpuParabolaCoefficients(stencil_tests.StencilTest):
PROGRAM = compute_ppm4gpu_parabola_coefficients
OUTPUTS = ("z_delta_q", "z_a1")

@staticmethod
@stencil_tests.static_reference
def reference(
connectivities: dict[gtx.Dimension, np.ndarray],
z_face_up: np.ndarray,
Expand All @@ -36,7 +36,7 @@ def reference(
z_a1 = p_cc - 0.5 * (z_face_up + z_face_low)
return dict(z_delta_q=z_delta_q, z_a1=z_a1)

@pytest.fixture
@stencil_tests.input_data_fixture
def input_data(self, grid: base.Grid) -> dict:
z_face_up = data_alloc.random_field(grid, dims.CellDim, dims.KDim)
z_face_low = data_alloc.random_field(grid, dims.CellDim, dims.KDim)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class TestComputePpmAllFaceValues(stencil_tests.StencilTest):
PROGRAM = compute_ppm_all_face_values
OUTPUTS = ("p_face",)

@staticmethod
@stencil_tests.static_reference
def reference(
connectivities: dict[gtx.Dimension, np.ndarray],
p_cc: np.ndarray,
Expand All @@ -49,7 +49,7 @@ def reference(
p_face[:, 1:] = np.where((k[1:] == elevp1), p_cc[:, :-1], p_face[:, 1:])
return dict(p_face=p_face)

@pytest.fixture
@stencil_tests.input_data_fixture
def input_data(self, grid: base.Grid) -> dict:
p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim)
p_cellhgt_mc_now = data_alloc.random_field(grid, dims.CellDim, dims.KDim)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class TestComputePpmQuadraticFaceValues(stencil_tests.StencilTest):
PROGRAM = compute_ppm_quadratic_face_values
OUTPUTS = (stencil_tests.Output("p_face", refslice=outslice, gtslice=outslice),)

@staticmethod
@stencil_tests.static_reference
def reference(
connectivities: dict[gtx.Dimension, np.ndarray],
p_cc: np.ndarray,
Expand All @@ -42,7 +42,7 @@ def reference(
)
return dict(p_face=p_face)

@pytest.fixture
@stencil_tests.input_data_fixture
def input_data(self, grid: base.Grid) -> dict:
p_face = data_alloc.random_field(grid, dims.CellDim, dims.KDim)
p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class TestComputePpmQuarticFaceValues(stencil_tests.StencilTest):
PROGRAM = compute_ppm_quartic_face_values
OUTPUTS = (stencil_tests.Output("p_face", gtslice=(slice(None), slice(2, None))),)

@staticmethod
@stencil_tests.static_reference
def reference(
connectivities: dict[gtx.Dimension, np.ndarray],
p_cc: np.ndarray,
Expand Down Expand Up @@ -68,7 +68,7 @@ def reference(
)
return dict(p_face=p_face)

@pytest.fixture
@stencil_tests.input_data_fixture
def input_data(self, grid: base.Grid) -> dict:
p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim)
p_cellhgt_mc_now = data_alloc.random_field(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class TestComputePpmSlope(stencil_tests.StencilTest):
),
)

@staticmethod
@stencil_tests.static_reference
def reference(
connectivities: dict[gtx.Dimension, np.ndarray],
p_cc: np.ndarray,
Expand Down Expand Up @@ -64,7 +64,7 @@ def reference(
z_slope = np.where(k[1:-1] < elev, z_slope_a, z_slope_b)
return dict(z_slope=z_slope)

@pytest.fixture
@stencil_tests.input_data_fixture
def input_data(self, grid: base.Grid) -> dict:
z_slope = data_alloc.zero_field(grid, dims.CellDim, dims.KDim)
p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class TestComputeTendency(stencil_tests.StencilTest):
PROGRAM = compute_tendency
OUTPUTS = ("opt_ddt_tracer_adv",)

@staticmethod
@stencil_tests.static_reference
def reference(
connectivities: dict[gtx.Dimension, np.ndarray],
p_tracer_now: np.ndarray,
Expand All @@ -34,7 +34,7 @@ def reference(

return dict(opt_ddt_tracer_adv=opt_ddt_tracer_adv)

@pytest.fixture
@stencil_tests.input_data_fixture
def input_data(self, grid: base.Grid) -> dict:
p_tracer_now = data_alloc.random_field(grid, dims.CellDim, dims.KDim)
p_tracer_new = data_alloc.random_field(grid, dims.CellDim, dims.KDim)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class TestComputeVerticalParabolaLimiterCondition(stencil_tests.StencilTest):
PROGRAM = compute_vertical_parabola_limiter_condition
OUTPUTS = ("l_limit",)

@staticmethod
@stencil_tests.static_reference
def reference(
connectivities: dict[gtx.Dimension, np.ndarray],
p_face: np.ndarray,
Expand All @@ -36,7 +36,7 @@ def reference(
l_limit = np.where(np.abs(z_delta) < -1 * z_a6i, 1, 0)
return dict(l_limit=l_limit)

@pytest.fixture
@stencil_tests.input_data_fixture
def input_data(self, grid: base.Grid) -> dict:
p_cc = data_alloc.random_field(grid, dims.CellDim, dims.KDim)
p_face = data_alloc.random_field(grid, dims.CellDim, dims.KDim, extend={dims.KDim: 1})
Expand Down
Loading
Loading