From 7fc2da9d0339bc40c1d8b62d596c6742e8cc3745 Mon Sep 17 00:00:00 2001 From: Frank Malatino Date: Wed, 13 Mar 2024 11:06:35 -0400 Subject: [PATCH 1/8] Changes reflecting new import methods of NDSL --- examples/standalone/runfile/acoustics.py | 42 +++++++++++-------- examples/standalone/runfile/compile.py | 3 +- examples/standalone/runfile/dynamics.py | 36 +++++++++------- pyFV3/__init__.py | 4 +- pyFV3/dycore_state.py | 6 +-- pyFV3/initialization/analytic_init.py | 5 +-- pyFV3/initialization/init_utils.py | 7 +++- .../test_cases/initialize_baroclinic.py | 8 ++-- .../test_cases/initialize_tc.py | 5 +-- pyFV3/stencils/a2b_ord4.py | 4 +- pyFV3/stencils/c_sw.py | 5 +-- pyFV3/stencils/d2a2c_vect.py | 4 +- pyFV3/stencils/d_sw.py | 7 +--- pyFV3/stencils/del2cubed.py | 5 +-- pyFV3/stencils/delnflux.py | 6 +-- pyFV3/stencils/divergence_damping.py | 5 +-- pyFV3/stencils/dyn_core.py | 18 ++++---- pyFV3/stencils/fillz.py | 5 +-- pyFV3/stencils/fv_dynamics.py | 11 ++--- pyFV3/stencils/fv_subgridz.py | 4 +- pyFV3/stencils/fvtp2d.py | 4 +- pyFV3/stencils/fxadv.py | 3 +- pyFV3/stencils/map_single.py | 4 +- pyFV3/stencils/mapn_tracer.py | 5 +-- pyFV3/stencils/neg_adj3.py | 3 +- pyFV3/stencils/nh_p_grad.py | 4 +- pyFV3/stencils/pk3_halo.py | 3 +- pyFV3/stencils/ray_fast.py | 3 +- pyFV3/stencils/remap_profile.py | 4 +- pyFV3/stencils/remapping.py | 9 ++-- pyFV3/stencils/riem_solver3.py | 4 +- pyFV3/stencils/riem_solver_c.py | 3 +- pyFV3/stencils/saturation_adjustment.py | 2 +- pyFV3/stencils/sim1_solver.py | 2 +- pyFV3/stencils/tracer_2d_1l.py | 14 ++++--- pyFV3/stencils/updatedzc.py | 4 +- pyFV3/stencils/updatedzd.py | 5 +-- pyFV3/stencils/xppm.py | 2 +- pyFV3/stencils/yppm.py | 3 +- pyFV3/testing/__init__.py | 2 - pyFV3/testing/map_single.py | 3 +- pyFV3/testing/translate_dyncore.py | 6 +-- pyFV3/testing/translate_fvdynamics.py | 11 ++--- pyFV3/testing/validation.py | 2 +- pyFV3/utils/functional_validation.py | 2 +- pyFV3/wrappers/__init__.py | 10 ----- pyFV3/wrappers/geos_wrapper.py | 28 +++++++------ tests/mpi/test_doubly_periodic.py | 15 ++++--- .../savepoint/translate/translate_a2b_ord4.py | 4 +- tests/savepoint/translate/translate_c_sw.py | 4 +- .../savepoint/translate/translate_corners.py | 3 +- .../translate/translate_cubedtolatlon.py | 4 +- .../translate/translate_d2a2c_vect.py | 3 +- tests/savepoint/translate/translate_d_sw.py | 3 +- .../translate/translate_del2cubed.py | 3 +- .../translate/translate_del6vtflux.py | 3 +- .../savepoint/translate/translate_delnflux.py | 3 +- .../translate/translate_divergencedamping.py | 3 +- tests/savepoint/translate/translate_fillz.py | 5 +-- .../translate/translate_fvsubgridz.py | 3 +- tests/savepoint/translate/translate_fvtp2d.py | 3 +- tests/savepoint/translate/translate_fxadv.py | 3 +- tests/savepoint/translate/translate_grid.py | 8 ++-- .../translate/translate_haloupdate.py | 3 +- .../translate/translate_init_case.py | 6 +-- .../translate/translate_last_step.py | 3 +- .../translate/translate_moistcvpluspkz_2d.py | 3 +- .../translate/translate_moistcvpluspt_2d.py | 2 +- .../savepoint/translate/translate_neg_adj3.py | 3 +- .../translate/translate_nh_p_grad.py | 3 +- .../savepoint/translate/translate_pe_halo.py | 3 +- .../savepoint/translate/translate_pk3_halo.py | 3 +- ...ssureadjustedtemperature_nonhydrostatic.py | 3 +- tests/savepoint/translate/translate_qsinit.py | 3 +- .../savepoint/translate/translate_ray_fast.py | 3 +- .../translate/translate_remapping.py | 3 +- .../translate/translate_riem_solver3.py | 3 +- .../translate/translate_riem_solver_c.py | 3 +- .../translate/translate_satadjust3d.py | 3 +- .../translate/translate_tracer2d1l.py | 3 +- .../translate/translate_updatedzc.py | 3 +- .../translate/translate_updatedzd.py | 3 +- tests/savepoint/translate/translate_xppm.py | 3 +- tests/savepoint/translate/translate_xtp_u.py | 3 +- tests/savepoint/translate/translate_yppm.py | 3 +- tests/savepoint/translate/translate_ytp_v.py | 3 +- 86 files changed, 196 insertions(+), 280 deletions(-) diff --git a/examples/standalone/runfile/acoustics.py b/examples/standalone/runfile/acoustics.py index b1b4dcb..be69441 100755 --- a/examples/standalone/runfile/acoustics.py +++ b/examples/standalone/runfile/acoustics.py @@ -9,13 +9,21 @@ import yaml from timing import collect_data_and_write_to_file -import ndsl.dsl -import ndsl.util as util -from ndsl.comm.null_comm import NullComm -from ndsl.dsl.dace.orchestration import DaceConfig -from ndsl.dsl.stencil import CompilationConfig -from ndsl.stencils.testing.grid import Grid -from pyFV3 import AcousticDynamics, DynamicalCoreConfig, TranslateDynCore +from ndsl import ( + CompilationConfig, + CubedSphereCommunicator, + CubedSpherePartitioner, + DaceConfig, + NullComm, + StencilConfig, + StencilFactory, + TilePartitioner, +) +from ndsl.performance import Timer +from ndsl.stencils.testing import Grid +from pyFV3 import DynamicalCoreConfig +from pyFV3.stencils import AcousticDynamics +from pyFV3.testing import TranslateDynCore try: @@ -46,7 +54,7 @@ def initialize_serializer(data_directory: str, rank: int = 0) -> serialbox.Seria def read_input_data( grid: Grid, namelist: DynamicalCoreConfig, - stencil_factory: ndsl.dsl.stencil.StencilFactory, + stencil_factory: StencilFactory, serializer: serialbox.Serializer, ) -> Dict[str, Any]: """Uses the serializer to read the input data from disk""" @@ -81,17 +89,17 @@ def get_state_from_input( def set_up_communicator( disable_halo_exchange: bool, layout: Tuple[int, int], -) -> Tuple[Optional[MPI.Comm], Optional[util.CubedSphereCommunicator]]: - partitioner = util.CubedSpherePartitioner(util.TilePartitioner(layout)) +) -> Tuple[Optional[MPI.Comm], Optional[CubedSphereCommunicator]]: + partitioner = CubedSpherePartitioner(TilePartitioner(layout)) if MPI is not None: comm = MPI.COMM_WORLD else: comm = None if not disable_halo_exchange: assert comm is not None - cube_comm = util.CubedSphereCommunicator(comm, partitioner) + cube_comm = CubedSphereCommunicator(comm, partitioner) else: - cube_comm = util.CubedSphereCommunicator(NullComm(0, 0), partitioner) + cube_comm = CubedSphereCommunicator(NullComm(0, 0), partitioner) return comm, cube_comm @@ -106,10 +114,10 @@ def get_experiment_name( )["experiment_name"] -def initialize_timers() -> Tuple[util.Timer, util.Timer, List, List]: - total_timer = util.Timer() +def initialize_timers() -> Tuple[Timer, Timer, List, List]: + total_timer = Timer() total_timer.start("total") - timestep_timer = util.Timer() + timestep_timer = Timer() return total_timer, timestep_timer, [], [] @@ -148,13 +156,13 @@ def driver( tile_nx=dycore_config.npx, tile_nz=dycore_config.npz, ) - stencil_config = ndsl.dsl.stencil.StencilConfig( + stencil_config = StencilConfig( compilation_config=CompilationConfig( backend=backend, rebuild=False, validate_args=True ), dace_config=dace_config, ) - stencil_factory = ndsl.dsl.stencil.StencilFactory( + stencil_factory = StencilFactory( config=stencil_config, grid_indexing=grid.grid_indexing, ) diff --git a/examples/standalone/runfile/compile.py b/examples/standalone/runfile/compile.py index 29005f2..a811e1c 100755 --- a/examples/standalone/runfile/compile.py +++ b/examples/standalone/runfile/compile.py @@ -8,8 +8,7 @@ import f90nml import gt4py.cartesian.config -import ndsl.dsl.stencil # noqa: F401 -from ndsl.comm.null_comm import NullComm +from ndsl import NullComm from pyFV3 import DynamicalCoreConfig diff --git a/examples/standalone/runfile/dynamics.py b/examples/standalone/runfile/dynamics.py index 803223c..8832600 100755 --- a/examples/standalone/runfile/dynamics.py +++ b/examples/standalone/runfile/dynamics.py @@ -17,16 +17,22 @@ # NOTE: we need to import dsl.stencil prior to # ndsl.util, otherwise xarray precedes gt4py, causing # very strange errors on some systems (e.g. daint) -import ndsl.dsl.stencil -import ndsl.util as util -from ndsl.comm.null_comm import NullComm -from ndsl.dsl import StencilFactory -from ndsl.dsl.dace.orchestration import DaceConfig +from ndsl import ( + CompilationConfig, + CubedSphereCommunicator, + CubedSpherePartitioner, + DaceConfig, + NullComm, + StencilConfig, + StencilFactory, + TilePartitioner, +) from ndsl.grid import DampingCoefficients, GridData, MetricTerms -from ndsl.stencils.testing import dataset_to_dict -from ndsl.stencils.testing.grid import Grid -from pyFV3 import DycoreState, DynamicalCore, DynamicalCoreConfig, TranslateFVDynamics +from ndsl.performance import Timer +from ndsl.stencils.testing import Grid, dataset_to_dict +from pyFV3 import DycoreState, DynamicalCore, DynamicalCoreConfig from pyFV3.initialization.test_cases import init_baroclinic_state +from pyFV3.testing import TranslateFVDynamics def parse_args() -> Namespace: @@ -208,10 +214,8 @@ def setup_dycore( dycore_config, mpi_comm, backend, is_baroclinic_test_case, data_dir ) -> Tuple[DynamicalCore, DycoreState, StencilFactory]: # set up grid-dependent helper structures - partitioner = util.CubedSpherePartitioner( - util.TilePartitioner(dycore_config.layout) - ) - communicator = util.CubedSphereCommunicator(mpi_comm, partitioner) + partitioner = CubedSpherePartitioner(TilePartitioner(dycore_config.layout)) + communicator = CubedSphereCommunicator(mpi_comm, partitioner) grid = Grid.from_namelist(dycore_config, mpi_comm.rank, backend) dace_config = DaceConfig( @@ -220,8 +224,8 @@ def setup_dycore( tile_nx=dycore_config.npx, tile_nz=dycore_config.npz, ) - stencil_config = ndsl.dsl.stencil.StencilConfig( - compilation_config=ndsl.dsl.stencil.CompilationConfig( + stencil_config = StencilConfig( + compilation_config=CompilationConfig( backend=backend, rebuild=False, validate_args=False ), dace_config=dace_config, @@ -265,7 +269,7 @@ def setup_dycore( if __name__ == "__main__": - timer = util.Timer() + timer = Timer() timer.start("total") with timer.clock("initialization"): args = parse_args() @@ -308,7 +312,7 @@ def setup_dycore( hits_per_step = [] # we set up a specific timer for each timestep # that is cleared after so we get individual statistics - timestep_timer = util.Timer() + timestep_timer = Timer() for i in range(args.time_step - 1): with timestep_timer.clock("mainloop"): if rank == 0: diff --git a/pyFV3/__init__.py b/pyFV3/__init__.py index dfb089c..968e970 100644 --- a/pyFV3/__init__.py +++ b/pyFV3/__init__.py @@ -1,6 +1,8 @@ from ._config import DynamicalCoreConfig from .dycore_state import DycoreState -from .stencils import DryConvectiveAdjustment, DynamicalCore +from .stencils.fv_dynamics import DynamicalCore +from .stencils.fv_subgridz import DryConvectiveAdjustment +from .wrappers.geos_wrapper import GeosDycoreWrapper """ diff --git a/pyFV3/dycore_state.py b/pyFV3/dycore_state.py index bcce719..9058e4d 100644 --- a/pyFV3/dycore_state.py +++ b/pyFV3/dycore_state.py @@ -4,7 +4,7 @@ import xarray as xr import ndsl.dsl.gt4py_utils as gt_utils -from ndsl.comm.communicator import Communicator +from ndsl import GridSizer, Quantity, QuantityFactory from ndsl.constants import ( X_DIM, X_INTERFACE_DIM, @@ -14,10 +14,8 @@ Z_INTERFACE_DIM, ) from ndsl.dsl.typing import Float -from ndsl.initialization.allocator import QuantityFactory -from ndsl.initialization.sizer import GridSizer -from ndsl.quantity import Quantity from ndsl.restart._legacy_restart import open_restart +from ndsl.typing import Communicator @dataclass() diff --git a/pyFV3/initialization/analytic_init.py b/pyFV3/initialization/analytic_init.py index 04a8874..85d6edd 100644 --- a/pyFV3/initialization/analytic_init.py +++ b/pyFV3/initialization/analytic_init.py @@ -1,9 +1,8 @@ from enum import Enum -from ndsl.comm.communicator import Communicator, CubedSphereCommunicator +from ndsl import CubedSphereCommunicator, MetaEnumStr, QuantityFactory from ndsl.grid import GridData -from ndsl.initialization.allocator import QuantityFactory -from ndsl.utils import MetaEnumStr +from ndsl.typing import Communicator from pyFV3.dycore_state import DycoreState diff --git a/pyFV3/initialization/init_utils.py b/pyFV3/initialization/init_utils.py index 3642cb1..da93ebc 100644 --- a/pyFV3/initialization/init_utils.py +++ b/pyFV3/initialization/init_utils.py @@ -6,9 +6,12 @@ import ndsl.constants as constants from ndsl.dsl.typing import Float -from ndsl.grid import lon_lat_midpoint from ndsl.grid.eta import SURFACE_PRESSURE, compute_eta, vertical_coordinate -from ndsl.grid.gnomonic import get_lonlat_vect, get_unit_vector_direction +from ndsl.grid.gnomonic import ( + get_lonlat_vect, + get_unit_vector_direction, + lon_lat_midpoint, +) from pyFV3.dycore_state import DycoreState diff --git a/pyFV3/initialization/test_cases/initialize_baroclinic.py b/pyFV3/initialization/test_cases/initialize_baroclinic.py index 8b55e1e..1719605 100644 --- a/pyFV3/initialization/test_cases/initialize_baroclinic.py +++ b/pyFV3/initialization/test_cases/initialize_baroclinic.py @@ -4,11 +4,11 @@ import ndsl.constants as constants import ndsl.dsl.gt4py_utils as utils -import pyFV3.initialization.init_utils as init_utils -from ndsl.comm.communicator import CubedSphereCommunicator -from ndsl.grid import GridData, great_circle_distance_lon_lat, lon_lat_midpoint -from ndsl.initialization.allocator import QuantityFactory +from ndsl import CubedSphereCommunicator, QuantityFactory +from ndsl.grid import GridData +from ndsl.grid.gnomonic import great_circle_distance_lon_lat, lon_lat_midpoint from pyFV3.dycore_state import DycoreState +from pyFV3.initialization import init_utils # maximum windspeed amplitude - close to windspeed of zonal-mean time-mean diff --git a/pyFV3/initialization/test_cases/initialize_tc.py b/pyFV3/initialization/test_cases/initialize_tc.py index 765ea54..05f6720 100644 --- a/pyFV3/initialization/test_cases/initialize_tc.py +++ b/pyFV3/initialization/test_cases/initialize_tc.py @@ -1,11 +1,10 @@ import numpy as np import ndsl.constants as constants -import pyFV3.initialization.init_utils as init_utils -from ndsl.comm.communicator import CubedSphereCommunicator +from ndsl import CubedSphereCommunicator, QuantityFactory from ndsl.grid import GridData, great_circle_distance_lon_lat -from ndsl.initialization.allocator import QuantityFactory from pyFV3.dycore_state import DycoreState +from pyFV3.initialization import init_utils def _calculate_distance_from_tc_center(pe_v, ps_v, muv, calc, tc_properties): diff --git a/pyFV3/stencils/a2b_ord4.py b/pyFV3/stencils/a2b_ord4.py index e5b0d9d..39fd462 100644 --- a/pyFV3/stencils/a2b_ord4.py +++ b/pyFV3/stencils/a2b_ord4.py @@ -11,12 +11,10 @@ sqrt, ) +from ndsl import GridIndexing, QuantityFactory, StencilFactory, orchestrate from ndsl.constants import X_DIM, X_INTERFACE_DIM, Y_DIM, Y_INTERFACE_DIM, Z_DIM -from ndsl.dsl.dace.orchestration import orchestrate -from ndsl.dsl.stencil import GridIndexing, StencilFactory from ndsl.dsl.typing import Float, FloatField, FloatFieldI, FloatFieldIJ from ndsl.grid import GridData -from ndsl.initialization.allocator import QuantityFactory from pyFV3.stencils.basic_operations import copy_defn diff --git a/pyFV3/stencils/c_sw.py b/pyFV3/stencils/c_sw.py index 640b2f9..9208e47 100644 --- a/pyFV3/stencils/c_sw.py +++ b/pyFV3/stencils/c_sw.py @@ -7,13 +7,10 @@ region, ) +from ndsl import Quantity, QuantityFactory, StencilFactory, orchestrate from ndsl.constants import X_DIM, X_INTERFACE_DIM, Y_DIM, Y_INTERFACE_DIM, Z_DIM -from ndsl.dsl.dace.orchestration import orchestrate -from ndsl.dsl.stencil import StencilFactory from ndsl.dsl.typing import Float, FloatField, FloatFieldIJ from ndsl.grid import GridData -from ndsl.initialization.allocator import QuantityFactory -from ndsl.quantity import Quantity from ndsl.stencils import corners from pyFV3.stencils.d2a2c_vect import DGrid2AGrid2CGridVectors diff --git a/pyFV3/stencils/d2a2c_vect.py b/pyFV3/stencils/d2a2c_vect.py index 8a44947..1d62208 100644 --- a/pyFV3/stencils/d2a2c_vect.py +++ b/pyFV3/stencils/d2a2c_vect.py @@ -1,12 +1,10 @@ import gt4py.cartesian.gtscript as gtscript from gt4py.cartesian.gtscript import PARALLEL, computation, horizontal, interval, region +from ndsl import QuantityFactory, StencilFactory, orchestrate from ndsl.constants import X_DIM, Y_DIM, Z_DIM -from ndsl.dsl.dace.orchestration import orchestrate -from ndsl.dsl.stencil import StencilFactory from ndsl.dsl.typing import Float, FloatField, FloatFieldIJ from ndsl.grid import GridData -from ndsl.initialization.allocator import QuantityFactory from ndsl.stencils import corners from pyFV3.stencils.a2b_ord4 import a1, a2, lagrange_x_func, lagrange_y_func diff --git a/pyFV3/stencils/d_sw.py b/pyFV3/stencils/d_sw.py index 7f16b6a..0742032 100644 --- a/pyFV3/stencils/d_sw.py +++ b/pyFV3/stencils/d_sw.py @@ -10,15 +10,12 @@ region, ) -import pyFV3.stencils.delnflux as delnflux +from ndsl import Quantity, QuantityFactory, StencilFactory, orchestrate from ndsl.constants import X_DIM, X_INTERFACE_DIM, Y_DIM, Y_INTERFACE_DIM, Z_DIM -from ndsl.dsl.dace.orchestration import orchestrate -from ndsl.dsl.stencil import StencilFactory from ndsl.dsl.typing import Float, FloatField, FloatFieldIJ, FloatFieldK from ndsl.grid import DampingCoefficients, GridData -from ndsl.initialization.allocator import QuantityFactory -from ndsl.quantity import Quantity from pyFV3._config import DGridShallowWaterLagrangianDynamicsConfig +from pyFV3.stencils import delnflux from pyFV3.stencils.d2a2c_vect import contravariant from pyFV3.stencils.delnflux import DelnFluxNoSG from pyFV3.stencils.divergence_damping import DivergenceDamping diff --git a/pyFV3/stencils/del2cubed.py b/pyFV3/stencils/del2cubed.py index 522bd17..446ab70 100644 --- a/pyFV3/stencils/del2cubed.py +++ b/pyFV3/stencils/del2cubed.py @@ -1,12 +1,11 @@ from gt4py.cartesian.gtscript import PARALLEL, computation, horizontal, interval, region import ndsl.stencils.corners as corners +from ndsl import QuantityFactory, StencilFactory, orchestrate from ndsl.constants import X_DIM, X_INTERFACE_DIM, Y_DIM, Y_INTERFACE_DIM, Z_DIM -from ndsl.dsl.dace.orchestration import orchestrate -from ndsl.dsl.stencil import StencilFactory, get_stencils_with_varied_bounds +from ndsl.dsl.stencil import get_stencils_with_varied_bounds from ndsl.dsl.typing import Float, FloatField, FloatFieldIJ, cast_to_index3d from ndsl.grid import DampingCoefficients -from ndsl.initialization.allocator import QuantityFactory from pyFV3.stencils.basic_operations import copy_defn diff --git a/pyFV3/stencils/delnflux.py b/pyFV3/stencils/delnflux.py index ed975c5..46f9799 100644 --- a/pyFV3/stencils/delnflux.py +++ b/pyFV3/stencils/delnflux.py @@ -10,13 +10,11 @@ region, ) +from ndsl import Quantity, QuantityFactory, StencilFactory, orchestrate from ndsl.constants import X_DIM, X_INTERFACE_DIM, Y_DIM, Y_INTERFACE_DIM, Z_DIM -from ndsl.dsl.dace.orchestration import orchestrate -from ndsl.dsl.stencil import StencilFactory, get_stencils_with_varied_bounds +from ndsl.dsl.stencil import get_stencils_with_varied_bounds from ndsl.dsl.typing import Float, FloatField, FloatFieldIJ, FloatFieldK from ndsl.grid import DampingCoefficients -from ndsl.initialization.allocator import QuantityFactory -from ndsl.quantity import Quantity def calc_damp(damp_c: Quantity, da_min: Float, nord: Quantity) -> Quantity: diff --git a/pyFV3/stencils/divergence_damping.py b/pyFV3/stencils/divergence_damping.py index 54b095a..4ba484c 100644 --- a/pyFV3/stencils/divergence_damping.py +++ b/pyFV3/stencils/divergence_damping.py @@ -11,13 +11,12 @@ import ndsl.stencils.corners as corners import pyFV3.stencils.basic_operations as basic +from ndsl import Quantity, QuantityFactory, StencilFactory from ndsl.constants import X_DIM, X_INTERFACE_DIM, Y_DIM, Y_INTERFACE_DIM, Z_DIM from ndsl.dsl.dace.orchestration import dace_inhibitor, orchestrate -from ndsl.dsl.stencil import StencilFactory, get_stencils_with_varied_bounds +from ndsl.dsl.stencil import get_stencils_with_varied_bounds from ndsl.dsl.typing import Float, FloatField, FloatFieldIJ, FloatFieldK from ndsl.grid import DampingCoefficients, GridData -from ndsl.initialization.allocator import QuantityFactory -from ndsl.quantity import Quantity from pyFV3.stencils.a2b_ord4 import AGrid2BGridFourthOrder, doubly_periodic_a2b_ord4 from pyFV3.stencils.d2a2c_vect import contravariant diff --git a/pyFV3/stencils/dyn_core.py b/pyFV3/stencils/dyn_core.py index 7a92fd3..15c2737 100644 --- a/pyFV3/stencils/dyn_core.py +++ b/pyFV3/stencils/dyn_core.py @@ -21,8 +21,15 @@ import pyFV3.stencils.temperature_adjust as temperature_adjust import pyFV3.stencils.updatedzc as updatedzc import pyFV3.stencils.updatedzd as updatedzd -from ndsl.checkpointer import Checkpointer, NullCheckpointer -from ndsl.comm.communicator import Communicator +from ndsl import ( + GridIndexing, + Quantity, + QuantityFactory, + StencilFactory, + WrappedHaloUpdater, + orchestrate, +) +from ndsl.checkpointer import NullCheckpointer from ndsl.constants import ( X_DIM, X_INTERFACE_DIM, @@ -31,13 +38,10 @@ Z_DIM, Z_INTERFACE_DIM, ) -from ndsl.dsl.dace.orchestration import dace_inhibitor, orchestrate -from ndsl.dsl.dace.wrapped_halo_exchange import WrappedHaloUpdater -from ndsl.dsl.stencil import GridIndexing, StencilFactory +from ndsl.dsl.dace.orchestration import dace_inhibitor from ndsl.dsl.typing import Float, FloatField, FloatFieldIJ from ndsl.grid import DampingCoefficients, GridData -from ndsl.initialization.allocator import QuantityFactory -from ndsl.quantity import Quantity +from ndsl.typing import Checkpointer, Communicator from pyFV3._config import AcousticDynamicsConfig from pyFV3.dycore_state import DycoreState from pyFV3.stencils.c_sw import CGridShallowWaterDynamics diff --git a/pyFV3/stencils/fillz.py b/pyFV3/stencils/fillz.py index a736a3e..5cd5c23 100644 --- a/pyFV3/stencils/fillz.py +++ b/pyFV3/stencils/fillz.py @@ -4,12 +4,9 @@ from gt4py.cartesian.gtscript import BACKWARD, FORWARD, PARALLEL, computation, interval import ndsl.dsl.gt4py_utils as utils +from ndsl import Quantity, QuantityFactory, StencilFactory, orchestrate from ndsl.constants import X_DIM, Y_DIM, Z_DIM -from ndsl.dsl.dace import orchestrate -from ndsl.dsl.stencil import StencilFactory from ndsl.dsl.typing import Float, FloatField, FloatFieldIJ, IntFieldIJ -from ndsl.initialization.allocator import QuantityFactory -from ndsl.quantity import Quantity @typing.no_type_check diff --git a/pyFV3/stencils/fv_dynamics.py b/pyFV3/stencils/fv_dynamics.py index ee8045d..cc61c62 100644 --- a/pyFV3/stencils/fv_dynamics.py +++ b/pyFV3/stencils/fv_dynamics.py @@ -6,20 +6,17 @@ import ndsl.dsl.gt4py_utils as utils import pyFV3.stencils.moist_cv as moist_cv -from ndsl.checkpointer import Checkpointer, NullCheckpointer -from ndsl.comm.communicator import Communicator +from ndsl import Quantity, QuantityFactory, StencilFactory, WrappedHaloUpdater +from ndsl.checkpointer import NullCheckpointer from ndsl.comm.mpi import MPI from ndsl.constants import KAPPA, NQ, X_DIM, Y_DIM, Z_DIM, Z_INTERFACE_DIM, ZVIR from ndsl.dsl.dace.orchestration import dace_inhibitor, orchestrate -from ndsl.dsl.dace.wrapped_halo_exchange import WrappedHaloUpdater -from ndsl.dsl.stencil import StencilFactory from ndsl.dsl.typing import Float, FloatField from ndsl.grid import DampingCoefficients, GridData -from ndsl.initialization.allocator import QuantityFactory from ndsl.logging import ndsl_log -from ndsl.performance.timer import NullTimer, Timer -from ndsl.quantity import Quantity +from ndsl.performance import NullTimer, Timer from ndsl.stencils.c2l_ord import CubedToLatLon +from ndsl.typing import Checkpointer, Communicator from pyFV3._config import DynamicalCoreConfig from pyFV3.dycore_state import DycoreState from pyFV3.stencils import fvtp2d, tracer_2d_1l diff --git a/pyFV3/stencils/fv_subgridz.py b/pyFV3/stencils/fv_subgridz.py index 8de8b7c..24f9c52 100644 --- a/pyFV3/stencils/fv_subgridz.py +++ b/pyFV3/stencils/fv_subgridz.py @@ -11,6 +11,7 @@ ) import ndsl.dsl.gt4py_utils as utils +from ndsl import Quantity, QuantityFactory, StencilFactory from ndsl.constants import ( C_ICE, C_LIQ, @@ -25,10 +26,7 @@ Z_DIM, ZVIR, ) -from ndsl.dsl.stencil import StencilFactory from ndsl.dsl.typing import Float, FloatField -from ndsl.initialization.allocator import QuantityFactory -from ndsl.quantity import Quantity from pyFV3.dycore_state import DycoreState from pyFV3.stencils.basic_operations import dim diff --git a/pyFV3/stencils/fvtp2d.py b/pyFV3/stencils/fvtp2d.py index 18e70d5..77aad22 100644 --- a/pyFV3/stencils/fvtp2d.py +++ b/pyFV3/stencils/fvtp2d.py @@ -4,12 +4,10 @@ from gt4py.cartesian.gtscript import PARALLEL, computation, horizontal, interval, region import ndsl.stencils.corners as corners +from ndsl import QuantityFactory, StencilFactory, orchestrate from ndsl.constants import X_DIM, Y_DIM, Z_DIM -from ndsl.dsl.dace.orchestration import orchestrate -from ndsl.dsl.stencil import StencilFactory from ndsl.dsl.typing import Float, FloatField, FloatFieldIJ from ndsl.grid import DampingCoefficients, GridData -from ndsl.initialization.allocator import QuantityFactory from pyFV3.stencils.delnflux import DelnFlux from pyFV3.stencils.xppm import XPiecewiseParabolic from pyFV3.stencils.yppm import YPiecewiseParabolic diff --git a/pyFV3/stencils/fxadv.py b/pyFV3/stencils/fxadv.py index 4e122b8..c1bf805 100644 --- a/pyFV3/stencils/fxadv.py +++ b/pyFV3/stencils/fxadv.py @@ -7,8 +7,7 @@ region, ) -from ndsl.dsl.dace import orchestrate -from ndsl.dsl.stencil import StencilFactory +from ndsl import StencilFactory, orchestrate from ndsl.dsl.typing import Float, FloatField, FloatFieldIJ from ndsl.grid import GridData from pyFV3.stencils.d2a2c_vect import contravariant diff --git a/pyFV3/stencils/map_single.py b/pyFV3/stencils/map_single.py index 8f9fd7c..dfe1e5d 100644 --- a/pyFV3/stencils/map_single.py +++ b/pyFV3/stencils/map_single.py @@ -2,11 +2,9 @@ from gt4py.cartesian.gtscript import FORWARD, PARALLEL, computation, interval +from ndsl import QuantityFactory, StencilFactory, orchestrate from ndsl.constants import X_DIM, Y_DIM, Z_DIM -from ndsl.dsl.dace import orchestrate -from ndsl.dsl.stencil import StencilFactory from ndsl.dsl.typing import Float, FloatField, FloatFieldIJ, IntFieldIJ # noqa: F401 -from ndsl.initialization.allocator import QuantityFactory from pyFV3.stencils.basic_operations import copy_defn from pyFV3.stencils.remap_profile import RemapProfile diff --git a/pyFV3/stencils/mapn_tracer.py b/pyFV3/stencils/mapn_tracer.py index 138a285..0696d14 100644 --- a/pyFV3/stencils/mapn_tracer.py +++ b/pyFV3/stencils/mapn_tracer.py @@ -1,12 +1,9 @@ from typing import Dict import ndsl.dsl.gt4py_utils as utils +from ndsl import Quantity, QuantityFactory, StencilFactory, orchestrate from ndsl.constants import X_DIM, Y_DIM, Z_DIM -from ndsl.dsl.dace.orchestration import orchestrate -from ndsl.dsl.stencil import StencilFactory from ndsl.dsl.typing import Float, FloatField -from ndsl.initialization.allocator import QuantityFactory -from ndsl.quantity import Quantity from pyFV3.stencils.fillz import FillNegativeTracerValues from pyFV3.stencils.map_single import MapSingle diff --git a/pyFV3/stencils/neg_adj3.py b/pyFV3/stencils/neg_adj3.py index 484cdfa..a9fc043 100644 --- a/pyFV3/stencils/neg_adj3.py +++ b/pyFV3/stencils/neg_adj3.py @@ -2,10 +2,9 @@ from gt4py.cartesian.gtscript import BACKWARD, FORWARD, PARALLEL, computation, interval import ndsl.constants as constants +from ndsl import QuantityFactory, StencilFactory from ndsl.constants import X_DIM, Y_DIM -from ndsl.dsl.stencil import StencilFactory from ndsl.dsl.typing import Float, FloatField, FloatFieldIJ -from ndsl.initialization.allocator import QuantityFactory ZVIR = constants.RVGAS / constants.RDGAS - 1.0 diff --git a/pyFV3/stencils/nh_p_grad.py b/pyFV3/stencils/nh_p_grad.py index 5c0804c..6a951c4 100644 --- a/pyFV3/stencils/nh_p_grad.py +++ b/pyFV3/stencils/nh_p_grad.py @@ -1,11 +1,9 @@ from gt4py.cartesian.gtscript import PARALLEL, computation, interval +from ndsl import QuantityFactory, StencilFactory, orchestrate from ndsl.constants import X_DIM, Y_DIM, Z_INTERFACE_DIM -from ndsl.dsl.dace import orchestrate -from ndsl.dsl.stencil import StencilFactory from ndsl.dsl.typing import Float, FloatField, FloatFieldIJ from ndsl.grid import GridData -from ndsl.initialization.allocator import QuantityFactory from pyFV3.stencils.a2b_ord4 import AGrid2BGridFourthOrder diff --git a/pyFV3/stencils/pk3_halo.py b/pyFV3/stencils/pk3_halo.py index 2d44a74..6daf945 100644 --- a/pyFV3/stencils/pk3_halo.py +++ b/pyFV3/stencils/pk3_halo.py @@ -1,9 +1,8 @@ from gt4py.cartesian.gtscript import FORWARD, computation, horizontal, interval, region +from ndsl import QuantityFactory, StencilFactory from ndsl.constants import X_DIM, Y_DIM -from ndsl.dsl.stencil import StencilFactory from ndsl.dsl.typing import Float, FloatField, FloatFieldIJ -from ndsl.initialization.allocator import QuantityFactory # TODO merge with pe_halo? reuse partials? diff --git a/pyFV3/stencils/ray_fast.py b/pyFV3/stencils/ray_fast.py index 1321038..dbc082d 100644 --- a/pyFV3/stencils/ray_fast.py +++ b/pyFV3/stencils/ray_fast.py @@ -13,9 +13,8 @@ ) import ndsl.constants as constants +from ndsl import StencilFactory, orchestrate from ndsl.constants import X_INTERFACE_DIM, Y_INTERFACE_DIM, Z_DIM -from ndsl.dsl.dace.orchestration import orchestrate -from ndsl.dsl.stencil import StencilFactory from ndsl.dsl.typing import Float, FloatField, FloatFieldK diff --git a/pyFV3/stencils/remap_profile.py b/pyFV3/stencils/remap_profile.py index 3b67029..f37d32d 100644 --- a/pyFV3/stencils/remap_profile.py +++ b/pyFV3/stencils/remap_profile.py @@ -10,11 +10,9 @@ interval, ) +from ndsl import QuantityFactory, StencilFactory, orchestrate from ndsl.constants import X_DIM, Y_DIM, Z_DIM, Z_INTERFACE_DIM -from ndsl.dsl.dace.orchestration import orchestrate -from ndsl.dsl.stencil import StencilFactory from ndsl.dsl.typing import BoolField, Float, FloatField, FloatFieldIJ -from ndsl.initialization.allocator import QuantityFactory @gtscript.function diff --git a/pyFV3/stencils/remapping.py b/pyFV3/stencils/remapping.py index c448aa3..78535d8 100644 --- a/pyFV3/stencils/remapping.py +++ b/pyFV3/stencils/remapping.py @@ -13,8 +13,7 @@ region, ) -import pyFV3.stencils.moist_cv as moist_cv -from ndsl.checkpointer import Checkpointer +from ndsl import Quantity, QuantityFactory, StencilFactory, orchestrate from ndsl.constants import ( X_DIM, X_INTERFACE_DIM, @@ -23,12 +22,10 @@ Z_DIM, Z_INTERFACE_DIM, ) -from ndsl.dsl.dace.orchestration import orchestrate -from ndsl.dsl.stencil import StencilFactory from ndsl.dsl.typing import Float, FloatField, FloatFieldIJ, FloatFieldK -from ndsl.initialization.allocator import QuantityFactory -from ndsl.quantity import Quantity +from ndsl.typing import Checkpointer from pyFV3._config import RemappingConfig +from pyFV3.stencils import moist_cv from pyFV3.stencils.basic_operations import adjust_divide_stencil from pyFV3.stencils.map_single import MapSingle from pyFV3.stencils.mapn_tracer import MapNTracer diff --git a/pyFV3/stencils/riem_solver3.py b/pyFV3/stencils/riem_solver3.py index f442bab..1f915ae 100644 --- a/pyFV3/stencils/riem_solver3.py +++ b/pyFV3/stencils/riem_solver3.py @@ -13,11 +13,9 @@ ) import ndsl.constants as constants +from ndsl import QuantityFactory, StencilFactory, orchestrate from ndsl.constants import X_DIM, Y_DIM, Z_DIM, Z_INTERFACE_DIM -from ndsl.dsl.dace import orchestrate -from ndsl.dsl.stencil import StencilFactory from ndsl.dsl.typing import Float, FloatField, FloatFieldIJ -from ndsl.initialization.allocator import QuantityFactory from pyFV3._config import RiemannConfig from pyFV3.stencils.sim1_solver import Sim1Solver diff --git a/pyFV3/stencils/riem_solver_c.py b/pyFV3/stencils/riem_solver_c.py index c28bac6..df90916 100644 --- a/pyFV3/stencils/riem_solver_c.py +++ b/pyFV3/stencils/riem_solver_c.py @@ -10,10 +10,9 @@ ) import ndsl.constants as constants +from ndsl import QuantityFactory, StencilFactory from ndsl.constants import X_DIM, Y_DIM, Z_DIM, Z_INTERFACE_DIM -from ndsl.dsl.stencil import StencilFactory from ndsl.dsl.typing import Float, FloatField, FloatFieldIJ -from ndsl.initialization.allocator import QuantityFactory from pyFV3.stencils.sim1_solver import Sim1Solver diff --git a/pyFV3/stencils/saturation_adjustment.py b/pyFV3/stencils/saturation_adjustment.py index 0ddbb43..45cd98f 100644 --- a/pyFV3/stencils/saturation_adjustment.py +++ b/pyFV3/stencils/saturation_adjustment.py @@ -12,7 +12,7 @@ ) import ndsl.constants as constants -from ndsl.dsl.stencil import StencilFactory +from ndsl import StencilFactory from ndsl.dsl.typing import Float, FloatField, FloatFieldIJ from pyFV3._config import SatAdjustConfig from pyFV3.stencils.basic_operations import dim diff --git a/pyFV3/stencils/sim1_solver.py b/pyFV3/stencils/sim1_solver.py index 3d249ea..0fcd8f2 100644 --- a/pyFV3/stencils/sim1_solver.py +++ b/pyFV3/stencils/sim1_solver.py @@ -11,8 +11,8 @@ ) import ndsl.constants as constants +from ndsl import StencilFactory from ndsl.constants import X_DIM, Y_DIM, Z_INTERFACE_DIM -from ndsl.dsl.stencil import StencilFactory from ndsl.dsl.typing import Float, FloatField, FloatFieldIJ diff --git a/pyFV3/stencils/tracer_2d_1l.py b/pyFV3/stencils/tracer_2d_1l.py index 64ae634..27514a3 100644 --- a/pyFV3/stencils/tracer_2d_1l.py +++ b/pyFV3/stencils/tracer_2d_1l.py @@ -4,7 +4,13 @@ import gt4py.cartesian.gtscript as gtscript from gt4py.cartesian.gtscript import PARALLEL, computation, horizontal, interval, region -from ndsl.comm.communicator import Communicator +from ndsl import ( + Quantity, + QuantityFactory, + StencilFactory, + WrappedHaloUpdater, + orchestrate, +) from ndsl.constants import ( N_HALO_DEFAULT, X_DIM, @@ -13,12 +19,8 @@ Y_INTERFACE_DIM, Z_DIM, ) -from ndsl.dsl.dace.orchestration import orchestrate -from ndsl.dsl.dace.wrapped_halo_exchange import WrappedHaloUpdater -from ndsl.dsl.stencil import StencilFactory from ndsl.dsl.typing import Float, FloatField, FloatFieldIJ -from ndsl.initialization.allocator import QuantityFactory -from ndsl.quantity import Quantity +from ndsl.typing import Communicator from pyFV3.stencils.fvtp2d import FiniteVolumeTransport diff --git a/pyFV3/stencils/updatedzc.py b/pyFV3/stencils/updatedzc.py index f327ce0..60ec175 100644 --- a/pyFV3/stencils/updatedzc.py +++ b/pyFV3/stencils/updatedzc.py @@ -2,11 +2,9 @@ from gt4py.cartesian.gtscript import BACKWARD, FORWARD, PARALLEL, computation, interval import ndsl.constants as constants +from ndsl import Quantity, QuantityFactory, StencilFactory from ndsl.constants import X_DIM, Y_DIM, Z_DIM -from ndsl.dsl.stencil import StencilFactory from ndsl.dsl.typing import Float, FloatField, FloatFieldIJ, FloatFieldK -from ndsl.initialization.allocator import QuantityFactory -from ndsl.quantity import Quantity from ndsl.stencils import corners diff --git a/pyFV3/stencils/updatedzd.py b/pyFV3/stencils/updatedzd.py index df5676b..abbdbeb 100644 --- a/pyFV3/stencils/updatedzd.py +++ b/pyFV3/stencils/updatedzd.py @@ -4,6 +4,7 @@ from gt4py.cartesian.gtscript import BACKWARD, FORWARD, PARALLEL, computation, interval import ndsl.constants as constants +from ndsl import Quantity, QuantityFactory, StencilFactory, orchestrate from ndsl.constants import ( X_DIM, X_INTERFACE_DIM, @@ -12,12 +13,8 @@ Z_DIM, Z_INTERFACE_DIM, ) -from ndsl.dsl.dace.orchestration import orchestrate -from ndsl.dsl.stencil import StencilFactory from ndsl.dsl.typing import Float, FloatField, FloatFieldIJ, FloatFieldK from ndsl.grid import DampingCoefficients, GridData -from ndsl.initialization.allocator import QuantityFactory -from ndsl.quantity import Quantity from pyFV3.stencils.delnflux import DelnFluxNoSG from pyFV3.stencils.fvtp2d import FiniteVolumeTransport diff --git a/pyFV3/stencils/xppm.py b/pyFV3/stencils/xppm.py index 5a4bf35..c5d3960 100644 --- a/pyFV3/stencils/xppm.py +++ b/pyFV3/stencils/xppm.py @@ -9,7 +9,7 @@ region, ) -from ndsl.dsl.stencil import StencilFactory +from ndsl import StencilFactory from ndsl.dsl.typing import FloatField, FloatFieldIJ, Index3D from pyFV3.stencils import ppm from pyFV3.stencils.basic_operations import sign diff --git a/pyFV3/stencils/yppm.py b/pyFV3/stencils/yppm.py index b353de5..160b738 100644 --- a/pyFV3/stencils/yppm.py +++ b/pyFV3/stencils/yppm.py @@ -9,8 +9,7 @@ region, ) -from ndsl.dsl.dace.orchestration import orchestrate -from ndsl.dsl.stencil import StencilFactory +from ndsl import StencilFactory, orchestrate from ndsl.dsl.typing import FloatField, FloatFieldIJ, Index3D from pyFV3.stencils import ppm from pyFV3.stencils.basic_operations import sign diff --git a/pyFV3/testing/__init__.py b/pyFV3/testing/__init__.py index 206717c..19aa4c4 100644 --- a/pyFV3/testing/__init__.py +++ b/pyFV3/testing/__init__.py @@ -1,12 +1,10 @@ # flake8: noqa: F401 -from .map_single import MapSingleFactory from .translate_dyncore import TranslateDynCore from .translate_fvdynamics import TranslateDycoreFortranData2Py, TranslateFVDynamics from .validation import enable_selective_validation """ -MapSingleFactory: Pool of objects to apply vertical remapping to multiple fields TranslateDynCore: Translate test for dynamical core TranslateDycoreFortranData2Py: Infrastructure to format serialized fortran data for translate tests TranslateFVDynamics: Translate test of acoustic dynamics diff --git a/pyFV3/testing/map_single.py b/pyFV3/testing/map_single.py index 06ea38e..27561dc 100644 --- a/pyFV3/testing/map_single.py +++ b/pyFV3/testing/map_single.py @@ -1,8 +1,7 @@ from typing import Dict, Tuple +from ndsl import QuantityFactory, StencilFactory from ndsl.constants import X_INTERFACE_DIM, Y_INTERFACE_DIM, Z_DIM -from ndsl.dsl.stencil import StencilFactory -from ndsl.initialization.allocator import QuantityFactory from pyFV3.stencils.map_single import MapSingle diff --git a/pyFV3/testing/translate_dyncore.py b/pyFV3/testing/translate_dyncore.py index fd96414..8524d09 100644 --- a/pyFV3/testing/translate_dyncore.py +++ b/pyFV3/testing/translate_dyncore.py @@ -1,12 +1,10 @@ import ndsl.dsl.gt4py_utils as utils -import pyFV3.stencils.dyn_core as dyn_core +from ndsl import Namelist, Quantity, StencilFactory from ndsl.constants import X_DIM, X_INTERFACE_DIM, Y_DIM, Y_INTERFACE_DIM, Z_DIM -from ndsl.dsl.stencil import StencilFactory -from ndsl.namelist import Namelist -from ndsl.quantity import Quantity from ndsl.stencils.testing import ParallelTranslate2PyState from pyFV3._config import DynamicalCoreConfig from pyFV3.dycore_state import DycoreState +from pyFV3.stencils import dyn_core class TranslateDynCore(ParallelTranslate2PyState): diff --git a/pyFV3/testing/translate_fvdynamics.py b/pyFV3/testing/translate_fvdynamics.py index ae0504a..5daea9d 100644 --- a/pyFV3/testing/translate_fvdynamics.py +++ b/pyFV3/testing/translate_fvdynamics.py @@ -5,7 +5,7 @@ import pytest import ndsl.dsl.gt4py_utils as utils -import pyFV3.stencils.fv_dynamics as fv_dynamics +from ndsl import Namelist, Quantity, StencilFactory from ndsl.constants import ( X_DIM, X_INTERFACE_DIM, @@ -14,15 +14,12 @@ Z_DIM, Z_INTERFACE_DIM, ) -from ndsl.dsl.stencil import StencilFactory from ndsl.grid import GridData -from ndsl.namelist import Namelist -from ndsl.performance.timer import NullTimer -from ndsl.quantity import Quantity -from ndsl.stencils.testing import ParallelTranslateBaseSlicing -from ndsl.stencils.testing.translate import TranslateFortranData2Py +from ndsl.performance import NullTimer +from ndsl.stencils.testing import ParallelTranslateBaseSlicing, TranslateFortranData2Py from pyFV3._config import DynamicalCoreConfig from pyFV3.dycore_state import DycoreState +from pyFV3.stencils import fv_dynamics class TranslateDycoreFortranData2Py(TranslateFortranData2Py): diff --git a/pyFV3/testing/validation.py b/pyFV3/testing/validation.py index 3f1242e..d9fb4f0 100644 --- a/pyFV3/testing/validation.py +++ b/pyFV3/testing/validation.py @@ -5,8 +5,8 @@ import pyFV3.stencils.divergence_damping import pyFV3.stencils.updatedzd +from ndsl import Quantity from ndsl.constants import X_DIM, X_INTERFACE_DIM, Y_DIM, Y_INTERFACE_DIM, Z_DIM -from ndsl.quantity import Quantity def get_selective_class( diff --git a/pyFV3/utils/functional_validation.py b/pyFV3/utils/functional_validation.py index 728e937..d396e43 100644 --- a/pyFV3/utils/functional_validation.py +++ b/pyFV3/utils/functional_validation.py @@ -3,7 +3,7 @@ import numpy as np -from ndsl.dsl.stencil import GridIndexing +from ndsl import GridIndexing def get_subset_func( diff --git a/pyFV3/wrappers/__init__.py b/pyFV3/wrappers/__init__.py index ead2be9..e69de29 100644 --- a/pyFV3/wrappers/__init__.py +++ b/pyFV3/wrappers/__init__.py @@ -1,10 +0,0 @@ -from .geos_wrapper import GeosDycoreWrapper, MemorySpace, StencilBackendCompilerOverride - - -""" -GeosDycoreWrapper: Main class, wrap the digest the GEOS interface call - and execute the pyFV3 numerics -MemorySpace: Flag describing the memory space for both side of the interface -StencilBackendCompilerOverride: Custom workaround to align gt backends - build with orchestrated backends -""" diff --git a/pyFV3/wrappers/geos_wrapper.py b/pyFV3/wrappers/geos_wrapper.py index 245e9aa..713371f 100644 --- a/pyFV3/wrappers/geos_wrapper.py +++ b/pyFV3/wrappers/geos_wrapper.py @@ -10,25 +10,29 @@ from mpi4py import MPI import pyFV3 +from ndsl import ( + CompilationConfig, + CubedSphereCommunicator, + CubedSpherePartitioner, + DaceConfig, + DaCeOrchestration, + GridIndexing, + PerformanceCollector, + QuantityFactory, + StencilConfig, + StencilFactory, + SubtileGridSizer, + TilePartitioner, + orchestrate, +) from ndsl.comm.comm_abc import Comm -from ndsl.comm.communicator import CubedSphereCommunicator from ndsl.comm.null_comm import NullComm -from ndsl.comm.partitioner import CubedSpherePartitioner, TilePartitioner -from ndsl.dsl.dace import orchestrate from ndsl.dsl.dace.build import set_distributed_caches -from ndsl.dsl.dace.dace_config import DaceConfig, DaCeOrchestration from ndsl.dsl.gt4py_utils import is_gpu_backend -from ndsl.dsl.stencil import GridIndexing, StencilFactory -from ndsl.dsl.stencil_config import CompilationConfig, StencilConfig from ndsl.dsl.typing import floating_point_precision -from ndsl.grid import GridData -from ndsl.grid.generation import MetricTerms -from ndsl.grid.helper import DampingCoefficients -from ndsl.initialization.allocator import QuantityFactory -from ndsl.initialization.sizer import SubtileGridSizer +from ndsl.grid import DampingCoefficients, GridData, MetricTerms from ndsl.logging import ndsl_log from ndsl.optional_imports import cupy as cp -from ndsl.performance.collector import PerformanceCollector from ndsl.utils import safe_assign_array diff --git a/tests/mpi/test_doubly_periodic.py b/tests/mpi/test_doubly_periodic.py index 95b8610..5bbe6b2 100644 --- a/tests/mpi/test_doubly_periodic.py +++ b/tests/mpi/test_doubly_periodic.py @@ -4,13 +4,16 @@ import ndsl.dsl.stencil import ndsl.stencils.testing import pyFV3.initialization.test_cases.initialize_baroclinic as baroclinic_init -from ndsl.comm.communicator import CubedSphereCommunicator, TileCommunicator -from ndsl.comm.mpi import MPIComm -from ndsl.comm.partitioner import TilePartitioner -from ndsl.dsl.stencil import GridIndexing +from ndsl import ( + CubedSphereCommunicator, + GridIndexing, + MPIComm, + QuantityFactory, + SubtileGridSizer, + TileCommunicator, + TilePartitioner, +) from ndsl.grid import DampingCoefficients, GridData, MetricTerms -from ndsl.initialization.allocator import QuantityFactory -from ndsl.initialization.sizer import SubtileGridSizer from pyFV3 import DynamicalCore, DynamicalCoreConfig diff --git a/tests/savepoint/translate/translate_a2b_ord4.py b/tests/savepoint/translate/translate_a2b_ord4.py index 9f2ffa4..acc4808 100644 --- a/tests/savepoint/translate/translate_a2b_ord4.py +++ b/tests/savepoint/translate/translate_a2b_ord4.py @@ -1,9 +1,7 @@ from typing import Any, Dict +from ndsl import Namelist, StencilFactory, orchestrate from ndsl.constants import Z_DIM -from ndsl.dsl.dace.orchestration import orchestrate -from ndsl.dsl.stencil import StencilFactory -from ndsl.namelist import Namelist from pyFV3.stencils import DivergenceDamping from pyFV3.testing import TranslateDycoreFortranData2Py diff --git a/tests/savepoint/translate/translate_c_sw.py b/tests/savepoint/translate/translate_c_sw.py index f228587..13abd93 100644 --- a/tests/savepoint/translate/translate_c_sw.py +++ b/tests/savepoint/translate/translate_c_sw.py @@ -1,6 +1,4 @@ -from ndsl.dsl.stencil import StencilFactory -from ndsl.initialization.allocator import QuantityFactory -from ndsl.namelist import Namelist +from ndsl import Namelist, QuantityFactory, StencilFactory from pyFV3.stencils import CGridShallowWaterDynamics from pyFV3.testing import TranslateDycoreFortranData2Py diff --git a/tests/savepoint/translate/translate_corners.py b/tests/savepoint/translate/translate_corners.py index 01f88e1..4aa5849 100644 --- a/tests/savepoint/translate/translate_corners.py +++ b/tests/savepoint/translate/translate_corners.py @@ -1,8 +1,7 @@ from typing import Any, Dict import ndsl.dsl.gt4py_utils as utils -from ndsl.dsl.stencil import StencilFactory -from ndsl.namelist import Namelist +from ndsl import Namelist, StencilFactory from ndsl.stencils import corners from pyFV3.testing import TranslateDycoreFortranData2Py diff --git a/tests/savepoint/translate/translate_cubedtolatlon.py b/tests/savepoint/translate/translate_cubedtolatlon.py index 54ed2f1..6610a46 100644 --- a/tests/savepoint/translate/translate_cubedtolatlon.py +++ b/tests/savepoint/translate/translate_cubedtolatlon.py @@ -1,7 +1,5 @@ +from ndsl import Namelist, Quantity, StencilFactory from ndsl.constants import X_DIM, X_INTERFACE_DIM, Y_DIM, Y_INTERFACE_DIM, Z_DIM -from ndsl.dsl.stencil import StencilFactory -from ndsl.namelist import Namelist -from ndsl.quantity import Quantity from ndsl.stencils.c2l_ord import CubedToLatLon from ndsl.stencils.testing import ParallelTranslate2Py diff --git a/tests/savepoint/translate/translate_d2a2c_vect.py b/tests/savepoint/translate/translate_d2a2c_vect.py index 3870f7d..d3561e4 100644 --- a/tests/savepoint/translate/translate_d2a2c_vect.py +++ b/tests/savepoint/translate/translate_d2a2c_vect.py @@ -1,5 +1,4 @@ -from ndsl.dsl.stencil import StencilFactory -from ndsl.namelist import Namelist +from ndsl import Namelist, StencilFactory from pyFV3.stencils import DGrid2AGrid2CGridVectors from pyFV3.testing import TranslateDycoreFortranData2Py diff --git a/tests/savepoint/translate/translate_d_sw.py b/tests/savepoint/translate/translate_d_sw.py index 464df78..836f399 100644 --- a/tests/savepoint/translate/translate_d_sw.py +++ b/tests/savepoint/translate/translate_d_sw.py @@ -2,9 +2,8 @@ import pyFV3 import pyFV3.stencils.d_sw as d_sw -from ndsl.dsl.stencil import StencilFactory +from ndsl import Namelist, StencilFactory from ndsl.dsl.typing import FloatField, FloatFieldIJ -from ndsl.namelist import Namelist from pyFV3.testing import TranslateDycoreFortranData2Py diff --git a/tests/savepoint/translate/translate_del2cubed.py b/tests/savepoint/translate/translate_del2cubed.py index b64363b..07bf24c 100644 --- a/tests/savepoint/translate/translate_del2cubed.py +++ b/tests/savepoint/translate/translate_del2cubed.py @@ -1,7 +1,6 @@ from typing import Any, Dict -from ndsl.dsl.stencil import StencilFactory -from ndsl.namelist import Namelist +from ndsl import Namelist, StencilFactory from pyFV3.stencils import HyperdiffusionDamping from pyFV3.testing import TranslateDycoreFortranData2Py diff --git a/tests/savepoint/translate/translate_del6vtflux.py b/tests/savepoint/translate/translate_del6vtflux.py index 3b3bbb6..f163c83 100644 --- a/tests/savepoint/translate/translate_del6vtflux.py +++ b/tests/savepoint/translate/translate_del6vtflux.py @@ -1,7 +1,6 @@ import pyFV3.stencils.delnflux as delnflux +from ndsl import Namelist, StencilFactory from ndsl.constants import Z_DIM -from ndsl.dsl.stencil import StencilFactory -from ndsl.namelist import Namelist from pyFV3.testing import TranslateDycoreFortranData2Py diff --git a/tests/savepoint/translate/translate_delnflux.py b/tests/savepoint/translate/translate_delnflux.py index 5b745f5..c3b9d81 100644 --- a/tests/savepoint/translate/translate_delnflux.py +++ b/tests/savepoint/translate/translate_delnflux.py @@ -1,7 +1,6 @@ import pyFV3.stencils.delnflux as delnflux +from ndsl import Namelist, StencilFactory from ndsl.constants import Z_DIM -from ndsl.dsl.stencil import StencilFactory -from ndsl.namelist import Namelist from pyFV3.testing import TranslateDycoreFortranData2Py diff --git a/tests/savepoint/translate/translate_divergencedamping.py b/tests/savepoint/translate/translate_divergencedamping.py index 3c7864e..fbc7d6b 100644 --- a/tests/savepoint/translate/translate_divergencedamping.py +++ b/tests/savepoint/translate/translate_divergencedamping.py @@ -1,8 +1,7 @@ from typing import Optional +from ndsl import Namelist, StencilFactory from ndsl.constants import Z_DIM -from ndsl.dsl.stencil import StencilFactory -from ndsl.namelist import Namelist from pyFV3.stencils import DivergenceDamping from pyFV3.testing import TranslateDycoreFortranData2Py diff --git a/tests/savepoint/translate/translate_fillz.py b/tests/savepoint/translate/translate_fillz.py index 394a563..c08b532 100644 --- a/tests/savepoint/translate/translate_fillz.py +++ b/tests/savepoint/translate/translate_fillz.py @@ -1,11 +1,10 @@ import numpy as np import ndsl.dsl.gt4py_utils as utils -import pyFV3.stencils.fillz as fillz -from ndsl.dsl.stencil import StencilFactory -from ndsl.namelist import Namelist +from ndsl import Namelist, StencilFactory from ndsl.stencils.testing import pad_field_in_j from ndsl.utils import safe_assign_array +from pyFV3.stencils import fillz from pyFV3.testing import TranslateDycoreFortranData2Py diff --git a/tests/savepoint/translate/translate_fvsubgridz.py b/tests/savepoint/translate/translate_fvsubgridz.py index 8ce6258..726bb7b 100644 --- a/tests/savepoint/translate/translate_fvsubgridz.py +++ b/tests/savepoint/translate/translate_fvsubgridz.py @@ -1,9 +1,8 @@ from types import SimpleNamespace import ndsl.dsl.gt4py_utils as utils +from ndsl import Namelist, StencilFactory from ndsl.constants import X_DIM, Y_DIM, Z_DIM, Z_INTERFACE_DIM -from ndsl.dsl.stencil import StencilFactory -from ndsl.namelist import Namelist from ndsl.stencils.testing import ParallelTranslateBaseSlicing from pyFV3 import DryConvectiveAdjustment diff --git a/tests/savepoint/translate/translate_fvtp2d.py b/tests/savepoint/translate/translate_fvtp2d.py index ea52262..81a0cff 100644 --- a/tests/savepoint/translate/translate_fvtp2d.py +++ b/tests/savepoint/translate/translate_fvtp2d.py @@ -1,8 +1,7 @@ import ndsl.dsl.gt4py_utils as utils +from ndsl import Namelist, StencilFactory from ndsl.constants import Z_DIM -from ndsl.dsl.stencil import StencilFactory from ndsl.dsl.typing import Float -from ndsl.namelist import Namelist from pyFV3.stencils import FiniteVolumeTransport from pyFV3.testing import TranslateDycoreFortranData2Py diff --git a/tests/savepoint/translate/translate_fxadv.py b/tests/savepoint/translate/translate_fxadv.py index ae85476..76afe3b 100644 --- a/tests/savepoint/translate/translate_fxadv.py +++ b/tests/savepoint/translate/translate_fxadv.py @@ -1,8 +1,7 @@ import numpy as np +from ndsl import Namelist, StencilFactory from ndsl.constants import X_DIM, Y_DIM, Z_DIM -from ndsl.dsl.stencil import StencilFactory -from ndsl.namelist import Namelist from pyFV3.stencils import FiniteVolumeFluxPrep from pyFV3.testing import TranslateDycoreFortranData2Py from pyFV3.utils.functional_validation import get_subset_func diff --git a/tests/savepoint/translate/translate_grid.py b/tests/savepoint/translate/translate_grid.py index 4b397d4..25d77b2 100644 --- a/tests/savepoint/translate/translate_grid.py +++ b/tests/savepoint/translate/translate_grid.py @@ -4,6 +4,7 @@ import pytest import ndsl.dsl.gt4py_utils as utils +from ndsl import Namelist, StencilFactory from ndsl.constants import ( X_DIM, X_INTERFACE_DIM, @@ -11,11 +12,10 @@ Y_INTERFACE_DIM, Z_INTERFACE_DIM, ) -from ndsl.dsl.stencil import StencilFactory -from ndsl.grid import MetricTerms, set_hybrid_pressure_coefficients +from ndsl.grid import MetricTerms +from ndsl.grid.eta import set_hybrid_pressure_coefficients from ndsl.grid.global_setup import global_mirror_grid, gnomonic_grid -from ndsl.namelist import Namelist -from ndsl.stencils.testing.parallel_translate import ParallelTranslateGrid +from ndsl.stencils.testing import ParallelTranslateGrid class TranslateGnomonicGrids(ParallelTranslateGrid): diff --git a/tests/savepoint/translate/translate_haloupdate.py b/tests/savepoint/translate/translate_haloupdate.py index c510125..12b078d 100644 --- a/tests/savepoint/translate/translate_haloupdate.py +++ b/tests/savepoint/translate/translate_haloupdate.py @@ -1,3 +1,4 @@ +from ndsl import Namelist, StencilFactory from ndsl.constants import ( N_HALO_DEFAULT, X_DIM, @@ -7,9 +8,7 @@ Z_DIM, Z_INTERFACE_DIM, ) -from ndsl.dsl.stencil import StencilFactory from ndsl.logging import ndsl_log -from ndsl.namelist import Namelist from ndsl.stencils.testing import ParallelTranslate diff --git a/tests/savepoint/translate/translate_init_case.py b/tests/savepoint/translate/translate_init_case.py index 65e8cdc..9cd87f0 100644 --- a/tests/savepoint/translate/translate_init_case.py +++ b/tests/savepoint/translate/translate_init_case.py @@ -8,6 +8,7 @@ import pyFV3.initialization.analytic_init as analytic_init import pyFV3.initialization.init_utils as init_utils import pyFV3.initialization.test_cases.initialize_baroclinic as baroclinic_init +from ndsl import Namelist, Quantity, QuantityFactory, StencilFactory, SubtileGridSizer from ndsl.constants import ( N_HALO_DEFAULT, X_DIM, @@ -17,12 +18,7 @@ Z_DIM, Z_INTERFACE_DIM, ) -from ndsl.dsl.stencil import StencilFactory from ndsl.grid import GridData, MetricTerms -from ndsl.initialization.allocator import QuantityFactory -from ndsl.initialization.sizer import SubtileGridSizer -from ndsl.namelist import Namelist -from ndsl.quantity import Quantity from ndsl.stencils.testing import ParallelTranslateBaseSlicing from ndsl.stencils.testing.grid import TRACER_DIM # type: ignore from pyFV3.testing import TranslateDycoreFortranData2Py diff --git a/tests/savepoint/translate/translate_last_step.py b/tests/savepoint/translate/translate_last_step.py index a7b19b2..4f33dc1 100644 --- a/tests/savepoint/translate/translate_last_step.py +++ b/tests/savepoint/translate/translate_last_step.py @@ -1,6 +1,5 @@ import pyFV3.stencils.moist_cv as moist_cv -from ndsl.dsl.stencil import StencilFactory -from ndsl.namelist import Namelist +from ndsl import Namelist, StencilFactory from pyFV3.testing import TranslateDycoreFortranData2Py diff --git a/tests/savepoint/translate/translate_moistcvpluspkz_2d.py b/tests/savepoint/translate/translate_moistcvpluspkz_2d.py index 2023c48..45f94d6 100644 --- a/tests/savepoint/translate/translate_moistcvpluspkz_2d.py +++ b/tests/savepoint/translate/translate_moistcvpluspkz_2d.py @@ -1,7 +1,6 @@ import pyFV3.stencils.moist_cv as moist_cv -from ndsl.dsl.stencil import StencilFactory +from ndsl import Namelist, StencilFactory from ndsl.dsl.typing import FloatField -from ndsl.namelist import Namelist from ndsl.stencils.testing import pad_field_in_j from pyFV3.testing import TranslateDycoreFortranData2Py diff --git a/tests/savepoint/translate/translate_moistcvpluspt_2d.py b/tests/savepoint/translate/translate_moistcvpluspt_2d.py index de453e1..7a48b01 100644 --- a/tests/savepoint/translate/translate_moistcvpluspt_2d.py +++ b/tests/savepoint/translate/translate_moistcvpluspt_2d.py @@ -1,7 +1,7 @@ from gt4py.cartesian.gtscript import PARALLEL, computation, interval import pyFV3.stencils.moist_cv as moist_cv -from ndsl.dsl.stencil import StencilFactory +from ndsl import StencilFactory from ndsl.dsl.typing import FloatField from ndsl.stencils.testing import TranslateFortranData2Py, pad_field_in_j diff --git a/tests/savepoint/translate/translate_neg_adj3.py b/tests/savepoint/translate/translate_neg_adj3.py index 89be0ab..f7ba63b 100644 --- a/tests/savepoint/translate/translate_neg_adj3.py +++ b/tests/savepoint/translate/translate_neg_adj3.py @@ -1,8 +1,7 @@ from typing import Any, Dict import ndsl.dsl.gt4py_utils as utils -from ndsl.dsl.stencil import StencilFactory -from ndsl.namelist import Namelist +from ndsl import Namelist, StencilFactory from pyFV3.stencils import AdjustNegativeTracerMixingRatio from pyFV3.testing import TranslateDycoreFortranData2Py diff --git a/tests/savepoint/translate/translate_nh_p_grad.py b/tests/savepoint/translate/translate_nh_p_grad.py index 7a2e4a3..524dd5b 100644 --- a/tests/savepoint/translate/translate_nh_p_grad.py +++ b/tests/savepoint/translate/translate_nh_p_grad.py @@ -1,6 +1,5 @@ import pyFV3.stencils.nh_p_grad as NH_P_Grad -from ndsl.dsl.stencil import StencilFactory -from ndsl.namelist import Namelist +from ndsl import Namelist, StencilFactory from pyFV3.testing import TranslateDycoreFortranData2Py diff --git a/tests/savepoint/translate/translate_pe_halo.py b/tests/savepoint/translate/translate_pe_halo.py index 86111af..0c5c2e0 100644 --- a/tests/savepoint/translate/translate_pe_halo.py +++ b/tests/savepoint/translate/translate_pe_halo.py @@ -1,5 +1,4 @@ -from ndsl.dsl.stencil import StencilFactory -from ndsl.namelist import Namelist +from ndsl import Namelist, StencilFactory from pyFV3.stencils import pe_halo from pyFV3.testing import TranslateDycoreFortranData2Py diff --git a/tests/savepoint/translate/translate_pk3_halo.py b/tests/savepoint/translate/translate_pk3_halo.py index caa0a6c..4f13c02 100644 --- a/tests/savepoint/translate/translate_pk3_halo.py +++ b/tests/savepoint/translate/translate_pk3_halo.py @@ -1,5 +1,4 @@ -from ndsl.dsl.stencil import StencilFactory -from ndsl.namelist import Namelist +from ndsl import Namelist, StencilFactory from pyFV3.stencils import PK3Halo from pyFV3.testing import TranslateDycoreFortranData2Py diff --git a/tests/savepoint/translate/translate_pressureadjustedtemperature_nonhydrostatic.py b/tests/savepoint/translate/translate_pressureadjustedtemperature_nonhydrostatic.py index 19acc6f..6ed5e02 100644 --- a/tests/savepoint/translate/translate_pressureadjustedtemperature_nonhydrostatic.py +++ b/tests/savepoint/translate/translate_pressureadjustedtemperature_nonhydrostatic.py @@ -1,7 +1,6 @@ from typing import Any, Dict -from ndsl.dsl.stencil import StencilFactory -from ndsl.namelist import Namelist +from ndsl import Namelist, StencilFactory from pyFV3 import DynamicalCoreConfig from pyFV3.stencils import temperature_adjust from pyFV3.stencils.dyn_core import get_nk_heat_dissipation diff --git a/tests/savepoint/translate/translate_qsinit.py b/tests/savepoint/translate/translate_qsinit.py index e7f4e65..e1228ce 100644 --- a/tests/savepoint/translate/translate_qsinit.py +++ b/tests/savepoint/translate/translate_qsinit.py @@ -2,8 +2,7 @@ import ndsl.dsl.gt4py_utils as utils import pyFV3.stencils.saturation_adjustment as satadjust -from ndsl.dsl.stencil import StencilFactory -from ndsl.namelist import Namelist +from ndsl import Namelist, StencilFactory from pyFV3.testing import TranslateDycoreFortranData2Py diff --git a/tests/savepoint/translate/translate_ray_fast.py b/tests/savepoint/translate/translate_ray_fast.py index eb1f448..32de3d5 100644 --- a/tests/savepoint/translate/translate_ray_fast.py +++ b/tests/savepoint/translate/translate_ray_fast.py @@ -1,5 +1,4 @@ -from ndsl.dsl.stencil import StencilFactory -from ndsl.namelist import Namelist +from ndsl import Namelist, StencilFactory from pyFV3.stencils import RayleighDamping from pyFV3.testing import TranslateDycoreFortranData2Py diff --git a/tests/savepoint/translate/translate_remapping.py b/tests/savepoint/translate/translate_remapping.py index d9eef3b..43ddb27 100644 --- a/tests/savepoint/translate/translate_remapping.py +++ b/tests/savepoint/translate/translate_remapping.py @@ -1,7 +1,6 @@ import ndsl.dsl.gt4py_utils as utils +from ndsl import Namelist, StencilFactory from ndsl.constants import Z_DIM -from ndsl.dsl.stencil import StencilFactory -from ndsl.namelist import Namelist from pyFV3 import DynamicalCoreConfig from pyFV3.stencils import LagrangianToEulerian from pyFV3.testing import TranslateDycoreFortranData2Py diff --git a/tests/savepoint/translate/translate_riem_solver3.py b/tests/savepoint/translate/translate_riem_solver3.py index a83e163..76c4a5c 100644 --- a/tests/savepoint/translate/translate_riem_solver3.py +++ b/tests/savepoint/translate/translate_riem_solver3.py @@ -1,5 +1,4 @@ -from ndsl.dsl.stencil import StencilFactory -from ndsl.namelist import Namelist +from ndsl import Namelist, StencilFactory from pyFV3 import _config as spec from pyFV3.stencils import NonhydrostaticVerticalSolver from pyFV3.testing import TranslateDycoreFortranData2Py diff --git a/tests/savepoint/translate/translate_riem_solver_c.py b/tests/savepoint/translate/translate_riem_solver_c.py index ce0716d..aa193d6 100644 --- a/tests/savepoint/translate/translate_riem_solver_c.py +++ b/tests/savepoint/translate/translate_riem_solver_c.py @@ -1,5 +1,4 @@ -from ndsl.dsl.stencil import StencilFactory -from ndsl.namelist import Namelist +from ndsl import Namelist, StencilFactory from pyFV3.stencils import NonhydrostaticVerticalSolverCGrid from pyFV3.testing import TranslateDycoreFortranData2Py diff --git a/tests/savepoint/translate/translate_satadjust3d.py b/tests/savepoint/translate/translate_satadjust3d.py index a391c6c..99f33b5 100644 --- a/tests/savepoint/translate/translate_satadjust3d.py +++ b/tests/savepoint/translate/translate_satadjust3d.py @@ -1,5 +1,4 @@ -from ndsl.dsl.stencil import StencilFactory -from ndsl.namelist import Namelist +from ndsl import Namelist, StencilFactory from pyFV3 import DynamicalCoreConfig from pyFV3.stencils import SatAdjust3d from pyFV3.testing import TranslateDycoreFortranData2Py diff --git a/tests/savepoint/translate/translate_tracer2d1l.py b/tests/savepoint/translate/translate_tracer2d1l.py index d339cbd..f3ad0f7 100644 --- a/tests/savepoint/translate/translate_tracer2d1l.py +++ b/tests/savepoint/translate/translate_tracer2d1l.py @@ -1,9 +1,8 @@ import pytest import ndsl.dsl.gt4py_utils as utils +from ndsl import Namelist, StencilFactory from ndsl.constants import X_DIM, Y_DIM, Z_DIM -from ndsl.dsl.stencil import StencilFactory -from ndsl.namelist import Namelist from ndsl.stencils.testing import ParallelTranslate from pyFV3.stencils import FiniteVolumeTransport, TracerAdvection from pyFV3.utils.functional_validation import get_subset_func diff --git a/tests/savepoint/translate/translate_updatedzc.py b/tests/savepoint/translate/translate_updatedzc.py index 90c6cc3..9553a51 100644 --- a/tests/savepoint/translate/translate_updatedzc.py +++ b/tests/savepoint/translate/translate_updatedzc.py @@ -1,8 +1,7 @@ import numpy as np +from ndsl import Namelist, StencilFactory from ndsl.constants import X_DIM, Y_DIM, Z_DIM -from ndsl.dsl.stencil import StencilFactory -from ndsl.namelist import Namelist from pyFV3.stencils import UpdateGeopotentialHeightOnCGrid from pyFV3.testing import TranslateDycoreFortranData2Py from pyFV3.utils.functional_validation import get_subset_func diff --git a/tests/savepoint/translate/translate_updatedzd.py b/tests/savepoint/translate/translate_updatedzd.py index ea31ba6..7580089 100644 --- a/tests/savepoint/translate/translate_updatedzd.py +++ b/tests/savepoint/translate/translate_updatedzd.py @@ -1,8 +1,7 @@ import numpy as np +from ndsl import Namelist, StencilFactory from ndsl.constants import X_DIM, Y_DIM, Z_DIM -from ndsl.dsl.stencil import StencilFactory -from ndsl.namelist import Namelist from pyFV3 import DynamicalCoreConfig from pyFV3.stencils import UpdateHeightOnDGrid, d_sw from pyFV3.testing import TranslateDycoreFortranData2Py diff --git a/tests/savepoint/translate/translate_xppm.py b/tests/savepoint/translate/translate_xppm.py index 56ad871..44d8b36 100644 --- a/tests/savepoint/translate/translate_xppm.py +++ b/tests/savepoint/translate/translate_xppm.py @@ -1,6 +1,5 @@ import ndsl.dsl.gt4py_utils as utils -from ndsl.dsl.stencil import StencilFactory -from ndsl.namelist import Namelist +from ndsl import Namelist, StencilFactory from ndsl.stencils.testing import TranslateGrid from pyFV3.stencils import XPiecewiseParabolic from pyFV3.testing import TranslateDycoreFortranData2Py diff --git a/tests/savepoint/translate/translate_xtp_u.py b/tests/savepoint/translate/translate_xtp_u.py index 201b44b..dfe4848 100644 --- a/tests/savepoint/translate/translate_xtp_u.py +++ b/tests/savepoint/translate/translate_xtp_u.py @@ -1,10 +1,9 @@ from gt4py.cartesian.gtscript import PARALLEL, computation, interval import pyFV3.stencils.xtp_u as xtp_u -from ndsl.dsl.stencil import StencilFactory +from ndsl import Namelist, StencilFactory from ndsl.dsl.typing import FloatField, FloatFieldIJ from ndsl.grid import GridData -from ndsl.namelist import Namelist from tests.savepoint.translate.translate_ytp_v import TranslateYTP_V diff --git a/tests/savepoint/translate/translate_yppm.py b/tests/savepoint/translate/translate_yppm.py index f6cdc3b..4b9430d 100644 --- a/tests/savepoint/translate/translate_yppm.py +++ b/tests/savepoint/translate/translate_yppm.py @@ -1,7 +1,6 @@ import ndsl.dsl.gt4py_utils as utils -from ndsl.dsl.stencil import StencilFactory +from ndsl import Namelist, StencilFactory from ndsl.dsl.typing import Float -from ndsl.namelist import Namelist from ndsl.stencils.testing import TranslateGrid from pyFV3.stencils import YPiecewiseParabolic from pyFV3.testing import TranslateDycoreFortranData2Py diff --git a/tests/savepoint/translate/translate_ytp_v.py b/tests/savepoint/translate/translate_ytp_v.py index 69f7dd3..9e622fd 100644 --- a/tests/savepoint/translate/translate_ytp_v.py +++ b/tests/savepoint/translate/translate_ytp_v.py @@ -1,10 +1,9 @@ from gt4py.cartesian.gtscript import PARALLEL, computation, interval import pyFV3.stencils.ytp_v as ytp_v -from ndsl.dsl.stencil import StencilFactory +from ndsl import Namelist, StencilFactory from ndsl.dsl.typing import FloatField, FloatFieldIJ from ndsl.grid import GridData -from ndsl.namelist import Namelist from pyFV3 import DynamicalCoreConfig from pyFV3.testing import TranslateDycoreFortranData2Py From 693ece6b94f4fd44edc6f2501d0662831d0875e0 Mon Sep 17 00:00:00 2001 From: Frank Malatino Date: Thu, 14 Mar 2024 12:26:48 -0400 Subject: [PATCH 2/8] Changes include updated import methods of NDSL --- pyFV3/wrappers/geos_wrapper.py | 2 +- tests/savepoint/translate/translate_delnflux.py | 2 +- tests/savepoint/translate/translate_last_step.py | 2 +- tests/savepoint/translate/translate_moistcvpluspkz_2d.py | 2 +- tests/savepoint/translate/translate_moistcvpluspt_2d.py | 2 +- tests/savepoint/translate/translate_xtp_u.py | 2 +- tests/savepoint/translate/translate_ytp_v.py | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pyFV3/wrappers/geos_wrapper.py b/pyFV3/wrappers/geos_wrapper.py index 713371f..98feb79 100644 --- a/pyFV3/wrappers/geos_wrapper.py +++ b/pyFV3/wrappers/geos_wrapper.py @@ -17,6 +17,7 @@ DaceConfig, DaCeOrchestration, GridIndexing, + NullComm, PerformanceCollector, QuantityFactory, StencilConfig, @@ -26,7 +27,6 @@ orchestrate, ) from ndsl.comm.comm_abc import Comm -from ndsl.comm.null_comm import NullComm from ndsl.dsl.dace.build import set_distributed_caches from ndsl.dsl.gt4py_utils import is_gpu_backend from ndsl.dsl.typing import floating_point_precision diff --git a/tests/savepoint/translate/translate_delnflux.py b/tests/savepoint/translate/translate_delnflux.py index c3b9d81..1db0b33 100644 --- a/tests/savepoint/translate/translate_delnflux.py +++ b/tests/savepoint/translate/translate_delnflux.py @@ -1,6 +1,6 @@ -import pyFV3.stencils.delnflux as delnflux from ndsl import Namelist, StencilFactory from ndsl.constants import Z_DIM +from pyFV3.stencils import delnflux from pyFV3.testing import TranslateDycoreFortranData2Py diff --git a/tests/savepoint/translate/translate_last_step.py b/tests/savepoint/translate/translate_last_step.py index 4f33dc1..1d2d752 100644 --- a/tests/savepoint/translate/translate_last_step.py +++ b/tests/savepoint/translate/translate_last_step.py @@ -1,5 +1,5 @@ -import pyFV3.stencils.moist_cv as moist_cv from ndsl import Namelist, StencilFactory +from pyFV3.stencils import moist_cv from pyFV3.testing import TranslateDycoreFortranData2Py diff --git a/tests/savepoint/translate/translate_moistcvpluspkz_2d.py b/tests/savepoint/translate/translate_moistcvpluspkz_2d.py index 45f94d6..54577da 100644 --- a/tests/savepoint/translate/translate_moistcvpluspkz_2d.py +++ b/tests/savepoint/translate/translate_moistcvpluspkz_2d.py @@ -1,7 +1,7 @@ -import pyFV3.stencils.moist_cv as moist_cv from ndsl import Namelist, StencilFactory from ndsl.dsl.typing import FloatField from ndsl.stencils.testing import pad_field_in_j +from pyFV3.stencils import moist_cv from pyFV3.testing import TranslateDycoreFortranData2Py diff --git a/tests/savepoint/translate/translate_moistcvpluspt_2d.py b/tests/savepoint/translate/translate_moistcvpluspt_2d.py index 7a48b01..c50fda2 100644 --- a/tests/savepoint/translate/translate_moistcvpluspt_2d.py +++ b/tests/savepoint/translate/translate_moistcvpluspt_2d.py @@ -1,9 +1,9 @@ from gt4py.cartesian.gtscript import PARALLEL, computation, interval -import pyFV3.stencils.moist_cv as moist_cv from ndsl import StencilFactory from ndsl.dsl.typing import FloatField from ndsl.stencils.testing import TranslateFortranData2Py, pad_field_in_j +from pyFV3.stencils import moist_cv def moist_pt( diff --git a/tests/savepoint/translate/translate_xtp_u.py b/tests/savepoint/translate/translate_xtp_u.py index dfe4848..4a0cbbb 100644 --- a/tests/savepoint/translate/translate_xtp_u.py +++ b/tests/savepoint/translate/translate_xtp_u.py @@ -1,9 +1,9 @@ from gt4py.cartesian.gtscript import PARALLEL, computation, interval -import pyFV3.stencils.xtp_u as xtp_u from ndsl import Namelist, StencilFactory from ndsl.dsl.typing import FloatField, FloatFieldIJ from ndsl.grid import GridData +from pyFV3.stencils import xtp_u from tests.savepoint.translate.translate_ytp_v import TranslateYTP_V diff --git a/tests/savepoint/translate/translate_ytp_v.py b/tests/savepoint/translate/translate_ytp_v.py index 9e622fd..038f889 100644 --- a/tests/savepoint/translate/translate_ytp_v.py +++ b/tests/savepoint/translate/translate_ytp_v.py @@ -1,10 +1,10 @@ from gt4py.cartesian.gtscript import PARALLEL, computation, interval -import pyFV3.stencils.ytp_v as ytp_v from ndsl import Namelist, StencilFactory from ndsl.dsl.typing import FloatField, FloatFieldIJ from ndsl.grid import GridData from pyFV3 import DynamicalCoreConfig +from pyFV3.stencils import ytp_v from pyFV3.testing import TranslateDycoreFortranData2Py From 6c5ee644502a7406144e3127b8c5eca714c057bc Mon Sep 17 00:00:00 2001 From: Frank Malatino Date: Mon, 18 Mar 2024 09:24:58 -0400 Subject: [PATCH 3/8] Directed setup.py to pull reference branch of ndsl --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index cc136f0..536bb4a 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ ] test_requirements = ["pytest", "pytest-subtests", "serialbox"] -ndsl_requirements = ["ndsl @ git+https://github.com/NOAA-GFDL/NDSL.git@main"] +ndsl_requirements = ["ndsl @ git+https://github.com/NOAA-GFDL/NDSL.git@develop"] develop_requirements = test_requirements + ndsl_requirements + ["pre-commit"] extras_requires = { From fb1d24d699036686e167eb276ca83508f2f95394 Mon Sep 17 00:00:00 2001 From: Frank Malatino Date: Mon, 18 Mar 2024 13:07:04 -0400 Subject: [PATCH 4/8] Updating import of examples and setup.py --- examples/notebook/test_functionality.ipynb | 24 ++++++++++++++-------- setup.py | 2 +- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/examples/notebook/test_functionality.ipynb b/examples/notebook/test_functionality.ipynb index 5f0ac02..34e9d54 100644 --- a/examples/notebook/test_functionality.ipynb +++ b/examples/notebook/test_functionality.ipynb @@ -96,15 +96,21 @@ "from gt4py.cartesian.gtscript import PARALLEL, computation, interval\n", "\n", "from ndsl.dsl.typing import Float, FloatField, FloatFieldIJ\n", - "from ndsl.comm.communicator import Communicator, CubedSphereCommunicator\n", - "from ndsl.dsl.stencil import StencilFactory, GridIndexing\n", - "from ndsl.initialization import SubtileGridSizer\n", - "from ndsl.initialization.allocator import QuantityFactory\n", - "from ndsl.quantity import Quantity\n", - "from ndsl.comm.partitioner import CubedSpherePartitioner, TilePartitioner\n", - "from ndsl.constants import X_DIM, Y_DIM, Z_DIM\n", - "from ndsl.dsl.stencil_config import CompilationConfig, StencilConfig\n", - "from ndsl.dsl.dace.wrapped_halo_exchange import WrappedHaloUpdater" + "from ndsl import (\n", + " CompilationConfig,\n", + " CubedSphereCommunicator,\n", + " CubedSpherePartitioner,\n", + " GridIndexing,\n", + " Quantity,\n", + " QuantityFactory,\n", + " StencilConfig,\n", + " StencilFactory,\n", + " SubtileGridSizer,\n", + " TilePartitioner,\n", + " WrappedHaloUpdater,\n", + ")\n", + "from ndsl.typing import Communicator\n", + "from ndsl.constants import X_DIM, Y_DIM, Z_DIM" ] }, { diff --git a/setup.py b/setup.py index 536bb4a..29de785 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ ] test_requirements = ["pytest", "pytest-subtests", "serialbox"] -ndsl_requirements = ["ndsl @ git+https://github.com/NOAA-GFDL/NDSL.git@develop"] +ndsl_requirements = ["ndsl @ git+https://github.com/NOAA-GFDL/NDSL.git@2024.03.01-RC"] develop_requirements = test_requirements + ndsl_requirements + ["pre-commit"] extras_requires = { From f3dded49463db3b317bca74888f341ffbb0fd4ea Mon Sep 17 00:00:00 2001 From: Frank Malatino Date: Mon, 18 Mar 2024 14:37:07 -0400 Subject: [PATCH 5/8] Updated setup.py to reference most recent release of ndsl --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 29de785..a442d21 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ ] test_requirements = ["pytest", "pytest-subtests", "serialbox"] -ndsl_requirements = ["ndsl @ git+https://github.com/NOAA-GFDL/NDSL.git@2024.03.01-RC"] +ndsl_requirements = ["ndsl @ git+https://github.com/NOAA-GFDL/NDSL.git@2024.03.01"] develop_requirements = test_requirements + ndsl_requirements + ["pre-commit"] extras_requires = { From 83a05ca2927b28a45ff89d8412a9e659736da684 Mon Sep 17 00:00:00 2001 From: Frank Malatino Date: Tue, 19 Mar 2024 14:04:09 -0400 Subject: [PATCH 6/8] Re-added __init__ of wrappers, and congregated stencils import in top level __init__ --- pyFV3/__init__.py | 8 +++++--- pyFV3/wrappers/__init__.py | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pyFV3/__init__.py b/pyFV3/__init__.py index 968e970..8abf123 100644 --- a/pyFV3/__init__.py +++ b/pyFV3/__init__.py @@ -1,8 +1,10 @@ from ._config import DynamicalCoreConfig from .dycore_state import DycoreState -from .stencils.fv_dynamics import DynamicalCore -from .stencils.fv_subgridz import DryConvectiveAdjustment -from .wrappers.geos_wrapper import GeosDycoreWrapper + +# from .stencils.fv_dynamics import DynamicalCore +# from .stencils.fv_subgridz import DryConvectiveAdjustment +from .stencils import DryConvectiveAdjustment, DynamicalCore +from .wrappers import GeosDycoreWrapper """ diff --git a/pyFV3/wrappers/__init__.py b/pyFV3/wrappers/__init__.py index e69de29..21cf945 100644 --- a/pyFV3/wrappers/__init__.py +++ b/pyFV3/wrappers/__init__.py @@ -0,0 +1 @@ +from .geos_wrapper import GeosDycoreWrapper, MemorySpace, StencilBackendCompilerOverride From 9faca40a4ea9abcd7d564213579b7ec46d9becd8 Mon Sep 17 00:00:00 2001 From: Frank Malatino Date: Tue, 19 Mar 2024 14:11:43 -0400 Subject: [PATCH 7/8] Clean-up --- pyFV3/__init__.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/pyFV3/__init__.py b/pyFV3/__init__.py index 8abf123..bd2e7c9 100644 --- a/pyFV3/__init__.py +++ b/pyFV3/__init__.py @@ -1,8 +1,5 @@ from ._config import DynamicalCoreConfig from .dycore_state import DycoreState - -# from .stencils.fv_dynamics import DynamicalCore -# from .stencils.fv_subgridz import DryConvectiveAdjustment from .stencils import DryConvectiveAdjustment, DynamicalCore from .wrappers import GeosDycoreWrapper From 6efa237ec371ed06f273cea9f6203a8a46c626aa Mon Sep 17 00:00:00 2001 From: Frank Malatino Date: Tue, 19 Mar 2024 16:01:23 -0400 Subject: [PATCH 8/8] Removing double exposure of wrapper methods, leaving exposure only at wrapper module level --- pyFV3/__init__.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/pyFV3/__init__.py b/pyFV3/__init__.py index bd2e7c9..4024a8f 100644 --- a/pyFV3/__init__.py +++ b/pyFV3/__init__.py @@ -1,7 +1,6 @@ from ._config import DynamicalCoreConfig from .dycore_state import DycoreState from .stencils import DryConvectiveAdjustment, DynamicalCore -from .wrappers import GeosDycoreWrapper """ @@ -9,7 +8,6 @@ DycoreState: Dataclass containing state of the dynamical core DryConvectiveAdjustment: Sub-grid dry convective adjustment DynamicalCore: The FV3 dynamical core -GeosDycoreWrapper: Interface to the dycore for the GEOS model """ __version__ = "0.2.0"