Skip to content

Commit 000ca38

Browse files
committed
Temporarily ignore mypy issues
1 parent 321769f commit 000ca38

File tree

6 files changed

+26
-13
lines changed

6 files changed

+26
-13
lines changed

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"] = (

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)