cams-pollution-dashboard / templates /aurora_prediction_plot.html
aditya-me13's picture
Integration of Aurora
4f0125c
raw
history blame
13 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Aurora Prediction Visualization - CAMS Dashboard</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Arial', sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
color: #333;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
.header {
text-align: center;
margin-bottom: 30px;
color: white;
}
.header h1 {
font-size: 2.5em;
margin-bottom: 10px;
text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}
.controls-container {
background: rgba(255, 255, 255, 0.95);
border-radius: 15px;
padding: 30px;
margin-bottom: 30px;
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
backdrop-filter: blur(10px);
}
.controls-row {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 20px;
margin-bottom: 20px;
}
.form-group {
display: flex;
flex-direction: column;
}
.form-group label {
margin-bottom: 8px;
font-weight: bold;
color: #555;
}
.form-group select {
padding: 12px;
border: 2px solid #e1e1e1;
border-radius: 8px;
font-size: 16px;
transition: border-color 0.3s ease;
}
.form-group select:focus {
outline: none;
border-color: #667eea;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.btn {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 12px 25px;
border: none;
border-radius: 8px;
font-size: 16px;
cursor: pointer;
transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn:hover {
transform: translateY(-2px);
box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}
.plot-container {
background: rgba(255, 255, 255, 0.95);
border-radius: 15px;
padding: 30px;
margin-bottom: 30px;
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
backdrop-filter: blur(10px);
text-align: center;
}
.plot-image {
max-width: 100%;
height: auto;
border-radius: 10px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}
.info-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 20px;
margin-bottom: 30px;
}
.info-card {
background: rgba(255, 255, 255, 0.95);
border-radius: 15px;
padding: 25px;
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
backdrop-filter: blur(10px);
}
.info-card h3 {
color: #667eea;
margin-bottom: 15px;
font-size: 1.3em;
}
.info-card p {
margin-bottom: 10px;
color: #666;
}
.download-section {
background: rgba(255, 255, 255, 0.95);
border-radius: 15px;
padding: 30px;
margin-bottom: 30px;
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
backdrop-filter: blur(10px);
text-align: center;
}
.download-btn {
background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
color: white;
padding: 15px 30px;
border: none;
border-radius: 8px;
font-size: 18px;
text-decoration: none;
display: inline-block;
transition: transform 0.2s ease, box-shadow 0.2s ease;
margin: 10px;
}
.download-btn:hover {
transform: translateY(-2px);
box-shadow: 0 8px 25px rgba(40, 167, 69, 0.3);
text-decoration: none;
color: white;
}
.back-link {
display: inline-block;
margin-bottom: 20px;
color: white;
text-decoration: none;
font-size: 16px;
transition: opacity 0.3s ease;
}
.back-link:hover {
opacity: 0.8;
}
.back-link::before {
content: "โ† ";
}
.step-indicator {
background: #f8f9ff;
border: 2px solid #e3e7ff;
border-radius: 10px;
padding: 15px;
margin-bottom: 20px;
text-align: center;
}
.step-indicator h3 {
color: #4c63d2;
margin-bottom: 5px;
}
@media (max-width: 768px) {
.container {
padding: 10px;
}
.controls-container, .plot-container, .info-card, .download-section {
padding: 20px;
}
.header h1 {
font-size: 2em;
}
.controls-row {
grid-template-columns: 1fr;
}
}
/* Mini loading indicator for form updates */
.mini-loading {
display: none;
width: 20px;
height: 20px;
border: 2px solid #f3f3f3;
border-top: 2px solid #667eea;
border-radius: 50%;
animation: spin 1s linear infinite;
margin-left: 10px;
}
.form-updating {
opacity: 0.7;
pointer-events: none;
}
</style>
</head>
<body>
<div class="container">
<a href="{{ url_for('index') }}" class="back-link">Back to Main Dashboard</a>
<div class="header">
<h1>๐Ÿ”ฎ Aurora ML Prediction Results</h1>
<p>AI-powered atmospheric forecasting visualization</p>
</div>
<div class="step-indicator">
<h3>๐Ÿ“Š Current View: Step {{ step + 1 }} of {{ max_steps }}</h3>
<p>Forecast time: T+{{ (step + 1) * 12 }}h ahead from initial conditions</p>
</div>
<form method="POST" id="predictionForm">
<div class="controls-container" id="controlsContainer">
<div class="controls-row">
<div class="form-group">
<label for="variable">๐Ÿงช Variable:</label>
<select id="variable" name="variable">
{% for var in variables %}
<option value="{{ var }}" {% if var == var_name %}selected{% endif %}>
{{ var }}
</option>
{% endfor %}
</select>
</div>
<div class="form-group">
<label for="step">โฐ Forecast Step:</label>
<select id="step" name="step">
{% for s in steps %}
<option value="{{ s }}" {% if s == step %}selected{% endif %}>
Step {{ s + 1 }} (T+{{ (s + 1) * 12 }}h)
</option>
{% endfor %}
</select>
</div>
<div class="form-group">
<label for="color_theme">๐ŸŽจ Color Theme:</label>
<select id="color_theme" name="color_theme">
{% for theme_id, theme_name in color_themes.items() %}
<option value="{{ theme_id }}" {% if theme_id == current_color_theme %}selected{% endif %}>
{{ theme_name }}
</option>
{% endfor %}
</select>
</div>
<div class="form-group">
<label>&nbsp;</label>
<button type="submit" class="btn" id="updateBtn">
๐Ÿ”„ Update View
<div class="mini-loading" id="miniLoading"></div>
</button>
</div>
</div>
</div>
</form>
<div class="plot-container">
<img src="{{ url_for('serve_plot', filename=plot_filename) }}"
alt="Aurora Prediction Plot"
class="plot-image">
</div>
<div class="info-grid">
<div class="info-card">
<h3>๐Ÿ”ฌ Variable Information</h3>
<p><strong>Variable:</strong> {{ var_name }}</p>
<p><strong>Forecast Step:</strong> {{ step }}</p>
<p><strong>Time Ahead:</strong> {{ step * 6 }} hours</p>
<p><strong>Color Theme:</strong> {{ color_themes[current_color_theme] }}</p>
</div>
<div class="info-card">
<h3>๐Ÿค– Model Information</h3>
<p><strong>Model:</strong> Microsoft Aurora Air Pollution</p>
<p><strong>Version:</strong> 0.4</p>
<p><strong>Type:</strong> Foundation Model</p>
<p><strong>Resolution:</strong> Global atmospheric prediction</p>
</div>
<div class="info-card">
<h3>๐Ÿ“ˆ Forecast Details</h3>
<p><strong>Total Steps:</strong> {{ steps|length }}</p>
<p><strong>Step Interval:</strong> 6 hours</p>
<p><strong>Max Forecast:</strong> {{ (steps|length - 1) * 6 }} hours</p>
<p><strong>Variables:</strong> {{ variables|length }} predicted</p>
</div>
</div>
<div class="download-section">
<h3 style="color: #667eea; margin-bottom: 20px;">๐Ÿ“ Download Prediction Data</h3>
<p style="margin-bottom: 20px; color: #666;">
Download the complete NetCDF file containing all forecast steps and variables
</p>
<a href="{{ download_url }}" class="download-btn">
๐Ÿ’พ Download NetCDF File
</a>
<a href="{{ url_for('aurora_predict') }}" class="download-btn" style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);">
๐Ÿ”ฎ Generate New Prediction
</a>
</div>
</div>
<script>
// Enhanced form submission with loading indicators
document.addEventListener('DOMContentLoaded', function() {
const form = document.getElementById('predictionForm');
const updateBtn = document.getElementById('updateBtn');
const miniLoading = document.getElementById('miniLoading');
const controlsContainer = document.getElementById('controlsContainer');
const selects = document.querySelectorAll('select');
// Add change event listeners to selects
selects.forEach(select => {
select.addEventListener('change', function() {
showMiniLoading();
// Add a small delay to prevent rapid submissions
setTimeout(() => {
form.submit();
}, 100);
});
});
// Handle manual form submission
form.addEventListener('submit', function(e) {
showMiniLoading();
});
function showMiniLoading() {
miniLoading.style.display = 'inline-block';
controlsContainer.classList.add('form-updating');
updateBtn.disabled = true;
updateBtn.textContent = '๐Ÿ”„ Updating...';
}
// Auto-hide loading indicator if page doesn't redirect within 10 seconds
setTimeout(() => {
if (miniLoading.style.display === 'inline-block') {
hideMiniLoading();
}
}, 10000);
function hideMiniLoading() {
miniLoading.style.display = 'none';
controlsContainer.classList.remove('form-updating');
updateBtn.disabled = false;
updateBtn.innerHTML = '๐Ÿ”„ Update View<div class="mini-loading" id="miniLoading"></div>';
}
});
</script>
</body>
</html>