feat: Support CLR cloud condition and fix SKC altitude parsing
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
+8
-1
@@ -152,13 +152,20 @@
|
|||||||
function decodeClouds(code) {
|
function decodeClouds(code) {
|
||||||
const coverMap = {
|
const coverMap = {
|
||||||
'SKC': 'Sky clear',
|
'SKC': 'Sky clear',
|
||||||
|
'CLR': 'Sky clear',
|
||||||
'FEW': 'Few clouds',
|
'FEW': 'Few clouds',
|
||||||
'SCT': 'Scattered clouds',
|
'SCT': 'Scattered clouds',
|
||||||
'BKN': 'Broken clouds',
|
'BKN': 'Broken clouds',
|
||||||
'OVC': 'Overcast clouds'
|
'OVC': 'Overcast clouds'
|
||||||
};
|
};
|
||||||
const cover = coverMap[code.substring(0, 3)];
|
const coverType = code.substring(0, 3);
|
||||||
|
const cover = coverMap[coverType];
|
||||||
if (!cover) return `${code}: Unknown cloud information`;
|
if (!cover) return `${code}: Unknown cloud information`;
|
||||||
|
|
||||||
|
if (coverType === 'SKC' || coverType === 'CLR') {
|
||||||
|
return `${code}: ${cover}`;
|
||||||
|
}
|
||||||
|
|
||||||
const alt = parseInt(code.substring(3, 6)) * 100;
|
const alt = parseInt(code.substring(3, 6)) * 100;
|
||||||
return `${code}: ${cover} at ${alt.toLocaleString()} feet above ground`;
|
return `${code}: ${cover} at ${alt.toLocaleString()} feet above ground`;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user