Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add back generic precipitation texts #38

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions API/PirateText.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,22 @@ def calculate_text(
else:
cText = [mode, "heavy-sleet"]
cCond = "heavy-sleet"
elif (rainPrep > 0 or snowPrep > 0 or icePrep > 0) and precipType == "none":
if rainPrep < lightRainThresh:
cText = [mode, possiblePrecip + "very-light-precipitation"]
cCond = possiblePrecip + "very-light-precipitation"
elif rainPrep >= lightRainThresh and rainPrep < midRainThresh:
cText = [mode, possiblePrecip + "light-precipitation"]
cCond = possiblePrecip + "light-precipitation"
elif rainPrep >= midRainThresh and rainPrep < heavyRainThresh:
cText = [mode, "medium-precipitation"]
cCond = "medium-precipitation"
else:
cText = [mode, "heavy-precipitation"]
cCond = "heavy-precipitation"

# If visibility < 1000m, show fog
elif vis < visThresh:
elif vis < visThresh and wind < lightWindThresh:
return [mode, "fog"], "fog"
elif cloudCover > cloudThreshold:
cText = [mode, "heavy-clouds"]
Expand Down Expand Up @@ -261,10 +274,7 @@ def calculate_text(
if cIcon is None and cText is not None:
if vis < visThresh:
cIcon = "fog"
elif cloudCover > cloudThreshold:
cIcon = calculate_sky_icon(cloudCover, isDayTime)
elif cloudCover > partlyCloudyThreshold:
cIcon = calculate_sky_icon(cloudCover, isDayTime)
else:
cIcon = calculate_sky_icon(cloudCover, isDayTime)

return cText, cIcon
Loading