Skip to content

Commit bb91ed2

Browse files
committed
initialize_rossby mypy index fix
1 parent 885ba7f commit bb91ed2

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

pyfv3/initialization/test_cases/initialize_rossby.py

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
1-
""" Test case initialization for Rossby-Haurwitz wave 4
1+
"""Test case initialization for Rossby-Haurwitz wave 4
22
33
Corresponds to Fortran shallow-water test #6 found in tools/test_cases.F90 of
44
https://github.com/NOAA-GFDL/GFDL_atmos_cubed_sphere.git
5-
65
"""
76

8-
# mypy: ignore-errors
9-
#
10-
# Until we can investigate more, we are ignoring the mypy errors:
11-
# "Unsupported target for indexed assignment ("Quantity") [index]"
12-
# from lines like:
13-
# numpy_state.pe[:] = 0.0
14-
# This error is triggered when running mypy from projects that use
15-
# PyFV3 as a submodule, like Pace, but not from PyFV3 directly.
7+
from types import SimpleNamespace
168

179
import numpy as np
1810

@@ -30,11 +22,11 @@
3022
GH0 = Float(8.0e3) * constants.GRAV
3123

3224

33-
def _preinit_for_all_sw(numpy_state: DycoreState, shape):
25+
def _preinit_for_all_sw(numpy_state: SimpleNamespace, shape):
3426
"""Pre-initialization for all shallow water tests
3527
3628
Args:
37-
numpy_state: DycoreState modified to update pe, pt, delp
29+
numpy_state: SimpleNamespace modified to update pe, pt, delp
3830
shape: tuple
3931
"""
4032
numpy_state.pe[:] = 0.0
@@ -118,11 +110,11 @@ def _calc_rossby_delp(grid_data: GridData):
118110
)
119111

120112

121-
def _init_for_rossby(numpy_state: DycoreState, grid_data: GridData, shape):
113+
def _init_for_rossby(numpy_state: SimpleNamespace, grid_data: GridData, shape):
122114
"""Initialization specific to Rossby-Haurwitz wave test
123115
124116
Args
125-
numpy_state: DycoreState, modified to update the phis, delp, u, v
117+
numpy_state: SimpleNamespace, modified to update the phis, delp, u, v
126118
grid_Data: GridData
127119
"""
128120
numpy_state.phis[:] = 0.0
@@ -164,11 +156,11 @@ def _init_for_rossby(numpy_state: DycoreState, grid_data: GridData, shape):
164156
# NOTE: test_cases.F90 has dtoa and atoc calls, but not implemented here.
165157

166158

167-
def _postinit_for_all_sw(numpy_state: DycoreState):
159+
def _postinit_for_all_sw(numpy_state: SimpleNamespace):
168160
"""Post-initialization from test_cases.F90 that applies to all shallow water tests
169161
170162
Args
171-
numpy_state: DycoreState - modified
163+
numpy_state: SimpleNamespace - modified
172164
"""
173165

174166
# NOTE: The cl/cl2 tracers from the original test_cases.F90 aren't brought over.
@@ -186,7 +178,7 @@ def init_rossby_state(
186178
comm: CubedSphereCommunicator,
187179
) -> DycoreState:
188180
"""
189-
Create a DycoreState TODO: explain more
181+
Create an initial DycoreState for Rossby
190182
191183
Args:
192184
grid_data: current selected grid data values

0 commit comments

Comments
 (0)