Skip to content

Commit 643db7d

Browse files
style: auto-format code with ruff and fprettify
Co-authored-by: sunt05 <1802656+sunt05@users.noreply.github.com>
1 parent 1ed9e96 commit 643db7d

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

src/supy/util/_attribution.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ def attribute_q2(
788788
resistance : +0.0003 g/kg (25.0%)
789789
air_props : +0.0001 g/kg ( 8.3%)
790790
791-
>>> result.plot(kind='bar') # Visualise contributions
791+
>>> result.plot(kind="bar") # Visualise contributions
792792
"""
793793
# Extract SUEWS output group
794794
df_A = _extract_suews_group(df_output_A)
@@ -1080,7 +1080,7 @@ def diagnose_q2(
10801080
--------
10811081
Quick anomaly diagnosis:
10821082
1083-
>>> result = diagnose_q2(df_output, method='anomaly')
1083+
>>> result = diagnose_q2(df_output, method="anomaly")
10841084
>>> print(result)
10851085
q2 Attribution Results
10861086
========================================
@@ -1128,7 +1128,9 @@ def diagnose_q2(
11281128
normal_mask = (hour >= 6) & (hour <= 10) # Morning
11291129

11301130
else:
1131-
raise ValueError(f"Unknown method: {method}. Use 'anomaly', 'extreme', 'diurnal'")
1131+
raise ValueError(
1132+
f"Unknown method: {method}. Use 'anomaly', 'extreme', 'diurnal'"
1133+
)
11321134

11331135
# Check we have enough data in each group
11341136
n_anomaly = anomaly_mask.sum()
@@ -1141,8 +1143,7 @@ def diagnose_q2(
11411143
)
11421144
if n_normal < 10:
11431145
raise ValueError(
1144-
f"Only {n_normal} reference timesteps found. "
1145-
"Cannot establish baseline."
1146+
f"Only {n_normal} reference timesteps found. Cannot establish baseline."
11461147
)
11471148

11481149
# Create reference and anomaly DataFrames
@@ -1213,10 +1214,10 @@ def attribute(
12131214
12141215
Examples
12151216
--------
1216-
>>> result = attribute(df_baseline, df_scenario, variable='T2')
1217+
>>> result = attribute(df_baseline, df_scenario, variable="T2")
12171218
>>> print(result)
12181219
1219-
>>> result = attribute(df_baseline, df_scenario, variable='q2')
1220+
>>> result = attribute(df_baseline, df_scenario, variable="q2")
12201221
>>> print(result)
12211222
"""
12221223
if variable == "T2":
@@ -1225,8 +1226,7 @@ def attribute(
12251226
return attribute_q2(df_output_A, df_output_B, **kwargs)
12261227
else:
12271228
raise ValueError(
1228-
f"Unknown variable: {variable}. "
1229-
f"Supported variables: 'T2', 'q2'"
1229+
f"Unknown variable: {variable}. Supported variables: 'T2', 'q2'"
12301230
)
12311231

12321232

@@ -1261,10 +1261,10 @@ def diagnose(
12611261
12621262
Examples
12631263
--------
1264-
>>> result = diagnose(df_output, variable='T2', method='anomaly')
1264+
>>> result = diagnose(df_output, variable="T2", method="anomaly")
12651265
>>> print(result)
12661266
1267-
>>> result = diagnose(df_output, variable='q2', method='diurnal')
1267+
>>> result = diagnose(df_output, variable="q2", method="diurnal")
12681268
>>> print(result)
12691269
"""
12701270
if variable == "T2":
@@ -1273,8 +1273,7 @@ def diagnose(
12731273
return diagnose_q2(df_output, **kwargs)
12741274
else:
12751275
raise ValueError(
1276-
f"Unknown variable: {variable}. "
1277-
f"Supported variables: 'T2', 'q2'"
1276+
f"Unknown variable: {variable}. Supported variables: 'T2', 'q2'"
12781277
)
12791278

12801279

0 commit comments

Comments
 (0)