xmobar: treat CAVOK/NSC weather reports as clear
NOAA's decoded METAR has no sky conditions line for CAVOK or NSC, so the weather showed a generic cloud icon and "Unknown"; read them from the raw observation as clear.
This commit is contained in:
1 file changed
+2
@@ -26,6 +26,8 @@ fi
|
|||||||
wx=$(sed -n 's/^Weather: //p' <<< "$report" | tr ';' '\n' | sed 's/^ *//' | grep -v vicinity)
|
wx=$(sed -n 's/^Weather: //p' <<< "$report" | tr ';' '\n' | sed 's/^ *//' | grep -v vicinity)
|
||||||
wx=${wx,,}
|
wx=${wx,,}
|
||||||
sky=$(sed -n 's/^Sky conditions: //p' <<< "$report")
|
sky=$(sed -n 's/^Sky conditions: //p' <<< "$report")
|
||||||
|
# CAVOK/NSC (no cloud below 5000 ft) have no sky line in the decoded report
|
||||||
|
[[ -z $sky ]] && grep -qE '^ob: .* (CAVOK|NSC) ' <<< "$report" && sky=clear
|
||||||
sky=${sky,,}
|
sky=${sky,,}
|
||||||
|
|
||||||
# Sun above the horizon (elevation > -0.833°, as for sunrise/sunset) right now, from the low-precision solar position
|
# Sun above the horizon (elevation > -0.833°, as for sunrise/sunset) right now, from the low-precision solar position
|
||||||
|
|||||||
Reference in new issue
Block a user