Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
cb8ebd2
wip.1 edgeidx, vertidx, exdist
jcanton Feb 10, 2026
cce95e9
update types
jcanton Feb 10, 2026
c98de73
shapes
jcanton Feb 10, 2026
65a1980
wip update test_dycore_wrapper and serialbox
jcanton Feb 10, 2026
2f6ed74
reshuffle
jcanton Feb 10, 2026
1f621c3
Remove pg_edgeidx_dsl
havogt Feb 10, 2026
da31705
cleanup unused program
havogt Feb 10, 2026
0a79e97
add description
havogt Feb 10, 2026
9d91afb
fix return type annotation
havogt Feb 10, 2026
e14a063
remove some more...
havogt Feb 11, 2026
97b5262
add missing file
havogt Feb 11, 2026
16edab7
Merge branch 'main' into cleanup_dsl_fields
jcanton Feb 11, 2026
d2e5192
Merge branch 'main' into cleanup_pg_edgeidx_dsl
havogt Feb 11, 2026
ba7c252
fix xp
jcanton Feb 11, 2026
ca49be9
Merge branch 'cleanup_pg_edgeidx_dsl' into cleanup_dsl_fields
jcanton Feb 11, 2026
d81eb59
finish merge and one review comment
jcanton Feb 11, 2026
da2408e
list2field @havogt
jcanton Feb 11, 2026
c224614
update call
jcanton Feb 11, 2026
2515d9c
one more review
jcanton Feb 11, 2026
3d20731
move here
jcanton Feb 11, 2026
77e2604
partial cleanup
jcanton Feb 11, 2026
3643a0e
move here and make nice
jcanton Feb 11, 2026
9956a3b
unify names
jcanton Feb 11, 2026
8922a9f
move these to common
jcanton Feb 11, 2026
0aa5d36
cleanup
jcanton Feb 11, 2026
fdeaab9
pre-commit
jcanton Feb 11, 2026
f805327
even fortran can do this..
jcanton Feb 11, 2026
a6f88c0
Merge branch 'cleanup_mask_hdiff' into cleanup_dsl_fields
jcanton Feb 11, 2026
ed1d32b
wip on more fields
jcanton Feb 11, 2026
216428b
fix unit test
jcanton Feb 12, 2026
33058f9
fix this
jcanton Feb 12, 2026
8f372bc
remove this
jcanton Feb 12, 2026
21829df
Merge branch 'cleanup_mask_hdiff' into cleanup_dsl_fields
jcanton Feb 12, 2026
fca66e3
cleanup zd_diffcoef_dsl name
jcanton Feb 12, 2026
4ea7c24
will this work?
jcanton Feb 12, 2026
24007f7
remove more _dsl names
jcanton Feb 12, 2026
700b13b
precommit
jcanton Feb 12, 2026
7935f41
fix domains and maybe finish zd_ fields
jcanton Feb 12, 2026
5b6cd8e
possibly large cleanup
jcanton Feb 12, 2026
a80f357
Update model/common/src/icon4py/model/common/metrics/metric_fields.py
jcanton Feb 13, 2026
1f7596c
Update model/atmosphere/dycore/src/icon4py/model/atmosphere/dycore/so…
jcanton Feb 13, 2026
0f4c50c
cleanup input arg
jcanton Feb 13, 2026
51bf63f
fix tools tests
jcanton Feb 13, 2026
42499a7
better this way
jcanton Feb 13, 2026
3c17625
pre-commit
jcanton Feb 13, 2026
f7f4493
this is used in the halo only
jcanton Feb 16, 2026
b4ecc4a
remove import
jcanton Feb 16, 2026
0ad66f7
forgot to update this test
jcanton Feb 16, 2026
fd646f8
Merge branch 'cleanup_bdy_halo_c' into cleanup_dsl_fields
jcanton Feb 16, 2026
153addb
optional arrays
jcanton Feb 16, 2026
fcd5f65
and update wrapper references
jcanton Feb 16, 2026
1a8e2e7
update code comment
jcanton Feb 16, 2026
0bba4b4
Merge branch 'main' into cleanup_bdy_halo_c
jcanton Feb 16, 2026
e50821e
this might work
jcanton Feb 16, 2026
2fc6be8
fix serialbox calls
jcanton Feb 16, 2026
c7f77ec
was missing reduce_to_dim_size
jcanton Feb 16, 2026
b856946
maybe fix factories and compute_weights
jcanton Feb 16, 2026
7525d2c
new indexing here too
jcanton Feb 16, 2026
940a615
Merge branch 'cleanup_bdy_halo_c' into cleanup_dsl_fields
jcanton Feb 17, 2026
1277493
this is probably what I meant?
jcanton Feb 17, 2026
8d83a1f
Merge branch 'main' into merge_bdy_halo_stencils
jcanton Feb 17, 2026
87f5ca8
fix these
jcanton Feb 17, 2026
63d7f69
optionally register pg_ fields
jcanton Feb 17, 2026
ef3d935
now it runs, time to fix the assetions
jcanton Feb 17, 2026
03ccca4
something like this
jcanton Feb 17, 2026
7789508
pre-commit
jcanton Feb 18, 2026
3a72213
Merge branch 'main' into merge_bdy_halo_stencils
jcanton Feb 18, 2026
4384f97
update tests
jcanton Feb 18, 2026
0cc5ac7
forgot to overwrite with these funny names, now get some complaints b…
jcanton Feb 18, 2026
e75e23f
forgot to delete these
jcanton Feb 18, 2026
fe26b19
Merge branch 'main' into merge_bdy_halo_stencils
jcanton Feb 18, 2026
fe84feb
forgot dict -> domain
jcanton Feb 18, 2026
8a4bd94
fix wrong name
jcanton Feb 18, 2026
032710a
fix name here too
jcanton Feb 18, 2026
fecc9e6
review updates
jcanton Feb 19, 2026
9178da7
messed up
jcanton Feb 19, 2026
1d56c1f
just some renaming
jcanton Feb 19, 2026
6a2ded7
these were defined on the wrong Krange
jcanton Feb 19, 2026
4fe60fd
fix test
jcanton Feb 19, 2026
3b331d5
Merge branch 'cleanup_mask_hdiff' into cleanup_dsl_fields
jcanton Feb 19, 2026
cb97d9a
Merge branch 'merge_bdy_halo_stencils' into cleanup_dsl_fields
jcanton Feb 19, 2026
4cdbcc4
add more experiments here
jcanton Feb 19, 2026
d60e320
update experiment version
jcanton Feb 19, 2026
44a89aa
oh no... I had messed up the test...
jcanton Feb 19, 2026
99dbfff
restore this
jcanton Feb 19, 2026
706562f
these can be null
jcanton Feb 19, 2026
4400c2d
this is needed in the interface too
jcanton Feb 19, 2026
98d58a5
add reminder
jcanton Feb 20, 2026
122399a
fix cell ids
jcanton Feb 20, 2026
818fb00
Merge branch 'main' into cleanup_dsl_fields
jcanton Feb 20, 2026
299bcff
formatting
jcanton Feb 20, 2026
16903f0
type ignore
jcanton Feb 20, 2026
91524d9
update codegen_references
jcanton Feb 20, 2026
4c3d0ea
turn on data download
jcanton Feb 20, 2026
f01d5c0
slicing
jcanton Feb 23, 2026
d2ec843
Merge branch 'main' into cleanup_dsl_fields
jcanton Feb 23, 2026
3ec5765
forgot to clean this up
jcanton Feb 23, 2026
37bd0a1
more cleanup
jcanton Feb 23, 2026
9f1a249
pre-commit
jcanton Feb 23, 2026
0361891
turn off data download
jcanton Feb 23, 2026
a561e27
fix test_dycore_wrapper test which needs the same inputs as the bindings
jcanton Feb 23, 2026
175866f
Merge branch 'main' into cleanup_dsl_fields
jcanton Feb 23, 2026
6a9b434
forgot to update here too
jcanton Feb 23, 2026
9aeaefb
delete this
jcanton Feb 24, 2026
034ef88
Merge branch 'main' into cleanup_dsl_fields
jcanton Feb 24, 2026
2de615e
this was missing, thanks @edopao (ok here?)
jcanton Feb 25, 2026
c091f20
Merge branch 'main' into cleanup_dsl_fields
jcanton Feb 25, 2026
f9490ea
enable distributed data download
jcanton Feb 25, 2026
51c445a
and turn it off again
jcanton Feb 25, 2026
34beb12
Merge branch 'main' into cleanup_dsl_fields
jcanton Mar 3, 2026
6df0e9a
forgot these
jcanton Mar 3, 2026
de4c66e
update references again
jcanton Mar 3, 2026
aef42e3
add two external dependencies
jcanton Mar 3, 2026
74bedfa
enable distributed downloads
jcanton Mar 3, 2026
d908ed8
refactor: move from wrappers.common to model.common
jcanton Mar 3, 2026
862634e
Merge branch 'main' into cleanup_dsl_fields
jcanton Mar 3, 2026
4d83eec
fix this, move that
jcanton Mar 3, 2026
8ae03ec
move this to data_alloc too
jcanton Mar 3, 2026
b546003
fix circular import
jcanton Mar 3, 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
2 changes: 1 addition & 1 deletion ci/distributed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ build_distributed_cpu:
SLURM_NTASKS: 4
ICON4PY_TEST_DATA_PATH: "/icon4py/testdata"
ICON4PY_ENABLE_GRID_DOWNLOAD: false
ICON4PY_ENABLE_TESTDATA_DOWNLOAD: false
ICON4PY_ENABLE_TESTDATA_DOWNLOAD: true
PYTEST_ADDOPTS: "--durations=0"
CSCS_ADDITIONAL_MOUNTS: '["/capstor/store/cscs/userlab/cwci02/icon4py/ci/testdata:$ICON4PY_TEST_DATA_PATH"]'

Expand Down
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed mask; change to non-_DSL variables.

Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ def test_diffusion_benchmark(
metric_state = diffusion_states.DiffusionMetricState(
theta_ref_mc=metrics_field_source.get(metrics_attributes.THETA_REF_MC),
wgtfac_c=metrics_field_source.get(metrics_attributes.WGTFAC_C),
zd_intcoef=metrics_field_source.get(metrics_attributes.ZD_INTCOEF_DSL),
zd_vertoffset=metrics_field_source.get(metrics_attributes.ZD_VERTOFFSET_DSL),
zd_diffcoef=metrics_field_source.get(metrics_attributes.ZD_DIFFCOEF_DSL),
zd_intcoef=metrics_field_source.get(metrics_attributes.ZD_INTCOEF),
zd_vertoffset=metrics_field_source.get(metrics_attributes.ZD_VERTOFFSET),
zd_diffcoef=metrics_field_source.get(metrics_attributes.ZD_DIFFCOEF),
)
# initialization of the diagnostic and prognostic state
diagnostic_state = diffusion_states.DiffusionDiagnosticState(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# Please, refer to the LICENSE file in the root directory.
# SPDX-License-Identifier: BSD-3-Clause
# ruff: noqa: ERA001, B008
# ruff: noqa: B008

import dataclasses
import logging
Expand Down Expand Up @@ -1071,7 +1071,6 @@ def time_step(
exner_new=prognostic_states.next.exner,
)

# flake8: noqa: C901
def run_predictor_step(
self,
diagnostic_state_nh: dycore_states.DiagnosticStateNonHydro,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#
# Please, refer to the LICENSE file in the root directory.
# SPDX-License-Identifier: BSD-3-Clause
# ruff: noqa: ERA001

from __future__ import annotations

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def solve_nonhydro(
zdiff_gradp=metrics_field_source.get(metrics_attributes.ZDIFF_GRADP),
vertoffset_gradp=metrics_field_source.get(metrics_attributes.VERTOFFSET_GRADP),
nflat_gradp=metrics_field_source.get(metrics_attributes.NFLAT_GRADP),
pg_exdist=metrics_field_source.get(metrics_attributes.PG_EDGEDIST_DSL),
pg_exdist=metrics_field_source.get(metrics_attributes.PG_EXDIST_DSL),
ddqz_z_full_e=metrics_field_source.get(metrics_attributes.DDQZ_Z_FULL_E),
ddxt_z_full=metrics_field_source.get(metrics_attributes.DDXT_Z_FULL),
wgtfac_e=metrics_field_source.get(metrics_attributes.WGTFAC_E),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1513,7 +1513,7 @@ def test_compute_rho_theta_pgrad_and_update_vn(
c_lin_e=interpolation_savepoint.c_lin_e(),
ikoffset=metrics_savepoint.vertoffset_gradp(),
zdiff_gradp=metrics_savepoint.zdiff_gradp(),
pg_exdist=metrics_savepoint.pg_exdist(),
pg_exdist=metrics_savepoint.pg_exdist_dsl(),
inv_dual_edge_length=grid_savepoint.inv_dual_edge_length(),
dtime=savepoint_nonhydro_init.get_metadata("dtime").get("dtime"),
iau_wgt_dyn=iau_wgt_dyn,
Expand Down Expand Up @@ -1768,7 +1768,7 @@ def test_compute_horizontal_velocity_quantities_and_fluxes(
ddxn_z_full = metrics_savepoint.ddxn_z_full()
ddxt_z_full = metrics_savepoint.ddxt_z_full()
wgtfac_e = metrics_savepoint.wgtfac_e()
wgtfacq_e = metrics_savepoint.wgtfacq_e_dsl(icon_grid.num_levels)
wgtfacq_e = metrics_savepoint.wgtfacq_e_dsl()
rbf_vec_coeff_e = interpolation_savepoint.rbf_vec_coeff_e()
geofac_grdiv = interpolation_savepoint.geofac_grdiv()
nflatlev = vertical_params.nflatlev
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ def test_compute_diagnostics_from_normal_wind(
ddxn_z_full = metrics_savepoint.ddxn_z_full()
ddxt_z_full = metrics_savepoint.ddxt_z_full()
contravariant_correction_at_edges_on_model_levels = savepoint_velocity_init.z_w_concorr_me()
wgtfacq_e = metrics_savepoint.wgtfacq_e_dsl(icon_grid.num_levels)
wgtfacq_e = metrics_savepoint.wgtfacq_e_dsl()
nflatlev = grid_savepoint.nflatlev()
c_intp = interpolation_savepoint.c_intp()
inv_dual_edge_length = grid_savepoint.inv_dual_edge_length()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
2,
"2021-06-20T12:00:10.000",
1,
)
),
],
)
@pytest.mark.mpi
Expand Down Expand Up @@ -83,7 +83,7 @@ def test_run_solve_nonhydro_single_step(
f"rank={processor_props.rank}/{processor_props.comm_size}: number of halo cells {np.count_nonzero(np.invert(owned_cells))}"
)
print(
f"rank={processor_props.rank}/{processor_props.comm_size}: number of halo edges {np.count_nonzero(np.invert( decomposition_info.owner_mask(dims.EdgeDim)))}"
f"rank={processor_props.rank}/{processor_props.comm_size}: number of halo edges {np.count_nonzero(np.invert(decomposition_info.owner_mask(dims.EdgeDim)))}"
)
print(
f"rank={processor_props.rank}/{processor_props.comm_size}: number of halo cells {np.count_nonzero(np.invert(owned_cells))}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,9 @@ def reference(
), # For benchmarking against MCH experiments
]
],
ids=lambda param: f"divdamp_order[{param['divdamp_order']}]__is_iau_active[{param['is_iau_active']}]__second_order_divdamp_factor[{param['second_order_divdamp_factor']}]",
ids=lambda param: (
f"divdamp_order[{param['divdamp_order']}]__is_iau_active[{param['is_iau_active']}]__second_order_divdamp_factor[{param['second_order_divdamp_factor']}]"
),
)
def input_data(self, request: pytest.FixtureRequest, grid: base.Grid) -> dict:
current_vn = data_alloc.random_field(grid, dims.EdgeDim, dims.KDim)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,9 @@ def reference(
params=[
{"skip_compute_predictor_vertical_advection": value} for value in [True, False]
], # True for benchmarking, False for testing
ids=lambda param: f"skip_compute_predictor_vertical_advection[{param['skip_compute_predictor_vertical_advection']}]",
ids=lambda param: (
f"skip_compute_predictor_vertical_advection[{param['skip_compute_predictor_vertical_advection']}]"
),
)
def input_data(
self, grid: base.Grid, request: pytest.FixtureRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ def reference(
(True, False),
]
],
ids=lambda p: f"prepare_advection[{p['prepare_advection']}]__at_first_substep[{p['at_first_substep']}]",
ids=lambda p: (
f"prepare_advection[{p['prepare_advection']}]__at_first_substep[{p['at_first_substep']}]"
),
)
def input_data(
self, request: pytest.FixtureRequest, grid: base.Grid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,9 @@ def reference(
params=[
{"skip_compute_predictor_vertical_advection": value} for value in [True, False]
], # True for benchmarking, False for testing
ids=lambda param: f"skip_compute_predictor_vertical_advection[{param['skip_compute_predictor_vertical_advection']}]",
ids=lambda param: (
f"skip_compute_predictor_vertical_advection[{param['skip_compute_predictor_vertical_advection']}]"
),
)
def input_data(
self, grid: base.Grid, request: pytest.FixtureRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,9 @@ def reference(
(False, False, 32), # For benchmarking against MCH experiments
]
],
ids=lambda param: f"at_first_substep[{param['at_first_substep']}]__is_iau_active[{param['is_iau_active']}]__divdamp_type[{param['divdamp_type']}]",
ids=lambda param: (
f"at_first_substep[{param['at_first_substep']}]__is_iau_active[{param['is_iau_active']}]__divdamp_type[{param['divdamp_type']}]"
),
)
def input_data(
self, request: pytest.FixtureRequest, grid: base.Grid
Expand Down
4 changes: 2 additions & 2 deletions model/atmosphere/dycore/tests/dycore/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ def construct_metric_state(
zdiff_gradp=metrics_savepoint.zdiff_gradp(),
vertoffset_gradp=metrics_savepoint.vertoffset_gradp(),
nflat_gradp=grid_savepoint.nflat_gradp(),
pg_exdist=metrics_savepoint.pg_exdist(),
pg_exdist=metrics_savepoint.pg_exdist_dsl(),
ddqz_z_full_e=metrics_savepoint.ddqz_z_full_e(),
ddxt_z_full=metrics_savepoint.ddxt_z_full(),
wgtfac_e=metrics_savepoint.wgtfac_e(),
wgtfacq_e=metrics_savepoint.wgtfacq_e_dsl(grid_savepoint.num(dims.KDim)),
wgtfacq_e=metrics_savepoint.wgtfacq_e_dsl(),
exner_w_implicit_weight_parameter=metrics_savepoint.vwind_impl_wgt(),
horizontal_mask_for_3d_divdamp=metrics_savepoint.hmask_dd3d(),
scaling_factor_for_3d_divdamp=metrics_savepoint.scalfac_dd3d(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def get_args():
"--masking",
dest="enable_masking",
choices=[True, False],
type=lambda x: (str(x).lower() == "true"),
type=lambda x: str(x).lower() == "true",
default=True,
help="Enable compatibility with reference implementation.",
)
Expand Down
1 change: 1 addition & 0 deletions model/common/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ classifiers = [
'Topic :: Scientific/Engineering :: Physics'
]
dependencies = [
'array-api-compat>=1.13.0',
'gt4py==1.1.6',
'packaging>=20.0',
'typing-extensions>=4.11.0',
Expand Down
7 changes: 6 additions & 1 deletion model/common/src/icon4py/model/common/grid/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ class GridGeometry(factory.FieldSource):

Examples:
>>> geometry = GridGeometry(
... grid, decomposition_info, backend, coordinates, extra_fields, geometry_attributes.attrs
... grid,
... decomposition_info,
... backend,
... coordinates,
... extra_fields,
... geometry_attributes.attrs,
... )
GridGeometry for geometry_type=SPHERE grid=f2e06839-694a-cca1-a3d5-028e0ff326e0 : R9B4
>>> geometry.get("edge_length")
Expand Down
2 changes: 1 addition & 1 deletion model/common/src/icon4py/model/common/grid/vertical.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def __str__(self) -> str:
array_value = [
f" 0 {vct_a_array[0]:12.3f} ",
*(
f"{k+1:4d} {vct_a_array[k+1]:12.3f} {dvct[k]:12.3f}"
f"{k + 1:4d} {vct_a_array[k + 1]:12.3f} {dvct[k]:12.3f}"
for k in range(vct_a_array.shape[0] - 1)
),
]
Expand Down
2 changes: 1 addition & 1 deletion model/common/src/icon4py/model/common/io/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,5 +346,5 @@ def close(self) -> None:


def generate_name(fname: str, counter: int) -> str:
stem = fname.split(".")[0]
stem = fname.split(".", maxsplit=1)[0]
return f"{stem}_{counter:0>4}.nc"
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def compute_diffusion_mask_and_coef(
array_ns: ModuleType = np,
) -> tuple[data_alloc.NDArray, data_alloc.NDArray]:
n_cells = c2e2c.shape[0]
zd_diffcoef_dsl = array_ns.zeros(shape=(n_cells, nlev))
zd_diffcoef = array_ns.zeros(shape=(n_cells, nlev))
k_start, k_end, _ = _compute_k_start_end(
z_mc=z_mc,
max_nbhgt=max_nbhgt,
Expand All @@ -140,7 +140,7 @@ def compute_diffusion_mask_and_coef(
if kend > kstart:
k_range = range(kstart, kend)

zd_diffcoef_dsl_var = array_ns.maximum(
zd_diffcoef_var = array_ns.maximum(
0.0,
array_ns.maximum(
array_ns.sqrt(array_ns.maximum(0.0, maxslp_avg[jc, k_range] - thslp_zdiffu))
Expand All @@ -151,9 +151,9 @@ def compute_diffusion_mask_and_coef(
),
),
)
zd_diffcoef_dsl[jc, k_range] = array_ns.minimum(0.002, zd_diffcoef_dsl_var)
zd_diffcoef[jc, k_range] = array_ns.minimum(0.002, zd_diffcoef_var)

return zd_diffcoef_dsl
return zd_diffcoef


def compute_diffusion_intcoef_and_vertoffset(
Expand All @@ -175,8 +175,8 @@ def compute_diffusion_intcoef_and_vertoffset(
nbidx = array_ns.ones(shape=(n_cells, n_c2e2c, nlev), dtype=int)

z_vintcoeff = array_ns.zeros(shape=(n_cells, n_c2e2c, nlev))
zd_vertoffset_dsl = array_ns.zeros(shape=(n_cells, n_c2e2c, nlev), dtype=gtx.int32)
zd_intcoef_dsl = array_ns.zeros(shape=(n_cells, n_c2e2c, nlev))
zd_vertoffset = array_ns.zeros(shape=(n_cells, n_c2e2c, nlev), dtype=gtx.int32)
zd_intcoef = array_ns.zeros(shape=(n_cells, n_c2e2c, nlev))

k_start, k_end, _ = _compute_k_start_end(
z_mc=z_mc,
Expand All @@ -201,10 +201,10 @@ def compute_diffusion_intcoef_and_vertoffset(
k_range, z_mc, z_mc_off, z_vintcoeff, jc, nlev
)

zd_intcoef_dsl[jc, :, k_range] = z_vintcoeff[jc, :, k_range]
zd_intcoef[jc, :, k_range] = z_vintcoeff[jc, :, k_range]

zd_vertoffset_dsl[jc, :, k_range] = (
zd_vertoffset[jc, :, k_range] = (
nbidx[jc, :, k_range] - array_ns.tile(array_ns.array(k_range), (3, 1)).T
)

return zd_intcoef_dsl, zd_vertoffset_dsl
return zd_intcoef, zd_vertoffset
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def compute_wgtfacq_c_dsl(
wgtfacq_c_dsl[:, nlev - 2] = wgtfacq_c[:, 1]
wgtfacq_c_dsl[:, nlev - 3] = wgtfacq_c[:, 2]

return wgtfacq_c_dsl
return wgtfacq_c_dsl[:, -3:]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be

return wgtfacq_c[:, [2, 1, 0]]

?



def compute_wgtfacq_e_dsl(
Expand All @@ -127,7 +127,7 @@ def compute_wgtfacq_e_dsl(
nlev: int,
exchange: Callable[[data_alloc.NDArray], None],
array_ns: ModuleType = np,
):
) -> data_alloc.NDArray:
"""
Compute weighting factor for quadratic interpolation to surface.

Expand All @@ -145,8 +145,8 @@ def compute_wgtfacq_e_dsl(
z_aux_c = array_ns.zeros((z_ifc.shape[0], 6))
z1, z2, z3 = _compute_z1_z2_z3(z_ifc, nlev, nlev - 1, nlev - 2, nlev - 3)
z_aux_c[:, 2] = z1 * z2 / (z2 - z3) / (z1 - z3)
z_aux_c[:, 1] = (z1 - wgtfacq_c_dsl[:, nlev - 3] * (z1 - z3)) / (z1 - z2)
z_aux_c[:, 0] = 1.0 - (wgtfacq_c_dsl[:, nlev - 2] + wgtfacq_c_dsl[:, nlev - 3])
z_aux_c[:, 1] = (z1 - wgtfacq_c_dsl[:, 0] * (z1 - z3)) / (z1 - z2)
z_aux_c[:, 0] = 1.0 - (wgtfacq_c_dsl[:, 1] + wgtfacq_c_dsl[:, 0])

z1, z2, z3 = _compute_z1_z2_z3(z_ifc, 0, 1, 2, 3)
z_aux_c[:, 5] = z1 * z2 / (z2 - z3) / (z1 - z3)
Expand All @@ -161,4 +161,4 @@ def compute_wgtfacq_e_dsl(
wgtfacq_e_dsl[:, nlev - 1] = z_aux_e[:, 1]
wgtfacq_e_dsl[:, nlev - 2] = z_aux_e[:, 2]

return wgtfacq_e_dsl
return wgtfacq_e_dsl[:, -3:]
32 changes: 16 additions & 16 deletions model/common/src/icon4py/model/common/metrics/metrics_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
WGTFAC_E: Final[str] = "wgtfac_e"
FLAT_IDX_MAX: Final[str] = "flat_idx_max"
NFLAT_GRADP: Final[str] = "nflat_gradp"
PG_EDGEDIST_DSL: Final[str] = "distance_for_pressure_gradient_extrapolation"
PG_EXDIST_DSL: Final[str] = "distance_for_pressure_gradient_extrapolation"
MASK_PROG_HALO_C: Final[str] = "mask_prog_halo_c"
HORIZONTAL_MASK_FOR_3D_DIVDAMP: Final[str] = "horizontal_mask_for_3d_divdamp"
ZDIFF_GRADP: Final[str] = "zdiff_gradp"
Expand All @@ -62,9 +62,9 @@
MAXSLP_AVG: Final[str] = "maxslp_avg"
MAXHGTD_AVG: Final[str] = "maxhgtd_avg"
MAX_NBHGT: Final[str] = "max_nbhgt"
ZD_DIFFCOEF_DSL: Final[str] = "zd_diffcoef_dsl"
ZD_INTCOEF_DSL: Final[str] = "zd_intcoef_dsl"
ZD_VERTOFFSET_DSL: Final[str] = "zd_vertoffset_dsl"
ZD_DIFFCOEF: Final[str] = "zd_diffcoef"
ZD_INTCOEF: Final[str] = "zd_intcoef"
ZD_VERTOFFSET: Final[str] = "zd_vertoffset"
CELL_HEIGHT_ON_HALF_LEVEL: Final[str] = "vertical_coordinates_on_half_levels"
DEEPATMO_DIVH: Final[str] = "deepatmo_divh"
DEEPATMO_DIVZL: Final[str] = "deepatmo_divzL"
Expand Down Expand Up @@ -303,8 +303,8 @@
icon_var_name="flat_idx_max",
dtype=ta.wpfloat,
),
PG_EDGEDIST_DSL: dict(
standard_name=PG_EDGEDIST_DSL,
PG_EXDIST_DSL: dict(
standard_name=PG_EXDIST_DSL,
long_name="extrapolation distance for pressure gradient downward extrapolation",
units="",
dims=(dims.EdgeDim, dims.KDim),
Expand Down Expand Up @@ -407,28 +407,28 @@
icon_var_name="max_nbhgt",
dtype=ta.wpfloat,
),
ZD_DIFFCOEF_DSL: dict(
standard_name=ZD_DIFFCOEF_DSL,
long_name="zd_diffcoef_dsl",
ZD_DIFFCOEF: dict(
standard_name=ZD_DIFFCOEF,
long_name="zd_diffcoef",
units="",
dims=(dims.CellDim, dims.KDim),
icon_var_name="zd_diffcoef",
dtype=ta.wpfloat,
),
ZD_INTCOEF_DSL: dict(
standard_name=ZD_INTCOEF_DSL,
long_name="zd_intcoef_dsl",
ZD_INTCOEF: dict(
standard_name=ZD_INTCOEF,
long_name="zd_intcoef",
units="",
dims=(dims.CellDim, dims.C2E2CDim, dims.KDim),
icon_var_name="zd_intcoef",
dtype=ta.wpfloat,
),
ZD_VERTOFFSET_DSL: dict(
standard_name=ZD_VERTOFFSET_DSL,
long_name="zd_vertoffset_dsl",
ZD_VERTOFFSET: dict(
standard_name=ZD_VERTOFFSET,
long_name="zd_vertoffset",
units="",
dims=(dims.CellDim, dims.C2E2CDim, dims.KDim),
icon_var_name="zd_vertoffset_dsl",
icon_var_name="zd_vertoffset",
dtype=gtx.int32,
),
CELL_HEIGHT_ON_HALF_LEVEL: dict(
Expand Down
Loading
Loading