Skip to content

Commit

Permalink
style fixes by ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander0042 authored and github-actions[bot] committed Nov 19, 2024
1 parent fe3262e commit 58df372
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions API/responseLocal.py
Original file line number Diff line number Diff line change
Expand Up @@ -2558,9 +2558,9 @@ async def PW_Forecast(
WindBearingHour[:, 2] = np.rad2deg(
np.mod(np.arctan2(GFS_Merged[:, 8], GFS_Merged[:, 9]) + np.pi, 2 * np.pi)
)
InterPhour[:, 12] = np.mod(np.choose(
np.argmin(np.isnan(WindBearingHour), axis=1), WindBearingHour.T
),360)
InterPhour[:, 12] = np.mod(
np.choose(np.argmin(np.isnan(WindBearingHour), axis=1), WindBearingHour.T), 360
)

### Cloud Cover
CloudCoverHour = np.full((len(hour_array_grib), 3), np.nan)
Expand Down Expand Up @@ -3286,11 +3286,11 @@ async def PW_Forecast(
# Format description newlines
alertDescript = alertDetails[1]
# Step 1: Replace double newlines with a single newline
formatted_text = re.sub(r'(?<!\n)\n(?!\n)', ' ', alertDescript)
formatted_text = re.sub(r"(?<!\n)\n(?!\n)", " ", alertDescript)

# Step 2: Replace remaining single newlines with a space
formatted_text = re.sub(r'\n\n', '\n', formatted_text )
formatted_text = re.sub(r"\n\n", "\n", formatted_text)

alertDict = {
"title": alertDetails[0],
"regions": [s.lstrip() for s in alertDetails[2].split(";")],
Expand All @@ -3317,7 +3317,7 @@ async def PW_Forecast(

else:
alertList = []

except Exception as error:
print("An Alert error occurred:", error)

Expand All @@ -3339,7 +3339,6 @@ async def PW_Forecast(
GFS_Merged[:, 0], minute_array_grib[0], side="left"
)


# Find weighting factors for hourly data
# Weighting factors for linear interpolation
interpFac1 = 1 - (
Expand Down Expand Up @@ -3726,7 +3725,7 @@ async def PW_Forecast(
returnOBJ["currently"]["pressure"] = InterPcurrent[8]
returnOBJ["currently"]["windSpeed"] = InterPcurrent[9]
returnOBJ["currently"]["windGust"] = InterPcurrent[10]
returnOBJ["currently"]["windBearing"] = np.mod(InterPcurrent[11],360).round()
returnOBJ["currently"]["windBearing"] = np.mod(InterPcurrent[11], 360).round()
returnOBJ["currently"]["cloudCover"] = InterPcurrent[12]

if (not timeMachine) or (tmExtra):
Expand Down

0 comments on commit 58df372

Please sign in to comment.