var meteoCharts = {}; var meteoCompassLabels = {0: 'S', 90: 'V', 180: 'J', 270: 'Z', 360: 'S'}; var meteoRangeMin = 1794524400000; var meteoRangeMax = 1794526460000; function meteoFormatTime(ms) { return moment(ms).format('HH:mm'); } function meteoFormatDateTime(ms) { return moment(ms).format('DD.MM., HH:mm'); } function meteoComputeExtremes(points) { var minPoint = null, maxPoint = null; for (var i = 0; i < points.length; i++) { var p = points[i]; if (p.y === null || p.y === undefined) continue; if (!minPoint || p.y < minPoint.y) minPoint = p; if (!maxPoint || p.y > maxPoint.y) maxPoint = p; } return (minPoint || maxPoint) ? {min: minPoint, max: maxPoint} : null; } function meteoExtremeType(extremes, p) { if (!extremes || !p) return null; if (extremes.max && p.x === extremes.max.x && p.y === extremes.max.y) return 'max'; if (extremes.min && p.x === extremes.min.x && p.y === extremes.min.y) return 'min'; return null; } function meteoBuildDataset(spec) { var extremes = spec.highlightExtremes ? meteoComputeExtremes(spec.points) : null; var baseRadius = spec.pointRadius !== undefined ? spec.pointRadius : 0; var baseHoverRadius = baseRadius || 3; return { label: spec.label, data: spec.points, borderColor: spec.color, backgroundColor: spec.color, borderWidth: 2, tension: 0.15, fill: false, spanGaps: true, showLine: spec.showLine !== false, meteoUnit: spec.unit || '', meteoTooltipMode: spec.tooltipMode || 'default', meteoExtremes: extremes, pointRadius: function(context) { return meteoExtremeType(extremes, context.raw) ? Math.max(baseRadius, 5) : baseRadius; }, pointHoverRadius: function(context) { return meteoExtremeType(extremes, context.raw) ? Math.max(baseHoverRadius, 7) : baseHoverRadius; }, pointBackgroundColor: spec.color, pointBorderColor: '#ffffff', pointBorderWidth: function(context) { return meteoExtremeType(extremes, context.raw) ? 2 : 0; } }; } function buildMeteoChart(canvasId, resetButtonId, specs, extraOptions) { var canvas = document.getElementById(canvasId); if (!canvas || typeof Chart === 'undefined' || !specs.length) { return; } extraOptions = extraOptions || {}; var yScale = {title: {display: !!extraOptions.yLabel, text: extraOptions.yLabel || ''}}; if (extraOptions.yMin !== undefined) yScale.min = extraOptions.yMin; if (extraOptions.yMax !== undefined) yScale.max = extraOptions.yMax; if (extraOptions.yMode === 'compass') { yScale.min = 0; yScale.max = 360; yScale.ticks = { stepSize: 90, callback: function(value) { return meteoCompassLabels[value] !== undefined ? meteoCompassLabels[value] : value; } }; } meteoCharts[canvasId] = new Chart(canvas.getContext('2d'), { type: 'line', data: {datasets: specs.map(meteoBuildDataset)}, options: { responsive: true, maintainAspectRatio: false, animation: false, interaction: {mode: 'nearest', axis: 'x', intersect: false}, scales: { x: { type: 'linear', min: meteoRangeMin, max: meteoRangeMax, ticks: {maxTicksLimit: 8, callback: meteoFormatTime} }, y: yScale }, plugins: { legend: {display: true, position: 'top'}, tooltip: { callbacks: { title: function(items) { return items.length ? meteoFormatDateTime(items[0].parsed.x) : ''; }, label: function(context) { var ds = context.dataset; if (ds.meteoTooltipMode === 'windDirection') { return meteo_wind_direction_name(context.parsed.y); } var extremeType = meteoExtremeType(ds.meteoExtremes, context.raw); var suffix = extremeType === 'max' ? ' (dnešné maximum)' : (extremeType === 'min' ? ' (dnešné minimum)' : ''); return ds.label + ': ' + context.parsed.y + ds.meteoUnit + suffix; } } }, zoom: { pan: {enabled: true, mode: 'x'}, zoom: {wheel: {enabled: true}, pinch: {enabled: true}, mode: 'x'}, limits: {x: {min: meteoRangeMin, max: meteoRangeMax}} } } } }); var resetButton = document.getElementById(resetButtonId); if (resetButton) { resetButton.addEventListener('click', function() { meteoCharts[canvasId].resetZoom(); }); } } $(document).ready(function() { buildMeteoChart('chart-temperature-canvas', 'chart-temperature-reset', [{"label":"Teplota (°C)","color":"#d6212a","points":[{"x":1794524400000,"y":8.2},{"x":1794524460000,"y":8.1},{"x":1794524520000,"y":8.2},{"x":1794524580000,"y":8.2},{"x":1794524640000,"y":8.2},{"x":1794524700000,"y":8.2},{"x":1794524760000,"y":8.2},{"x":1794524820000,"y":8.2},{"x":1794524880000,"y":8.2},{"x":1794524940000,"y":8.2},{"x":1794525000000,"y":8.2},{"x":1794525060000,"y":8.2},{"x":1794525120000,"y":8.2},{"x":1794525180000,"y":8.2},{"x":1794525240000,"y":8.2},{"x":1794525300000,"y":8.2},{"x":1794525360000,"y":8.2},{"x":1794525420000,"y":8.2},{"x":1794525480000,"y":8.2},{"x":1794525540000,"y":8.2},{"x":1794525600000,"y":8.2},{"x":1794525660000,"y":8.2},{"x":1794525720000,"y":8.2},{"x":1794525780000,"y":8.2},{"x":1794525840000,"y":8.2},{"x":1794525900000,"y":8.2},{"x":1794525960000,"y":8.2},{"x":1794526020000,"y":8.2},{"x":1794526080000,"y":8.2},{"x":1794526140000,"y":8.2},{"x":1794526200000,"y":8.1},{"x":1794526260000,"y":8.1},{"x":1794526320000,"y":8.1},{"x":1794526380000,"y":8.1},{"x":1794526440000,"y":8.1}],"highlightExtremes":true,"unit":" °C"},{"label":"Rosný bod (°C)","color":"#5b9f4a","points":[{"x":1794524400000,"y":7.5},{"x":1794524460000,"y":7.5},{"x":1794524520000,"y":7.6},{"x":1794524580000,"y":7.5},{"x":1794524640000,"y":7.6},{"x":1794524700000,"y":7.6},{"x":1794524760000,"y":7.5},{"x":1794524820000,"y":7.4},{"x":1794524880000,"y":7.6},{"x":1794524940000,"y":7.6},{"x":1794525000000,"y":7.6},{"x":1794525060000,"y":7.6},{"x":1794525120000,"y":7.6},{"x":1794525180000,"y":7.5},{"x":1794525240000,"y":7.4},{"x":1794525300000,"y":7.6},{"x":1794525360000,"y":7.6},{"x":1794525420000,"y":7.6},{"x":1794525480000,"y":7.5},{"x":1794525540000,"y":7.3},{"x":1794525600000,"y":7.6},{"x":1794525660000,"y":7.6},{"x":1794525720000,"y":7.5},{"x":1794525780000,"y":7.5},{"x":1794525840000,"y":7.5},{"x":1794525900000,"y":7.5},{"x":1794525960000,"y":7.6},{"x":1794526020000,"y":7.5},{"x":1794526080000,"y":7.5},{"x":1794526140000,"y":7.5},{"x":1794526200000,"y":7.4},{"x":1794526260000,"y":7.4},{"x":1794526320000,"y":7.4},{"x":1794526380000,"y":7.4},{"x":1794526440000,"y":7.3}],"highlightExtremes":false,"unit":" °C"}], {"yLabel":"\u00b0C"}); }); $(document).ready(function() { buildMeteoChart('chart-ground-temperature-canvas', 'chart-ground-temperature-reset', [{"label":"5 cm nad povrchom (°C)","color":"#f39c12","points":[{"x":1794524400000,"y":8},{"x":1794524460000,"y":8},{"x":1794524520000,"y":8},{"x":1794524580000,"y":8},{"x":1794524640000,"y":8},{"x":1794524700000,"y":8},{"x":1794524760000,"y":8},{"x":1794524820000,"y":8},{"x":1794524880000,"y":8},{"x":1794524940000,"y":8},{"x":1794525000000,"y":8.1},{"x":1794525060000,"y":8},{"x":1794525120000,"y":8},{"x":1794525180000,"y":8},{"x":1794525240000,"y":8},{"x":1794525300000,"y":8},{"x":1794525360000,"y":8},{"x":1794525420000,"y":8},{"x":1794525480000,"y":8},{"x":1794525540000,"y":8},{"x":1794525600000,"y":8},{"x":1794525660000,"y":8},{"x":1794525720000,"y":8},{"x":1794525780000,"y":8},{"x":1794525840000,"y":8},{"x":1794525900000,"y":8},{"x":1794525960000,"y":7.9},{"x":1794526020000,"y":7.9},{"x":1794526080000,"y":7.9},{"x":1794526140000,"y":7.9},{"x":1794526200000,"y":7.9},{"x":1794526260000,"y":7.8},{"x":1794526320000,"y":7.8},{"x":1794526380000,"y":7.8},{"x":1794526440000,"y":7.7}],"highlightExtremes":true,"unit":" °C"}], {"yLabel":"\u00b0C"}); }); $(document).ready(function() { buildMeteoChart('chart-ground-humidity-canvas', 'chart-ground-humidity-reset', [{"label":"10 cm pod povrchom (%)","color":"#00a8cc","points":[{"x":1794524400000,"y":12.4},{"x":1794524460000,"y":12.5},{"x":1794524520000,"y":12.4},{"x":1794524580000,"y":12.3},{"x":1794524640000,"y":12.4},{"x":1794524700000,"y":12.4},{"x":1794524760000,"y":12.5},{"x":1794524820000,"y":12.5},{"x":1794524880000,"y":12.4},{"x":1794524940000,"y":12.4},{"x":1794525000000,"y":12.3},{"x":1794525060000,"y":12.4},{"x":1794525120000,"y":12.5},{"x":1794525180000,"y":12.4},{"x":1794525240000,"y":12.3},{"x":1794525300000,"y":12.5},{"x":1794525360000,"y":12.6},{"x":1794525420000,"y":12.4},{"x":1794525480000,"y":12.6},{"x":1794525540000,"y":12.4},{"x":1794525600000,"y":12.5},{"x":1794525660000,"y":12.4},{"x":1794525720000,"y":12.6},{"x":1794525780000,"y":12.5},{"x":1794525840000,"y":12.5},{"x":1794525900000,"y":12.5},{"x":1794525960000,"y":12.5},{"x":1794526020000,"y":12.5},{"x":1794526080000,"y":12.5},{"x":1794526140000,"y":12.6},{"x":1794526200000,"y":12.5},{"x":1794526260000,"y":12.6},{"x":1794526320000,"y":12.5},{"x":1794526380000,"y":12.5},{"x":1794526440000,"y":12.4}],"highlightExtremes":true,"unit":" %"},{"label":"20 cm pod povrchom (%)","color":"#0077b6","points":[{"x":1794524400000,"y":11.5},{"x":1794524460000,"y":11.6},{"x":1794524520000,"y":11.6},{"x":1794524580000,"y":11.6},{"x":1794524640000,"y":11.6},{"x":1794524700000,"y":11.6},{"x":1794524760000,"y":11.6},{"x":1794524820000,"y":11.5},{"x":1794524880000,"y":11.5},{"x":1794524940000,"y":11.5},{"x":1794525000000,"y":11.5},{"x":1794525060000,"y":11.5},{"x":1794525120000,"y":11.6},{"x":1794525180000,"y":11.6},{"x":1794525240000,"y":11.5},{"x":1794525300000,"y":11.5},{"x":1794525360000,"y":11.5},{"x":1794525420000,"y":11.4},{"x":1794525480000,"y":11.5},{"x":1794525540000,"y":11.5},{"x":1794525600000,"y":11.6},{"x":1794525660000,"y":11.5},{"x":1794525720000,"y":11.5},{"x":1794525780000,"y":11.5},{"x":1794525840000,"y":11.6},{"x":1794525900000,"y":11.6},{"x":1794525960000,"y":11.5},{"x":1794526020000,"y":11.6},{"x":1794526080000,"y":11.5},{"x":1794526140000,"y":11.6},{"x":1794526200000,"y":11.6},{"x":1794526260000,"y":11.6},{"x":1794526320000,"y":11.6},{"x":1794526380000,"y":11.6},{"x":1794526440000,"y":11.6}],"highlightExtremes":true,"unit":" %"},{"label":"50 cm pod povrchom (%)","color":"#5a189a","points":[{"x":1794524400000,"y":18.5},{"x":1794524460000,"y":18.6},{"x":1794524520000,"y":18.6},{"x":1794524580000,"y":19.3},{"x":1794524640000,"y":19},{"x":1794524700000,"y":19},{"x":1794524760000,"y":19.5},{"x":1794524820000,"y":18.7},{"x":1794524880000,"y":18.6},{"x":1794524940000,"y":19.2},{"x":1794525000000,"y":18.7},{"x":1794525060000,"y":18.6},{"x":1794525120000,"y":19.3},{"x":1794525180000,"y":18.7},{"x":1794525240000,"y":19.7},{"x":1794525300000,"y":19.3},{"x":1794525360000,"y":19.3},{"x":1794525420000,"y":19.9},{"x":1794525480000,"y":18.6},{"x":1794525540000,"y":19.4},{"x":1794525600000,"y":18.5},{"x":1794525660000,"y":18.6},{"x":1794525720000,"y":18.4},{"x":1794525780000,"y":18.6},{"x":1794525840000,"y":18.7},{"x":1794525900000,"y":19.4},{"x":1794525960000,"y":18.8},{"x":1794526020000,"y":18.6},{"x":1794526080000,"y":19.3},{"x":1794526140000,"y":19},{"x":1794526200000,"y":19.2},{"x":1794526260000,"y":19},{"x":1794526320000,"y":18.5},{"x":1794526380000,"y":18.9},{"x":1794526440000,"y":19.5}],"highlightExtremes":true,"unit":" %"}], {"yLabel":"%"}); }); $(document).ready(function() { buildMeteoChart('chart-humidity-canvas', 'chart-humidity-reset', [{"label":"Vlhkosť (%)","color":"#ff9000","points":[{"x":1794524400000,"y":95.3},{"x":1794524460000,"y":96.1},{"x":1794524520000,"y":95.9},{"x":1794524580000,"y":95.6},{"x":1794524640000,"y":96},{"x":1794524700000,"y":96},{"x":1794524760000,"y":95.6},{"x":1794524820000,"y":94.9},{"x":1794524880000,"y":95.9},{"x":1794524940000,"y":96},{"x":1794525000000,"y":95.9},{"x":1794525060000,"y":95.9},{"x":1794525120000,"y":95.9},{"x":1794525180000,"y":95.5},{"x":1794525240000,"y":94.9},{"x":1794525300000,"y":96},{"x":1794525360000,"y":95.8},{"x":1794525420000,"y":96.1},{"x":1794525480000,"y":95.5},{"x":1794525540000,"y":94},{"x":1794525600000,"y":95.9},{"x":1794525660000,"y":96},{"x":1794525720000,"y":95.7},{"x":1794525780000,"y":95.2},{"x":1794525840000,"y":95.6},{"x":1794525900000,"y":95.7},{"x":1794525960000,"y":95.8},{"x":1794526020000,"y":95.6},{"x":1794526080000,"y":95.1},{"x":1794526140000,"y":95.1},{"x":1794526200000,"y":95.4},{"x":1794526260000,"y":95.5},{"x":1794526320000,"y":95.5},{"x":1794526380000,"y":95.3},{"x":1794526440000,"y":94.8}],"highlightExtremes":true,"unit":" %"}], {"yLabel":"%"}); }); $(document).ready(function() { buildMeteoChart('chart-pressure-canvas', 'chart-pressure-reset', [{"label":"Atmosférický tlak (hPa)","color":"#000000","points":[{"x":1794524400000,"y":992.4},{"x":1794524460000,"y":992.5},{"x":1794524520000,"y":992.4},{"x":1794524580000,"y":992.4},{"x":1794524640000,"y":992.4},{"x":1794524700000,"y":992.4},{"x":1794524760000,"y":992.4},{"x":1794524820000,"y":992.4},{"x":1794524880000,"y":992.4},{"x":1794524940000,"y":992.4},{"x":1794525000000,"y":992.4},{"x":1794525060000,"y":992.3},{"x":1794525120000,"y":992.3},{"x":1794525180000,"y":992.4},{"x":1794525240000,"y":992.4},{"x":1794525300000,"y":992.4},{"x":1794525360000,"y":992.4},{"x":1794525420000,"y":992.4},{"x":1794525480000,"y":992.4},{"x":1794525540000,"y":992.4},{"x":1794525600000,"y":992.4},{"x":1794525660000,"y":992.4},{"x":1794525720000,"y":992.4},{"x":1794525780000,"y":992.4},{"x":1794525840000,"y":992.4},{"x":1794525900000,"y":992.4},{"x":1794525960000,"y":992.4},{"x":1794526020000,"y":992.4},{"x":1794526080000,"y":992.4},{"x":1794526140000,"y":992.4},{"x":1794526200000,"y":992.4},{"x":1794526260000,"y":992.4},{"x":1794526320000,"y":992.4},{"x":1794526380000,"y":992.4},{"x":1794526440000,"y":992.4}],"highlightExtremes":true,"unit":" hPa"}], {"yLabel":"hPa"}); }); $(document).ready(function() { buildMeteoChart('chart-wind-canvas', 'chart-wind-reset', [{"label":"Rýchlosť vetra (km\/h)","color":"#002f80","points":[{"x":1794524400000,"y":14.8},{"x":1794524460000,"y":11.5},{"x":1794524520000,"y":10.4},{"x":1794524580000,"y":9.7},{"x":1794524640000,"y":7.9},{"x":1794524700000,"y":8.3},{"x":1794524760000,"y":10.8},{"x":1794524820000,"y":10.8},{"x":1794524880000,"y":7.9},{"x":1794524940000,"y":7.9},{"x":1794525000000,"y":7.2},{"x":1794525060000,"y":8.3},{"x":1794525120000,"y":9.7},{"x":1794525180000,"y":8.3},{"x":1794525240000,"y":11.2},{"x":1794525300000,"y":9.4},{"x":1794525360000,"y":10.4},{"x":1794525420000,"y":6.1},{"x":1794525480000,"y":6.1},{"x":1794525540000,"y":8.3},{"x":1794525600000,"y":5.8},{"x":1794525660000,"y":5.4},{"x":1794525720000,"y":7.9},{"x":1794525780000,"y":9},{"x":1794525840000,"y":6.1},{"x":1794525900000,"y":11.9},{"x":1794525960000,"y":8.6},{"x":1794526020000,"y":14},{"x":1794526080000,"y":11.2},{"x":1794526140000,"y":10.8},{"x":1794526200000,"y":8.3},{"x":1794526260000,"y":6.8},{"x":1794526320000,"y":10.8},{"x":1794526380000,"y":7.6},{"x":1794526440000,"y":6.8}],"highlightExtremes":true,"unit":" km\/h"},{"label":"Náraz vetra (km\/h)","color":"#EF9856","points":[{"x":1794524400000,"y":17.6},{"x":1794524460000,"y":14.4},{"x":1794524520000,"y":13.3},{"x":1794524580000,"y":12.2},{"x":1794524640000,"y":10.1},{"x":1794524700000,"y":10.1},{"x":1794524760000,"y":14.4},{"x":1794524820000,"y":12.6},{"x":1794524880000,"y":9.7},{"x":1794524940000,"y":10.1},{"x":1794525000000,"y":9},{"x":1794525060000,"y":10.1},{"x":1794525120000,"y":11.9},{"x":1794525180000,"y":11.2},{"x":1794525240000,"y":13},{"x":1794525300000,"y":11.9},{"x":1794525360000,"y":11.5},{"x":1794525420000,"y":8.3},{"x":1794525480000,"y":9.7},{"x":1794525540000,"y":10.1},{"x":1794525600000,"y":7.9},{"x":1794525660000,"y":8.6},{"x":1794525720000,"y":12.2},{"x":1794525780000,"y":11.2},{"x":1794525840000,"y":10.4},{"x":1794525900000,"y":16.6},{"x":1794525960000,"y":10.8},{"x":1794526020000,"y":16.9},{"x":1794526080000,"y":16.9},{"x":1794526140000,"y":14.4},{"x":1794526200000,"y":10.8},{"x":1794526260000,"y":9},{"x":1794526320000,"y":15.5},{"x":1794526380000,"y":10.1},{"x":1794526440000,"y":8.3}],"highlightExtremes":true,"unit":" km\/h","showLine":false,"pointRadius":3}], {"yLabel":"km\/h"}); }); $(document).ready(function() { buildMeteoChart('chart-wind-direction-canvas', 'chart-wind-direction-reset', [{"label":"Smer vetra","color":"#002f80","points":[{"x":1794524400000,"y":346.4},{"x":1794524460000,"y":335},{"x":1794524520000,"y":333.9},{"x":1794524580000,"y":340.3},{"x":1794524640000,"y":333.4},{"x":1794524700000,"y":346.2},{"x":1794524760000,"y":339.1},{"x":1794524820000,"y":334.3},{"x":1794524880000,"y":335.2},{"x":1794524940000,"y":334.7},{"x":1794525000000,"y":337.7},{"x":1794525060000,"y":347.2},{"x":1794525120000,"y":352.7},{"x":1794525180000,"y":347},{"x":1794525240000,"y":349.2},{"x":1794525300000,"y":330},{"x":1794525360000,"y":355.1},{"x":1794525420000,"y":347.9},{"x":1794525480000,"y":349.4},{"x":1794525540000,"y":342.2},{"x":1794525600000,"y":333.3},{"x":1794525660000,"y":342.9},{"x":1794525720000,"y":358.1},{"x":1794525780000,"y":343},{"x":1794525840000,"y":318.5},{"x":1794525900000,"y":324.9},{"x":1794525960000,"y":323.4},{"x":1794526020000,"y":330.5},{"x":1794526080000,"y":331.3},{"x":1794526140000,"y":337.9},{"x":1794526200000,"y":336.7},{"x":1794526260000,"y":319.7},{"x":1794526320000,"y":347.6},{"x":1794526380000,"y":333.2},{"x":1794526440000,"y":331.3}],"highlightExtremes":false,"showLine":false,"pointRadius":3,"tooltipMode":"windDirection"}], {"yMode":"compass"}); }); $(document).ready(function() { buildMeteoChart('chart-rain-canvas', 'chart-rain-reset', [{"label":"Zrážky (mm)","color":"#008fbf","points":[{"x":1794524400000,"y":0},{"x":1794524460000,"y":0.08},{"x":1794524520000,"y":0.08},{"x":1794524580000,"y":0.12},{"x":1794524640000,"y":0.12},{"x":1794524700000,"y":0.12},{"x":1794524760000,"y":0.16},{"x":1794524820000,"y":0.16},{"x":1794524880000,"y":0.19},{"x":1794524940000,"y":0.23},{"x":1794525000000,"y":0.23},{"x":1794525060000,"y":0.23},{"x":1794525120000,"y":0.32},{"x":1794525180000,"y":0.32},{"x":1794525240000,"y":0.36},{"x":1794525300000,"y":0.36},{"x":1794525360000,"y":0.4},{"x":1794525420000,"y":0.4},{"x":1794525480000,"y":0.44},{"x":1794525540000,"y":0.48},{"x":1794525600000,"y":0.52},{"x":1794525660000,"y":0.56},{"x":1794525720000,"y":0.6},{"x":1794525780000,"y":0.6},{"x":1794525840000,"y":0.6},{"x":1794525900000,"y":0.68},{"x":1794525960000,"y":0.68},{"x":1794526020000,"y":0.72},{"x":1794526080000,"y":0.72},{"x":1794526140000,"y":0.76},{"x":1794526200000,"y":0.8},{"x":1794526260000,"y":0.8},{"x":1794526320000,"y":0.88},{"x":1794526380000,"y":0.88},{"x":1794526440000,"y":0.92}],"highlightExtremes":false,"unit":" mm"}], {"yLabel":"mm","yMin":0}); }); $('.modal').on('hide.bs.modal', function() { var memory = $(this).html(); $(this).html(memory); }); function meteo_wind_direction_name(wind_direction) { if (wind_direction >= 0.00 && wind_direction <= 11.25) { ret = 'S'; } else if (wind_direction > 11.25 && wind_direction <= 33.75) { ret = 'SSV'; } else if (wind_direction > 33.75 && wind_direction <= 56.25) { ret = 'SV'; } else if (wind_direction > 56.25 && wind_direction <= 78.75) { // 67.5 ret = 'VSV'; } else if (wind_direction > 78.75 && wind_direction <= 101.25) { // 90 ret = 'V'; } else if (wind_direction > 101.25 && wind_direction <= 123.75) { //112.5 ret = 'VJV'; } else if (wind_direction > 123.75 && wind_direction <= 146.25) { // 135 ret = 'JV'; } else if (wind_direction > 146.25 && wind_direction <= 168.75) { // 157.5 ret = 'JJV'; } else if (wind_direction > 168.75 && wind_direction <= 191.25) { // 180 ret = 'J'; } else if (wind_direction > 191.25 && wind_direction <= 213.75) { // 202.5 ret = 'JJZ'; } else if (wind_direction > 213.75 && wind_direction <= 236.25) { // 225 ret = 'JZ'; } else if (wind_direction > 236.25 && wind_direction <= 258.75) { // 247.5 ret = 'ZJZ'; } else if (wind_direction > 258.75 && wind_direction <= 281.25) { // 270 ret = 'Z'; } else if (wind_direction > 281.25 && wind_direction <= 303.75) { // 292.5 ret = 'ZSZ'; } else if (wind_direction > 303.75 && wind_direction <= 326.25) { // 315 ret = 'SZ'; } else if (wind_direction > 326.25 && wind_direction <= 348.75) { // 337.5 ret = 'SSZ'; } else if (wind_direction > 348.75 && wind_direction <= 360.0) { // 337.5 ret = 'S'; } else { return ''; } return ret; }