Skip to content

Commit 88742d1

Browse files
Merge branch 'main' into add_full_land_var
2 parents fcb7310 + 794d10b commit 88742d1

File tree

10 files changed

+34
-22
lines changed

10 files changed

+34
-22
lines changed

.github/workflows/build_workflow.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@ jobs:
2929
uses: actions/checkout@v3
3030

3131
- if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
32-
name: Set up Python 3.11
32+
name: Set up Python 3.13
3333
uses: actions/setup-python@v3
3434
with:
35-
python-version: "3.11"
35+
python-version: "3.13"
3636

3737
- if: ${{ steps.skip_check.outputs.should_skip != 'true' }}
3838
# Run all pre-commit hooks on all the files.
3939
# Getting only staged files can be tricky in case a new PR is opened
4040
# since the action is run on a branch in detached head state
4141
name: Install and Run Pre-commit
42-
uses: pre-commit/[email protected].0
42+
uses: pre-commit/[email protected].1
4343

4444
build:
4545
name: Build (Python ${{ matrix.python-version }})
@@ -50,7 +50,7 @@ jobs:
5050
shell: bash -l {0}
5151
strategy:
5252
matrix:
53-
python-version: ["3.10", "3.11", "3.12", "3.13"]
53+
python-version: ["3.11", "3.12", "3.13"]
5454
container:
5555
image: ghcr.io/e3sm-project/containers-e3sm-diags-test-data:e3sm-diags-test-data-0.0.2
5656
steps:

conda-env/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ channels:
77
dependencies:
88
# Base
99
# =================
10-
- python >=3.10
10+
- python >=3.11,<3.14
1111
- pip
1212
- setuptools
1313
- beautifulsoup4

conda-env/dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ channels:
55
dependencies:
66
# Base
77
# =======================
8-
- python >=3.10
8+
- python >=3.11,<3.14
99
- pip
1010
- setuptools
1111
- beautifulsoup4

e3sm_diags/derivations/formulas.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ def qsat(temp: xr.DataArray, surfp: xr.DataArray) -> xr.DataArray:
7575

7676
# Calculation of saturation water vapour pressure (sat_wvp) from Teten's
7777
# formula/
78-
sat_wvp: xr.DataArray = a1 * np.exp(a3 * (temp - T0) / (temp - a4))
78+
# FIXME: error: Incompatible types in assignment (expression has type "ndarray[tuple[Any, ...], dtype[float64]]", variable has type "DataArray") [assignment]
79+
sat_wvp: xr.DataArray = a1 * np.exp(a3 * (temp - T0) / (temp - a4)) # type: ignore
7980

8081
# Calculation of saturation specific humidity at 2m qsat (equal to huss)
8182
# with units g/kg.

e3sm_diags/driver/tc_analysis_driver.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,10 @@ def run_diag(parameter: TCAnalysisParameter) -> TCAnalysisParameter:
8888
ref_data = collections.OrderedDict()
8989

9090
test_data["metrics"] = generate_tc_metrics_from_te_stitch_file(test_te_file)
91-
test_data["cyclone_density"] = test_cyclones_hist
92-
test_data["aew_density"] = test_aew_hist
91+
# FIXME: mypy error: Incompatible types in assignment (expression has type "DataArray", target has type "dict[str, Any]") [assignment]
92+
test_data["cyclone_density"] = test_cyclones_hist # type: ignore
93+
# FIXME: mypy error: Incompatible types in assignment (expression has type "DataArray", target has type "dict[str, Any]") [assignment]
94+
test_data["aew_density"] = test_aew_hist # type: ignore
9395
test_num_years = int(test_end_yr) - int(test_start_yr) + 1
9496
test_data["aew_num_years"] = test_num_years # type: ignore
9597
test_data["cyclone_num_years"] = test_num_years # type: ignore
@@ -121,8 +123,10 @@ def run_diag(parameter: TCAnalysisParameter) -> TCAnalysisParameter:
121123
# Note the refactor included subset that was missed in original implementation
122124
ref_aew_hist = xr.open_dataset(ref_aew_file).sel()["density"]
123125
ref_data["metrics"] = generate_tc_metrics_from_te_stitch_file(ref_te_file)
124-
ref_data["cyclone_density"] = ref_cyclones_hist
125-
ref_data["aew_density"] = ref_aew_hist
126+
# FIXME: mypy error: Incompatible types in assignment (expression has type "DataArray", target has type "dict[str, Any]") [assignment]
127+
ref_data["cyclone_density"] = ref_cyclones_hist # type: ignore
128+
# FIXME: mypy error: Incompatible types in assignment (expression has type "DataArray", target has type "dict[str, Any]") [assignment]
129+
ref_data["aew_density"] = ref_aew_hist # type: ignore
126130
ref_num_years = int(ref_end_yr) - int(ref_start_yr) + 1
127131
ref_data["aew_num_years"] = ref_num_years # type: ignore
128132
ref_data["cyclone_num_years"] = ref_num_years # type: ignore
@@ -142,9 +146,11 @@ def run_diag(parameter: TCAnalysisParameter) -> TCAnalysisParameter:
142146
ref_aew_hist = xr.open_dataset(ref_aew_file).sel(
143147
lat=slice(0, 35), lon=slice(180, 360)
144148
)["density"]
145-
ref_data["cyclone_density"] = ref_cyclones_hist
149+
# FIXME: mypy error: Incompatible types in assignment (expression has type "DataArray", target has type "dict[str, Any]") [assignment]
150+
ref_data["cyclone_density"] = ref_cyclones_hist # type: ignore
146151
ref_data["cyclone_num_years"] = 40 # type: ignore
147-
ref_data["aew_density"] = ref_aew_hist
152+
# FIXME: mypy error: Incompatible types in assignment (expression has type "DataArray", target has type "dict[str, Any]") [assignment]
153+
ref_data["aew_density"] = ref_aew_hist # type: ignore
148154
# Question, should the num_years = 5?
149155
ref_data["aew_num_years"] = 1 # type: ignore
150156
parameter.ref_name = "Observation"

e3sm_diags/driver/utils/dataset_xr.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,8 @@ def _get_dataset_with_derivation_func(
920920
func_args = [ds[var].copy() for var in src_var_keys]
921921

922922
if func in FUNC_NEEDS_TARGET_VAR:
923-
func_args = [target_var_key] + func_args # pragma: nocover
923+
# FIXME: error: Incompatible types in assignment (expression has type "list[DataArray | str]", variable has type "list[DataArray]") [assignment]
924+
func_args = [target_var_key] + func_args # type: ignore # pragma: no cover
924925

925926
# If the target variable key contains a wildcard, there are can be
926927
# N number of function arguments. For the cases, we need to pass the

e3sm_diags/driver/utils/zwf_functions.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,11 @@ def resolveWavesHayashi(varfft: xr.DataArray, nDayWin: int, spd: int) -> xr.Data
374374
if (c != "wavenumber") and (c != "frequency"):
375375
ocoords[c] = varfft[c]
376376
elif c == "wavenumber":
377-
ocoords["wavenumber"] = wave
377+
# FIXME: mypy error: Incompatible types in assignment (expression has type "ndarray[tuple[int], dtype[Any]]", target has type "DataArray") [assignment]
378+
ocoords["wavenumber"] = wave # type: ignore
378379
elif c == "frequency":
379-
ocoords["frequency"] = freq
380+
# FIXME: mypy error: Incompatible types in assignment (expression has type "ndarray[tuple[Any, ...], dtype[float64]]", target has type "DataArray") [assignment]
381+
ocoords["frequency"] = freq # type: ignore
380382
pee = xr.DataArray(pee, dims=odims, coords=ocoords)
381383
return pee
382384

e3sm_diags/plot/tropical_subseasonal_plot.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,12 @@ def _wave_frequency_plot( # noqa: C901
339339
print("west_power: %12.5f" % west_power)
340340
print("ew_ratio: %12.5f\n" % ew_ratio)
341341

342-
z = np.log10(z)
342+
# FIXME: mypy error: Incompatible types in assignment (expression has type "ndarray[tuple[Any, ...], dtype[Any]]", variable has type "DataArray") [assignment]
343+
z = np.log10(z) # type: ignore
343344

344345
if "spec_background" in var_name and subplot_num < 2:
345-
z = np.log10(z)
346+
# FIXME: mypy error: Incompatible types in assignment (expression has type "ndarray[tuple[Any, ...], dtype[Any]]", variable has type "DataArray") [assignment]
347+
z = np.log10(z) # type: ignore
346348

347349
z.attrs["long_name"] = PlotDesc[var_name]["long_name_desc"]
348350
z.attrs["method"] = (

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@ authors = [
1515
]
1616
license = { text = "BSD 3-Clause" }
1717
readme = "README.md"
18-
requires-python = ">=3.10"
18+
requires-python = ">=3.11"
1919
classifiers = [
2020
"Development Status :: 5 - Production/Stable",
2121
"Intended Audience :: Developers",
2222
"License :: OSI Approved :: BSD 3-Clause License",
2323
"Natural Language :: English",
2424
"Programming Language :: Python :: 3",
25-
"Programming Language :: Python :: 3.10",
2625
"Programming Language :: Python :: 3.11",
2726
"Programming Language :: Python :: 3.12",
2827
"Programming Language :: Python :: 3.13",
@@ -215,7 +214,7 @@ testpaths = "tests/e3sm_diags"
215214

216215
[tool.mypy]
217216
# Docs: https://mypy.readthedocs.io/en/stable/config_file.html
218-
python_version = "3.10"
217+
python_version = "3.13"
219218
check_untyped_defs = true
220219
ignore_missing_imports = true
221220
warn_unused_ignores = true

tests/e3sm_diags/driver/utils/test_dataset_xr.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,8 @@ def test_returns_climo_dataset_using_climo_of_time_series_files(self):
875875
name="ts", data=np.array([[1.0, 1.0], [1.0, 1.0]]), dims=["lat", "lon"]
876876
)
877877
# Set all of the correct attributes.
878-
expected = expected.assign(**spatial_coords)
878+
# FIXME: mypy error: Argument 1 to "assign" of "Dataset" has incompatible type "**dict[str, DataArray]"; expected "Mapping[Any, Any] | None" [arg-type]
879+
expected = expected.assign(**spatial_coords) # type: ignore
879880
expected = expected.drop_dims("time")
880881
expected = expected.bounds.add_missing_bounds(axes=["X", "Y"])
881882

0 commit comments

Comments
 (0)