Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 NDSL
Submodule NDSL updated 68 files
+3 −3 .github/workflows/create-cache.yaml
+2 −2 .github/workflows/docs_build.yaml
+2 −2 .github/workflows/docs_deploy.yaml
+3 −3 .github/workflows/lint.yaml
+2 −2 .github/workflows/unit_tests.yaml
+0 −3 docs/docstrings/comm/null_comm.md
+17 −17 examples/NDSL/01_gt4py_basics.ipynb
+3 −3 examples/NDSL/02_NDSL_basics.ipynb
+1 −1 external/gt4py
+0 −1 mkdocs.yml
+2 −3 ndsl/__init__.py
+15 −4 ndsl/boilerplate.py
+0 −118 ndsl/comm/null_comm.py
+0 −15 ndsl/comm/partitioner.py
+6 −4 ndsl/dsl/dace/dace_config.py
+64 −0 ndsl/dsl/dace/dace_executable.py
+68 −0 ndsl/dsl/dace/labeler.py
+96 −66 ndsl/dsl/dace/orchestration.py
+54 −22 ndsl/dsl/dace/stree/optimizations/axis_merge.py
+70 −9 ndsl/dsl/dace/stree/optimizations/refine_transients.py
+23 −0 ndsl/dsl/gt4py_utils.py
+7 −6 ndsl/dsl/ndsl_runtime.py
+17 −0 ndsl/dsl/stencil.py
+1 −0 ndsl/grid/generation.py
+0 −20 ndsl/initialization/allocator.py
+35 −5 ndsl/initialization/subtile_grid_sizer.py
+0 −0 ndsl/internal/__init__.py
+43 −0 ndsl/internal/python_extensions.py
+3 −73 ndsl/monitor/zarr_monitor.py
+11 −6 ndsl/quantity/__init__.py
+4 −18 ndsl/quantity/local.py
+16 −18 ndsl/quantity/metadata.py
+62 −82 ndsl/quantity/quantity.py
+327 −23 ndsl/quantity/state.py
+26 −2 ndsl/stencils/__init__.py
+86 −7 ndsl/stencils/basic_operations.py
+4 −4 ndsl/stencils/column_operations.py
+178 −126 ndsl/stencils/corners.py
+1 −0 ndsl/stencils/testing/grid.py
+11 −15 ndsl/stencils/testing/parallel_translate.py
+0 −19 ndsl/stencils/testing/test_translate.py
+27 −0 ndsl/xumpy/__init__.py
+61 −0 ndsl/xumpy/alloc.py
+42 −0 ndsl/xumpy/count_nonzero.py
+106 −0 ndsl/xumpy/minmax.py
+0 −4 pyproject.toml
+1 −0 setup.py
+4 −3 tests/conftest.py
+45 −1 tests/dsl/orchestration/test_call.py
+2 −0 tests/grid/test_eta.py
+0 −8 tests/initialization/test_allocator.py
+1 −0 tests/mpi/test_eta.py
+123 −34 tests/quantity/test_local.py
+0 −80 tests/quantity/test_quantity.py
+14 −2 tests/quantity/test_state.py
+1 −9 tests/stencils/test_stencils.py
+2 −2 tests/stree_optimizer/sdfg_stree_tools.py
+110 −2 tests/stree_optimizer/test_merge.py
+1 −1 tests/stree_optimizer/test_transient_refine.py
+56 −125 tests/test_basic_operations.py
+40 −0 tests/test_dimension_sizer.py
+0 −22 tests/test_get_tile_number.py
+1 −3 tests/test_halo_data_transformer.py
+2 −2 tests/test_ndsl_runtime.py
+0 −16 tests/test_null_comm.py
+0 −10 tests/test_partitioner.py
+35 −0 tests/test_xumpy.py
+0 −7 tests/test_zarr_monitor.py
19 changes: 13 additions & 6 deletions pace/diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def select_data(self, state: DycoreState):
origin=getattr(state, name).origin[0:2],
extent=getattr(state, name).extent[0:2],
units=getattr(state, name).units,
backend=getattr(state, name).backend,
)
return output

Expand Down Expand Up @@ -235,27 +236,33 @@ def cleanup(self):
pass


def _compute_column_integral(name: str, q_in: Quantity, delp: Quantity):
def _compute_column_integral(name: str, q_in: Quantity, delp: Quantity) -> Quantity:
"""
Compute column integrated mixing ratio (e.g., total liquid water path)

Args:
name: name of the tracer
q_in: tracer mixing ratio
delp: pressure thickness of atmospheric layer

Returns:
The column integral.
"""
assert len(q_in.dims) > 2
if len(q_in.dims) <= 2:
raise RuntimeError("This function assumes that q_in is at least 3-dimensional.")

if q_in.dims[2] != Z_DIM:
raise NotImplementedError(
"this function assumes the z-dimension is the third dimension"
raise RuntimeError(
"This function assumes the z-dimension is the third dimension"
)

k_slice = slice(q_in.origin[2], q_in.origin[2] + q_in.extent[2])
column_integral = Quantity(
return Quantity(
RGRAV
* q_in.np.sum(q_in.data[:, :, k_slice] * delp.data[:, :, k_slice], axis=2),
dims=tuple(q_in.dims[:2]) + tuple(q_in.dims[3:]),
origin=q_in.metadata.origin[0:2],
extent=(q_in.metadata.extent[0], q_in.metadata.extent[1]),
units="kg/m**2",
backend=q_in.backend,
)
return column_integral