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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
[submodule "pyFV3"]
path = pyFV3
url = git@github.com:NOAA-GFDL/PyFV3.git
[submodule "pySHiELD"]
path = pySHiELD
url = git@github.com:NOAA-GFDL/PySHiELD.git
21 changes: 0 additions & 21 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,6 @@ repos:
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.812
hooks:
- id: mypy
name: mypy-fv3core
args: [--config-file, setup.cfg]
files: fv3core
exclude: |
(?x)^(
fv3core/pace/fv3core/stencils/fv_subgridz.py |
fv3core/tests/conftest.py
)$
- id: mypy
name: mypy-driver
args: [--config-file, setup.cfg]
Expand All @@ -34,18 +25,6 @@ repos:
(?x)^(
tests/main/driver/__init__.py |
)$
- id: mypy
name: mypy-physics
args: [--config-file, setup.cfg]
files: physics
- id: mypy
name: mypy-ndsl
args: [--config-file, setup.cfg]
files: ndsl
exclude: |
(?x)^(
ndsl/ndsl/gt4py_utils.py |
)$
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
Expand Down
2 changes: 1 addition & 1 deletion NDSL
10 changes: 3 additions & 7 deletions constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ coverage==5.5
# via pytest-cov
cytoolz==0.12.1
# via gt4py
dace
# via ndsl
dacite==1.6.0
# via
# fv3config
Expand Down Expand Up @@ -113,8 +111,8 @@ f90nml==1.3.1
# via
# -r requirements_dev.txt
# fv3config
# pace-physics
# pyfv3
# pyshield
fasteners==0.16.3
# via zarr
fastjsonschema==2.16.2
Expand Down Expand Up @@ -147,8 +145,6 @@ gprof2dot==2021.2.21
# via pytest-profiling
gridtools-cpp==2.3.1
# via gt4py
gt4py
# via ndsl
h5netcdf==1.1.0
# via ndsl
h5py==3.10.0
Expand Down Expand Up @@ -257,9 +253,9 @@ numpy==1.21.2
# netcdf4
# numcodecs
# pace-driver
# pace-physics
# pandas
# pyfv3
# pyshield
# scipy
# xarray
# zarr
Expand Down Expand Up @@ -477,8 +473,8 @@ xarray==0.19.0
# -r requirements_dev.txt
# ndsl
# pace-driver
# pace-physics
# pyfv3
# pyshield
xxhash==2.0.2
# via gt4py
yarl==1.6.3
Expand Down
4 changes: 2 additions & 2 deletions driver/examples/stencil_signatures.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import inspect
from typing import Optional, TextIO

import ndsl.dsl
import ndsl.util
import yaml

import ndsl.dsl
import ndsl.util
import pace.driver


Expand Down
1 change: 1 addition & 0 deletions driver/pace/driver/configs/comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from typing import Any, ClassVar, List

import dacite

from ndsl.comm.caching_comm import CachingCommReader, CachingCommWriter
from ndsl.comm.mpi import MPIComm
from ndsl.comm.null_comm import NullComm
Expand Down
1 change: 0 additions & 1 deletion driver/pace/driver/diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from ndsl.grid import GridData
from ndsl.monitor import Monitor, NetCDFMonitor, ZarrMonitor
from ndsl.quantity import Quantity

from pyFV3.dycore_state import DycoreState

from .state import DriverState
Expand Down
17 changes: 8 additions & 9 deletions driver/pace/driver/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
import dace
import dacite
import yaml

import pyFV3
import pySHiELD
from ndsl.comm.comm_abc import Comm
from ndsl.comm.communicator import (
Communicator,
Expand All @@ -28,14 +31,10 @@
from ndsl.performance import PerformanceConfig
from ndsl.performance.collector import PerformanceCollector
from ndsl.performance.timer import Timer

import pace.driver
import pace.physics
import pyFV3
from pace.driver.safety_checks import SafetyChecker

# TODO: move update_atmos_state into pace.driver
from pace.physics.update import update_atmos_state
from pySHiELD.update import update_atmos_state

from . import diagnostics
from .comm import CreatesCommSelector
Expand Down Expand Up @@ -116,8 +115,8 @@ class DriverConfig:
dycore_config: pyFV3.DynamicalCoreConfig = dataclasses.field(
default_factory=pyFV3.DynamicalCoreConfig
)
physics_config: pace.physics.PhysicsConfig = dataclasses.field(
default_factory=pace.physics.PhysicsConfig
physics_config: pySHiELD.PhysicsConfig = dataclasses.field(
default_factory=pySHiELD.PhysicsConfig
)

days: int = 0
Expand Down Expand Up @@ -250,7 +249,7 @@ def from_dict(cls, kwargs: Dict[str, Any]) -> "DriverConfig":

if isinstance(kwargs["physics_config"], dict):
kwargs["physics_config"] = dacite.from_dict(
data_class=pace.physics.PhysicsConfig,
data_class=pySHiELD.PhysicsConfig,
data=kwargs.get("physics_config", {}),
config=dacite.Config(strict=True),
)
Expand Down Expand Up @@ -505,7 +504,7 @@ def exit_instead_of_build(self):

ndsl_log.info("setting up physics object started")
if not config.dycore_only and not config.disable_step_physics:
self.physics = pace.physics.Physics(
self.physics = pySHiELD.Physics(
stencil_factory=self.stencil_factory,
quantity_factory=self.quantity_factory,
grid_data=self.state.grid_data,
Expand Down
1 change: 1 addition & 0 deletions driver/pace/driver/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import f90nml
import xarray as xr

from ndsl.comm.communicator import Communicator
from ndsl.comm.partitioner import get_tile_index
from ndsl.constants import X_DIM, X_INTERFACE_DIM, Y_DIM, Y_INTERFACE_DIM
Expand Down
29 changes: 14 additions & 15 deletions driver/pace/driver/initialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
from typing import Callable, ClassVar, List, Type, TypeVar

import f90nml

import pyFV3
import pyFV3.initialization.analytic_init as analytic_init
import pySHiELD
from ndsl.comm.communicator import Communicator
from ndsl.constants import X_DIM, Y_DIM
from ndsl.dsl.dace.orchestration import DaceConfig
Expand All @@ -15,11 +19,6 @@
from ndsl.initialization.allocator import QuantityFactory
from ndsl.namelist import Namelist
from ndsl.stencils.testing import TranslateGrid, grid

import pace.driver
import pace.physics
import pyFV3
import pyFV3.initialization.analytic_init as analytic_init
from pyFV3.testing import TranslateFVDynamics

from .registry import Registry
Expand All @@ -40,7 +39,7 @@ def get_driver_state(
damping_coefficients: DampingCoefficients,
driver_grid_data: DriverGridData,
grid_data: GridData,
schemes: List[pace.physics.PHYSICS_PACKAGES],
schemes: List[pySHiELD.PHYSICS_PACKAGES],
) -> DriverState:
...

Expand Down Expand Up @@ -78,7 +77,7 @@ def get_driver_state(
damping_coefficients: DampingCoefficients,
driver_grid_data: DriverGridData,
grid_data: GridData,
schemes: List[pace.physics.PHYSICS_PACKAGES],
schemes: List[pySHiELD.PHYSICS_PACKAGES],
) -> DriverState:
return self.config.get_driver_state(
quantity_factory=quantity_factory,
Expand Down Expand Up @@ -112,7 +111,7 @@ def get_driver_state(
damping_coefficients: DampingCoefficients,
driver_grid_data: DriverGridData,
grid_data: GridData,
schemes: List[pace.physics.PHYSICS_PACKAGES],
schemes: List[pySHiELD.PHYSICS_PACKAGES],
) -> DriverState:
dycore_state = analytic_init.init_analytic_state(
analytic_init_case=self.case,
Expand All @@ -123,7 +122,7 @@ def get_driver_state(
moist_phys=True,
comm=communicator,
)
physics_state = pace.physics.PhysicsState.init_zeros(
physics_state = pySHiELD.PhysicsState.init_zeros(
quantity_factory=quantity_factory, schemes=schemes
)
tendency_state = TendencyState.init_zeros(
Expand Down Expand Up @@ -156,7 +155,7 @@ def get_driver_state(
damping_coefficients: DampingCoefficients,
driver_grid_data: DriverGridData,
grid_data: GridData,
schemes: List[pace.physics.PHYSICS_PACKAGES],
schemes: List[pySHiELD.PHYSICS_PACKAGES],
) -> DriverState:
state = _restart_driver_state(
self.path,
Expand Down Expand Up @@ -207,7 +206,7 @@ def get_driver_state(
damping_coefficients: DampingCoefficients,
driver_grid_data: DriverGridData,
grid_data: GridData,
schemes: List[pace.physics.PHYSICS_PACKAGES],
schemes: List[pySHiELD.PHYSICS_PACKAGES],
) -> DriverState:
state = _restart_driver_state(
self.path,
Expand Down Expand Up @@ -280,14 +279,14 @@ def get_driver_state(
damping_coefficients: DampingCoefficients,
driver_grid_data: DriverGridData,
grid_data: GridData,
schemes: List[pace.physics.PHYSICS_PACKAGES],
schemes: List[pySHiELD.PHYSICS_PACKAGES],
) -> DriverState:
backend = quantity_factory.zeros(
dims=[X_DIM, Y_DIM], units="unknown"
).gt4py_backend

dycore_state = self._initialize_dycore_state(communicator, backend)
physics_state = pace.physics.PhysicsState.init_zeros(
physics_state = pySHiELD.PhysicsState.init_zeros(
quantity_factory=quantity_factory,
schemes=schemes,
)
Expand Down Expand Up @@ -344,7 +343,7 @@ class PredefinedStateInit(Initializer):
"""

dycore_state: pyFV3.DycoreState
physics_state: pace.physics.PhysicsState
physics_state: pySHiELD.PhysicsState
tendency_state: TendencyState
grid_data: GridData
damping_coefficients: DampingCoefficients
Expand All @@ -358,7 +357,7 @@ def get_driver_state(
damping_coefficients: DampingCoefficients,
driver_grid_data: DriverGridData,
grid_data: GridData,
schemes: List[pace.physics.PHYSICS_PACKAGES],
schemes: List[pySHiELD.PHYSICS_PACKAGES],
) -> DriverState:
return DriverState(
dycore_state=self.dycore_state,
Expand Down
1 change: 1 addition & 0 deletions driver/pace/driver/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import click
import yaml

from ndsl.logging import AVAILABLE_LOG_LEVELS, ndsl_log

from .driver import Driver, DriverConfig
Expand Down
2 changes: 1 addition & 1 deletion driver/pace/driver/safety_checks.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from typing import ClassVar, Dict, Optional

import numpy as np
from ndsl.quantity import Quantity

from ndsl.quantity import Quantity
from pyFV3.dycore_state import DycoreState


Expand Down
16 changes: 8 additions & 8 deletions driver/pace/driver/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
from dataclasses import fields
from typing import List

import ndsl.dsl.gt4py_utils as gt_utils
import xarray as xr

import ndsl.dsl.gt4py_utils as gt_utils
import pyFV3
import pySHiELD
from ndsl.comm.communicator import Communicator
from ndsl.constants import N_HALO_DEFAULT, X_DIM, Y_DIM, Z_DIM
from ndsl.dsl.typing import Float
Expand All @@ -13,9 +16,6 @@
from ndsl.initialization.sizer import SubtileGridSizer
from ndsl.quantity import Quantity

import pace.physics
import pyFV3


@dataclasses.dataclass()
class TendencyState:
Expand Down Expand Up @@ -64,7 +64,7 @@ def init_zeros(cls, quantity_factory: QuantityFactory) -> "TendencyState":
@dataclasses.dataclass
class DriverState:
dycore_state: pyFV3.DycoreState
physics_state: pace.physics.PhysicsState
physics_state: pySHiELD.PhysicsState
tendency_state: TendencyState
grid_data: GridData
damping_coefficients: DampingCoefficients
Expand All @@ -81,7 +81,7 @@ def load_state_from_restart(
damping_coefficients: DampingCoefficients,
driver_grid_data: DriverGridData,
grid_data: GridData,
schemes: List[pace.physics.PHYSICS_PACKAGES],
schemes: List[pySHiELD.PHYSICS_PACKAGES],
) -> "DriverState":
comm = driver_config.comm_config.get_comm()
communicator = Communicator.from_layout(comm=comm, layout=driver_config.layout)
Expand Down Expand Up @@ -182,7 +182,7 @@ def _restart_driver_state(
damping_coefficients: DampingCoefficients,
driver_grid_data: DriverGridData,
grid_data: GridData,
schemes: List[pace.physics.PHYSICS_PACKAGES],
schemes: List[pySHiELD.PHYSICS_PACKAGES],
):
fs = get_fs(path)

Expand All @@ -204,7 +204,7 @@ def _restart_driver_state(
"restart_dycore_state",
)

physics_state = pace.physics.PhysicsState.init_zeros(
physics_state = pySHiELD.PhysicsState.init_zeros(
quantity_factory=quantity_factory, schemes=schemes
)

Expand Down
4 changes: 1 addition & 3 deletions driver/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

requirements = [
"ndsl",
"pyFV3",
"pace-physics",
"dacite",
"pyyaml",
"mpi4py",
Expand Down Expand Up @@ -41,7 +39,7 @@
license="BSD license",
packages=find_namespace_packages(include=["pace.*"]),
include_package_data=True,
url="https://github.com/ai2cm/pace",
url="https://github.com/NOAA-GFDL/pace",
version="0.2.0",
zip_safe=False,
)
Loading