Spaces:
Running
Running
Commit
Β·
b395e0e
1
Parent(s):
1265936
Enhance plot titles and improve UI consistency
Browse files- Added pressure level and plot type (Static/Interactive) to plot titles
- Fixed color theme support for all available themes in interactive plots
- Restored gradient backgrounds for gallery and view_interactive pages
- Standardized button styling on index page (removed underlines, consistent sizing)
- Maintained glassmorphism design for gallery/viewer pages while keeping clean design for main dashboard
- data_processor.py +5 -1
- templates/interactive_plot.html +76 -45
data_processor.py
CHANGED
|
@@ -281,6 +281,7 @@ class NetCDFProcessor:
|
|
| 281 |
data_array = data_array.isel({coords['time']: time_index})
|
| 282 |
|
| 283 |
# Handle pressure/level dimension for atmospheric variables
|
|
|
|
| 284 |
if coords['level'] and coords['level'] in data_array.dims:
|
| 285 |
if pressure_level is None:
|
| 286 |
# Default to surface level (highest pressure)
|
|
@@ -293,6 +294,9 @@ class NetCDFProcessor:
|
|
| 293 |
|
| 294 |
data_array = data_array.isel({coords['level']: level_index})
|
| 295 |
print(f"Selected pressure level: {actual_pressure} hPa (requested: {pressure_level} hPa)")
|
|
|
|
|
|
|
|
|
|
| 296 |
|
| 297 |
# Handle batch dimension (usually the first dimension for CAMS data)
|
| 298 |
shape = data_array.shape
|
|
@@ -322,7 +326,7 @@ class NetCDFProcessor:
|
|
| 322 |
'shape': data_values.shape,
|
| 323 |
'lats': lats,
|
| 324 |
'lons': lons,
|
| 325 |
-
'pressure_level':
|
| 326 |
'time_index': time_index,
|
| 327 |
'timestamp': selected_timestamp,
|
| 328 |
'timestamp_str': timestamp_str,
|
|
|
|
| 281 |
data_array = data_array.isel({coords['time']: time_index})
|
| 282 |
|
| 283 |
# Handle pressure/level dimension for atmospheric variables
|
| 284 |
+
actual_pressure = None
|
| 285 |
if coords['level'] and coords['level'] in data_array.dims:
|
| 286 |
if pressure_level is None:
|
| 287 |
# Default to surface level (highest pressure)
|
|
|
|
| 294 |
|
| 295 |
data_array = data_array.isel({coords['level']: level_index})
|
| 296 |
print(f"Selected pressure level: {actual_pressure} hPa (requested: {pressure_level} hPa)")
|
| 297 |
+
elif pressure_level is not None:
|
| 298 |
+
# Store the requested pressure level even if no level dimension exists
|
| 299 |
+
actual_pressure = pressure_level
|
| 300 |
|
| 301 |
# Handle batch dimension (usually the first dimension for CAMS data)
|
| 302 |
shape = data_array.shape
|
|
|
|
| 326 |
'shape': data_values.shape,
|
| 327 |
'lats': lats,
|
| 328 |
'lons': lons,
|
| 329 |
+
'pressure_level': actual_pressure,
|
| 330 |
'time_index': time_index,
|
| 331 |
'timestamp': selected_timestamp,
|
| 332 |
'timestamp_str': timestamp_str,
|
templates/interactive_plot.html
CHANGED
|
@@ -6,105 +6,134 @@
|
|
| 6 |
<title>Interactive Air Pollution Map - India CAMS Dashboard</title>
|
| 7 |
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
|
| 8 |
<style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
body {
|
| 10 |
-
font-family:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
max-width: 1400px;
|
| 12 |
margin: 0 auto;
|
| 13 |
padding: 20px;
|
| 14 |
-
background: #f5f5f5;
|
| 15 |
}
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
border-radius:
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
}
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
margin-bottom:
|
|
|
|
| 26 |
}
|
|
|
|
| 27 |
.plot-container {
|
| 28 |
-
background:
|
| 29 |
-
border-radius:
|
| 30 |
padding: 20px;
|
| 31 |
margin-bottom: 20px;
|
| 32 |
-
|
|
|
|
|
|
|
| 33 |
}
|
|
|
|
| 34 |
.plot-info {
|
| 35 |
-
background:
|
| 36 |
-
border-radius:
|
| 37 |
padding: 20px;
|
| 38 |
-
|
|
|
|
|
|
|
| 39 |
}
|
|
|
|
| 40 |
.info-grid {
|
| 41 |
display: grid;
|
| 42 |
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
| 43 |
gap: 15px;
|
| 44 |
margin-bottom: 20px;
|
| 45 |
}
|
|
|
|
| 46 |
.info-item {
|
| 47 |
-
background:
|
| 48 |
padding: 15px;
|
| 49 |
-
border-radius:
|
| 50 |
border-left: 4px solid #3498db;
|
| 51 |
}
|
|
|
|
| 52 |
.info-item h3 {
|
| 53 |
color: #2c3e50;
|
| 54 |
margin-bottom: 5px;
|
| 55 |
font-size: 14px;
|
| 56 |
font-weight: 600;
|
| 57 |
}
|
|
|
|
| 58 |
.info-item p {
|
| 59 |
color: #34495e;
|
| 60 |
font-size: 16px;
|
| 61 |
font-weight: 500;
|
| 62 |
}
|
|
|
|
| 63 |
.controls {
|
| 64 |
display: flex;
|
| 65 |
gap: 15px;
|
| 66 |
flex-wrap: wrap;
|
| 67 |
margin-bottom: 20px;
|
| 68 |
}
|
|
|
|
| 69 |
.btn {
|
| 70 |
-
background: #3498db;
|
| 71 |
color: white;
|
| 72 |
padding: 12px 24px;
|
| 73 |
border: none;
|
| 74 |
-
border-radius:
|
| 75 |
-
cursor: pointer;
|
| 76 |
-
font-size: 16px;
|
| 77 |
-
font-weight: 600;
|
| 78 |
-
transition: background 0.3s;
|
| 79 |
text-decoration: none;
|
| 80 |
-
|
|
|
|
|
|
|
|
|
|
| 81 |
}
|
| 82 |
-
|
| 83 |
-
|
|
|
|
|
|
|
| 84 |
}
|
|
|
|
| 85 |
.btn-download {
|
| 86 |
-
background: #27ae60;
|
| 87 |
-
}
|
| 88 |
-
.btn-download:hover {
|
| 89 |
-
background: #219a52;
|
| 90 |
}
|
|
|
|
| 91 |
.btn-back {
|
| 92 |
-
background: #95a5a6;
|
| 93 |
-
}
|
| 94 |
-
.btn-back:hover {
|
| 95 |
-
background: #7f8c8d;
|
| 96 |
}
|
|
|
|
| 97 |
.instructions {
|
| 98 |
-
background:
|
|
|
|
| 99 |
padding: 20px;
|
| 100 |
-
border-radius: 8px;
|
| 101 |
margin-bottom: 20px;
|
| 102 |
-
|
|
|
|
|
|
|
| 103 |
}
|
|
|
|
| 104 |
.instructions h3 {
|
| 105 |
color: #2c3e50;
|
| 106 |
margin-bottom: 15px;
|
| 107 |
}
|
|
|
|
| 108 |
.instructions ul {
|
| 109 |
color: #34495e;
|
| 110 |
}
|
|
@@ -167,10 +196,12 @@
|
|
| 167 |
</head>
|
| 168 |
<body>
|
| 169 |
<div class="container">
|
| 170 |
-
<
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
|
|
|
|
|
|
| 174 |
|
| 175 |
<div class="instructions">
|
| 176 |
<h3>π― How to Use This Interactive Map:</h3>
|
|
@@ -239,9 +270,9 @@
|
|
| 239 |
<h3>β° Generated</h3>
|
| 240 |
<p>{{ plot_info.generated_time }}</p>
|
| 241 |
</div>
|
| 242 |
-
</div>
|
| 243 |
|
| 244 |
-
<div class="info-grid">
|
| 245 |
<div class="info-item">
|
| 246 |
<h3>π Minimum Value</h3>
|
| 247 |
<p>{{ "%.3f"|format(plot_info.data_range.min) }}{% if plot_info.units %} {{ plot_info.units }}{% endif %}</p>
|
|
|
|
| 6 |
<title>Interactive Air Pollution Map - India CAMS Dashboard</title>
|
| 7 |
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
|
| 8 |
<style>
|
| 9 |
+
* {
|
| 10 |
+
margin: 0;
|
| 11 |
+
padding: 0;
|
| 12 |
+
box-sizing: border-box;
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
body {
|
| 16 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
| 17 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 18 |
+
min-height: 100vh;
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
.container {
|
| 22 |
max-width: 1400px;
|
| 23 |
margin: 0 auto;
|
| 24 |
padding: 20px;
|
|
|
|
| 25 |
}
|
| 26 |
+
|
| 27 |
+
.header {
|
| 28 |
+
background: rgba(255, 255, 255, 0.95);
|
| 29 |
+
border-radius: 15px;
|
| 30 |
+
padding: 20px;
|
| 31 |
+
margin-bottom: 20px;
|
| 32 |
+
box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
|
| 33 |
+
backdrop-filter: blur(4px);
|
| 34 |
+
border: 1px solid rgba(255, 255, 255, 0.18);
|
| 35 |
}
|
| 36 |
+
|
| 37 |
+
.header h1 {
|
| 38 |
+
color: #2c3e50;
|
| 39 |
+
margin-bottom: 10px;
|
| 40 |
+
text-align: center;
|
| 41 |
}
|
| 42 |
+
|
| 43 |
.plot-container {
|
| 44 |
+
background: rgba(255, 255, 255, 0.95);
|
| 45 |
+
border-radius: 15px;
|
| 46 |
padding: 20px;
|
| 47 |
margin-bottom: 20px;
|
| 48 |
+
box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
|
| 49 |
+
backdrop-filter: blur(4px);
|
| 50 |
+
border: 1px solid rgba(255, 255, 255, 0.18);
|
| 51 |
}
|
| 52 |
+
|
| 53 |
.plot-info {
|
| 54 |
+
background: rgba(255, 255, 255, 0.95);
|
| 55 |
+
border-radius: 15px;
|
| 56 |
padding: 20px;
|
| 57 |
+
box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
|
| 58 |
+
backdrop-filter: blur(4px);
|
| 59 |
+
border: 1px solid rgba(255, 255, 255, 0.18);
|
| 60 |
}
|
| 61 |
+
|
| 62 |
.info-grid {
|
| 63 |
display: grid;
|
| 64 |
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
| 65 |
gap: 15px;
|
| 66 |
margin-bottom: 20px;
|
| 67 |
}
|
| 68 |
+
|
| 69 |
.info-item {
|
| 70 |
+
background: rgba(52, 73, 94, 0.1);
|
| 71 |
padding: 15px;
|
| 72 |
+
border-radius: 10px;
|
| 73 |
border-left: 4px solid #3498db;
|
| 74 |
}
|
| 75 |
+
|
| 76 |
.info-item h3 {
|
| 77 |
color: #2c3e50;
|
| 78 |
margin-bottom: 5px;
|
| 79 |
font-size: 14px;
|
| 80 |
font-weight: 600;
|
| 81 |
}
|
| 82 |
+
|
| 83 |
.info-item p {
|
| 84 |
color: #34495e;
|
| 85 |
font-size: 16px;
|
| 86 |
font-weight: 500;
|
| 87 |
}
|
| 88 |
+
|
| 89 |
.controls {
|
| 90 |
display: flex;
|
| 91 |
gap: 15px;
|
| 92 |
flex-wrap: wrap;
|
| 93 |
margin-bottom: 20px;
|
| 94 |
}
|
| 95 |
+
|
| 96 |
.btn {
|
| 97 |
+
background: linear-gradient(45deg, #3498db, #2980b9);
|
| 98 |
color: white;
|
| 99 |
padding: 12px 24px;
|
| 100 |
border: none;
|
| 101 |
+
border-radius: 25px;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
text-decoration: none;
|
| 103 |
+
font-weight: 600;
|
| 104 |
+
transition: all 0.3s ease;
|
| 105 |
+
cursor: pointer;
|
| 106 |
+
font-size: 14px;
|
| 107 |
}
|
| 108 |
+
|
| 109 |
+
.btn:hover {
|
| 110 |
+
transform: translateY(-2px);
|
| 111 |
+
box-shadow: 0 8px 25px rgba(52, 152, 219, 0.4);
|
| 112 |
}
|
| 113 |
+
|
| 114 |
.btn-download {
|
| 115 |
+
background: linear-gradient(45deg, #27ae60, #219a52);
|
|
|
|
|
|
|
|
|
|
| 116 |
}
|
| 117 |
+
|
| 118 |
.btn-back {
|
| 119 |
+
background: linear-gradient(45deg, #95a5a6, #7f8c8d);
|
|
|
|
|
|
|
|
|
|
| 120 |
}
|
| 121 |
+
|
| 122 |
.instructions {
|
| 123 |
+
background: rgba(255, 255, 255, 0.95);
|
| 124 |
+
border-radius: 15px;
|
| 125 |
padding: 20px;
|
|
|
|
| 126 |
margin-bottom: 20px;
|
| 127 |
+
box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
|
| 128 |
+
backdrop-filter: blur(4px);
|
| 129 |
+
border: 1px solid rgba(255, 255, 255, 0.18);
|
| 130 |
}
|
| 131 |
+
|
| 132 |
.instructions h3 {
|
| 133 |
color: #2c3e50;
|
| 134 |
margin-bottom: 15px;
|
| 135 |
}
|
| 136 |
+
|
| 137 |
.instructions ul {
|
| 138 |
color: #34495e;
|
| 139 |
}
|
|
|
|
| 196 |
</head>
|
| 197 |
<body>
|
| 198 |
<div class="container">
|
| 199 |
+
<div class="header">
|
| 200 |
+
<h1>π Interactive Air Pollution Map</h1>
|
| 201 |
+
<p style="text-align: center; color: #7f8c8d; margin-top: 10px;">
|
| 202 |
+
Hover over the map to see exact coordinates and pollution values. Use the toolbar to zoom, pan, and download.
|
| 203 |
+
</p>
|
| 204 |
+
</div>
|
| 205 |
|
| 206 |
<div class="instructions">
|
| 207 |
<h3>π― How to Use This Interactive Map:</h3>
|
|
|
|
| 270 |
<h3>β° Generated</h3>
|
| 271 |
<p>{{ plot_info.generated_time }}</p>
|
| 272 |
</div>
|
| 273 |
+
<!-- </div>
|
| 274 |
|
| 275 |
+
<div class="info-grid"> -->
|
| 276 |
<div class="info-item">
|
| 277 |
<h3>π Minimum Value</h3>
|
| 278 |
<p>{{ "%.3f"|format(plot_info.data_range.min) }}{% if plot_info.units %} {{ plot_info.units }}{% endif %}</p>
|