stato del mare: previsione onde Open-Meteo + scala Douglas (oggi/domani), EN/IT, context Sea
This commit is contained in:
@@ -168,6 +168,19 @@ function fmtHM(t) {
|
||||
return (hh < 10 ? "0" : "") + hh + ":" + (mm < 10 ? "0" : "") + mm;
|
||||
}
|
||||
|
||||
// Scala Douglas (stato del mare) dall'altezza d'onda significativa in metri
|
||||
// 0 Calmo, 1 Quasi calmo, 2 Poco mosso, 3 Mosso, 4 Molto mosso, 5 Agitato,
|
||||
// 6 Molto agitato, 7 Grosso, 8 Molto grosso, 9 Tempestoso
|
||||
function douglas(h) {
|
||||
if (h <= 0) return 0;
|
||||
var soglie = [0.1, 0.5, 1.25, 2.5, 4, 6, 9, 14];
|
||||
var g = 1;
|
||||
for (var i = 0; i < soglie.length; i++) {
|
||||
if (h >= soglie[i]) g++;
|
||||
}
|
||||
return g;
|
||||
}
|
||||
|
||||
// Formato data breve
|
||||
function fmtDate(t, dn) {
|
||||
var d = new Date(t);
|
||||
|
||||
Reference in New Issue
Block a user