# NetCDF variables and their properties (includes air pollution, meteorological, and other variables) NETCDF_VARIABLES = { # === AIR POLLUTION VARIABLES === # PM2.5 'pm2p5': {'units': 'µg/m³', 'name': 'PM2.5', 'cmap': 'YlOrRd', 'vmax_percentile': 95, 'type': 'surface'}, 'pm25': {'units': 'µg/m³', 'name': 'PM2.5', 'cmap': 'YlOrRd', 'vmax_percentile': 95, 'type': 'surface'}, 'PM2P5': {'units': 'µg/m³', 'name': 'PM2.5', 'cmap': 'YlOrRd', 'vmax_percentile': 95, 'type': 'surface'}, 'PM25': {'units': 'µg/m³', 'name': 'PM2.5', 'cmap': 'YlOrRd', 'vmax_percentile': 95, 'type': 'surface'}, 'pm2_5': {'units': 'µg/m³', 'name': 'PM2.5', 'cmap': 'YlOrRd', 'vmax_percentile': 95, 'type': 'surface'}, 'PM2_5': {'units': 'µg/m³', 'name': 'PM2.5', 'cmap': 'YlOrRd', 'vmax_percentile': 95, 'type': 'surface'}, 'particulate_matter_2_5': {'units': 'µg/m³', 'name': 'PM2.5', 'cmap': 'YlOrRd', 'vmax_percentile': 95, 'type': 'surface'}, 'particulate_matter_2.5um': {'units': 'µg/m³', 'name': 'PM2.5', 'cmap': 'YlOrRd', 'vmax_percentile': 95, 'type': 'surface'}, 'mass_concentration_of_pm2p5_ambient_aerosol_particles_in_air': {'units': 'µg/m³', 'name': 'PM2.5', 'cmap': 'YlOrRd', 'vmax_percentile': 95, 'type': 'surface'}, # PM10 'pm10': {'units': 'µg/m³', 'name': 'PM10', 'cmap': 'Oranges', 'vmax_percentile': 95, 'type': 'surface'}, 'PM10': {'units': 'µg/m³', 'name': 'PM10', 'cmap': 'Oranges', 'vmax_percentile': 95, 'type': 'surface'}, 'pm10p0': {'units': 'µg/m³', 'name': 'PM10', 'cmap': 'Oranges', 'vmax_percentile': 95, 'type': 'surface'}, 'particulate_matter_10': {'units': 'µg/m³', 'name': 'PM10', 'cmap': 'Oranges', 'vmax_percentile': 95, 'type': 'surface'}, 'particulate_matter_10um': {'units': 'µg/m³', 'name': 'PM10', 'cmap': 'Oranges', 'vmax_percentile': 95, 'type': 'surface'}, 'mass_concentration_of_pm10_ambient_aerosol_particles_in_air': {'units': 'µg/m³', 'name': 'PM10', 'cmap': 'Oranges', 'vmax_percentile': 95, 'type': 'surface'}, # PM1 'pm1': {'units': 'µg/m³', 'name': 'PM1', 'cmap': 'Reds', 'vmax_percentile': 95, 'type': 'surface'}, 'PM1': {'units': 'µg/m³', 'name': 'PM1', 'cmap': 'Reds', 'vmax_percentile': 95, 'type': 'surface'}, 'particulate_matter_1um': {'units': 'µg/m³', 'name': 'PM1', 'cmap': 'Reds', 'vmax_percentile': 95, 'type': 'surface'}, # NO2 'no2': {'units': 'µg/m³', 'name': 'NO₂', 'cmap': 'Reds', 'vmax_percentile': 90, 'type': 'atmospheric'}, 'NO2': {'units': 'µg/m³', 'name': 'NO₂', 'cmap': 'Reds', 'vmax_percentile': 90, 'type': 'atmospheric'}, 'nitrogen_dioxide': {'units': 'µg/m³', 'name': 'NO₂', 'cmap': 'Reds', 'vmax_percentile': 90, 'type': 'atmospheric'}, 'mass_concentration_of_nitrogen_dioxide_in_air': {'units': 'µg/m³', 'name': 'NO₂', 'cmap': 'Reds', 'vmax_percentile': 90, 'type': 'atmospheric'}, # SO2 'so2': {'units': 'µg/m³', 'name': 'SO₂', 'cmap': 'Purples', 'vmax_percentile': 90, 'type': 'atmospheric'}, 'SO2': {'units': 'µg/m³', 'name': 'SO₂', 'cmap': 'Purples', 'vmax_percentile': 90, 'type': 'atmospheric'}, 'sulphur_dioxide': {'units': 'µg/m³', 'name': 'SO₂', 'cmap': 'Purples', 'vmax_percentile': 90, 'type': 'atmospheric'}, 'sulfur_dioxide': {'units': 'µg/m³', 'name': 'SO₂', 'cmap': 'Purples', 'vmax_percentile': 90, 'type': 'atmospheric'}, 'mass_concentration_of_sulfur_dioxide_in_air': {'units': 'µg/m³', 'name': 'SO₂', 'cmap': 'Purples', 'vmax_percentile': 90, 'type': 'atmospheric'}, # O3 'o3': {'units': 'µg/m³', 'name': 'O₃', 'cmap': 'Blues', 'vmax_percentile': 90, 'type': 'atmospheric'}, 'O3': {'units': 'µg/m³', 'name': 'O₃', 'cmap': 'Blues', 'vmax_percentile': 90, 'type': 'atmospheric'}, 'ozone': {'units': 'µg/m³', 'name': 'O₃', 'cmap': 'Blues', 'vmax_percentile': 90, 'type': 'atmospheric'}, 'mass_concentration_of_ozone_in_air': {'units': 'µg/m³', 'name': 'O₃', 'cmap': 'Blues', 'vmax_percentile': 90, 'type': 'atmospheric'}, # CO 'co': {'units': 'mg/m³', 'name': 'CO', 'cmap': 'Greens', 'vmax_percentile': 90, 'type': 'atmospheric'}, 'CO': {'units': 'mg/m³', 'name': 'CO', 'cmap': 'Greens', 'vmax_percentile': 90, 'type': 'atmospheric'}, 'carbon_monoxide': {'units': 'mg/m³', 'name': 'CO', 'cmap': 'Greens', 'vmax_percentile': 90, 'type': 'atmospheric'}, 'mass_concentration_of_carbon_monoxide_in_air': {'units': 'mg/m³', 'name': 'CO', 'cmap': 'Greens', 'vmax_percentile': 90, 'type': 'atmospheric'}, # NO (Nitrogen Monoxide) 'no': {'units': 'µg/m³', 'name': 'NO', 'cmap': 'Oranges', 'vmax_percentile': 90, 'type': 'atmospheric'}, 'NO': {'units': 'µg/m³', 'name': 'NO', 'cmap': 'Oranges', 'vmax_percentile': 90, 'type': 'atmospheric'}, 'nitrogen_monoxide': {'units': 'µg/m³', 'name': 'NO', 'cmap': 'Oranges', 'vmax_percentile': 90, 'type': 'atmospheric'}, # NH3 'nh3': {'units': 'µg/m³', 'name': 'NH₃', 'cmap': 'viridis', 'vmax_percentile': 90, 'type': 'atmospheric'}, 'NH3': {'units': 'µg/m³', 'name': 'NH₃', 'cmap': 'viridis', 'vmax_percentile': 90, 'type': 'atmospheric'}, 'ammonia': {'units': 'µg/m³', 'name': 'NH₃', 'cmap': 'viridis', 'vmax_percentile': 90, 'type': 'atmospheric'}, 'mass_concentration_of_ammonia_in_air': {'units': 'µg/m³', 'name': 'NH₃', 'cmap': 'viridis', 'vmax_percentile': 90, 'type': 'atmospheric'}, # Total Column variables (these are surface-level total column measurements) 'total_column_carbon_monoxide': {'units': 'mol/m²', 'name': 'Total Column CO', 'cmap': 'Greens', 'vmax_percentile': 90, 'type': 'surface'}, 'total_column_nitrogen_monoxide': {'units': 'mol/m²', 'name': 'Total Column NO', 'cmap': 'Oranges', 'vmax_percentile': 90, 'type': 'surface'}, 'total_column_nitrogen_dioxide': {'units': 'mol/m²', 'name': 'Total Column NO₂', 'cmap': 'Reds', 'vmax_percentile': 90, 'type': 'surface'}, 'total_column_ozone': {'units': 'mol/m²', 'name': 'Total Column O₃', 'cmap': 'Blues', 'vmax_percentile': 90, 'type': 'surface'}, 'total_column_sulphur_dioxide': {'units': 'mol/m²', 'name': 'Total Column SO₂', 'cmap': 'Purples', 'vmax_percentile': 90, 'type': 'surface'}, # Legacy total column names 'tcno2': {'units': 'mol/m²', 'name': 'Total Column NO₂', 'cmap': 'Reds', 'vmax_percentile': 90, 'type': 'surface'}, 'tcso2': {'units': 'mol/m²', 'name': 'Total Column SO₂', 'cmap': 'Purples', 'vmax_percentile': 90, 'type': 'surface'}, 'tco3': {'units': 'mol/m²', 'name': 'Total Column O₃', 'cmap': 'Blues', 'vmax_percentile': 90, 'type': 'surface'}, 'tcco': {'units': 'mol/m²', 'name': 'Total Column CO', 'cmap': 'Greens', 'vmax_percentile': 90, 'type': 'surface'}, # AOD (Aerosol Optical Depth) - surface measurement 'aod550': {'units': '', 'name': 'AOD 550nm', 'cmap': 'plasma', 'vmax_percentile': 95, 'type': 'surface'}, 'aod': {'units': '', 'name': 'AOD', 'cmap': 'plasma', 'vmax_percentile': 95, 'type': 'surface'}, 'aerosol_optical_depth': {'units': '', 'name': 'AOD', 'cmap': 'plasma', 'vmax_percentile': 95, 'type': 'surface'}, # === METEOROLOGICAL VARIABLES === # Temperature variables '2t': {'units': 'K', 'name': '2m Temperature', 'cmap': 'RdYlBu', 'vmax_percentile': 95, 'type': 'surface'}, 't2m': {'units': 'K', 'name': '2m Temperature', 'cmap': 'RdYlBu', 'vmax_percentile': 95, 'type': 'surface'}, 'temperature': {'units': 'K', 'name': 'Temperature', 'cmap': 'RdYlBu', 'vmax_percentile': 95, 'type': 'atmospheric'}, 't': {'units': 'K', 'name': 'Temperature', 'cmap': 'RdYlBu', 'vmax_percentile': 95, 'type': 'atmospheric'}, 'air_temperature': {'units': 'K', 'name': 'Air Temperature', 'cmap': 'RdYlBu', 'vmax_percentile': 95, 'type': 'atmospheric'}, 'sst': {'units': 'K', 'name': 'Sea Surface Temperature', 'cmap': 'coolwarm', 'vmax_percentile': 95, 'type': 'surface'}, # Wind variables 'u': {'units': 'm/s', 'name': 'U-Wind Component', 'cmap': 'coolwarm', 'vmax_percentile': 95, 'type': 'atmospheric'}, 'v': {'units': 'm/s', 'name': 'V-Wind Component', 'cmap': 'coolwarm', 'vmax_percentile': 95, 'type': 'atmospheric'}, 'u10': {'units': 'm/s', 'name': '10m U-Wind', 'cmap': 'coolwarm', 'vmax_percentile': 95, 'type': 'surface'}, 'v10': {'units': 'm/s', 'name': '10m V-Wind', 'cmap': 'coolwarm', 'vmax_percentile': 95, 'type': 'surface'}, 'u_component_of_wind': {'units': 'm/s', 'name': 'U-Wind Component', 'cmap': 'coolwarm', 'vmax_percentile': 95, 'type': 'atmospheric'}, 'v_component_of_wind': {'units': 'm/s', 'name': 'V-Wind Component', 'cmap': 'coolwarm', 'vmax_percentile': 95, 'type': 'atmospheric'}, 'wind_speed': {'units': 'm/s', 'name': 'Wind Speed', 'cmap': 'viridis', 'vmax_percentile': 95, 'type': 'atmospheric'}, 'ws': {'units': 'm/s', 'name': 'Wind Speed', 'cmap': 'viridis', 'vmax_percentile': 95, 'type': 'atmospheric'}, # Pressure and geopotential 'msl': {'units': 'Pa', 'name': 'Mean Sea Level Pressure', 'cmap': 'RdYlBu', 'vmax_percentile': 95, 'type': 'surface'}, 'sp': {'units': 'Pa', 'name': 'Surface Pressure', 'cmap': 'RdYlBu', 'vmax_percentile': 95, 'type': 'surface'}, 'pressure': {'units': 'Pa', 'name': 'Pressure', 'cmap': 'RdYlBu', 'vmax_percentile': 95, 'type': 'atmospheric'}, 'z': {'units': 'm²/s²', 'name': 'Geopotential', 'cmap': 'Spectral', 'vmax_percentile': 95, 'type': 'atmospheric'}, 'gh': {'units': 'm', 'name': 'Geopotential Height', 'cmap': 'Spectral', 'vmax_percentile': 95, 'type': 'atmospheric'}, # Humidity variables 'r': {'units': '%', 'name': 'Relative Humidity', 'cmap': 'Blues', 'vmax_percentile': 95, 'type': 'atmospheric'}, 'rh': {'units': '%', 'name': 'Relative Humidity', 'cmap': 'Blues', 'vmax_percentile': 95, 'type': 'atmospheric'}, 'q': {'units': 'kg/kg', 'name': 'Specific Humidity', 'cmap': 'Blues', 'vmax_percentile': 95, 'type': 'atmospheric'}, 'sh': {'units': 'kg/kg', 'name': 'Specific Humidity', 'cmap': 'Blues', 'vmax_percentile': 95, 'type': 'atmospheric'}, 'd2m': {'units': 'K', 'name': '2m Dewpoint Temperature', 'cmap': 'Blues', 'vmax_percentile': 95, 'type': 'surface'}, # Precipitation and cloud variables 'tp': {'units': 'm', 'name': 'Total Precipitation', 'cmap': 'Blues', 'vmax_percentile': 98, 'type': 'surface'}, 'precipitation': {'units': 'm', 'name': 'Precipitation', 'cmap': 'Blues', 'vmax_percentile': 98, 'type': 'surface'}, 'tcc': {'units': '%', 'name': 'Total Cloud Cover', 'cmap': 'Blues', 'vmax_percentile': 95, 'type': 'surface'}, 'lcc': {'units': '%', 'name': 'Low Cloud Cover', 'cmap': 'Blues', 'vmax_percentile': 95, 'type': 'surface'}, 'mcc': {'units': '%', 'name': 'Medium Cloud Cover', 'cmap': 'Blues', 'vmax_percentile': 95, 'type': 'surface'}, 'hcc': {'units': '%', 'name': 'High Cloud Cover', 'cmap': 'Blues', 'vmax_percentile': 95, 'type': 'surface'}, # Radiation variables 'ssrd': {'units': 'J/m²', 'name': 'Surface Solar Radiation', 'cmap': 'YlOrRd', 'vmax_percentile': 95, 'type': 'surface'}, 'strd': {'units': 'J/m²', 'name': 'Surface Thermal Radiation', 'cmap': 'inferno', 'vmax_percentile': 95, 'type': 'surface'}, 'tsr': {'units': 'J/m²', 'name': 'Top Solar Radiation', 'cmap': 'YlOrRd', 'vmax_percentile': 95, 'type': 'surface'}, 'ttr': {'units': 'J/m²', 'name': 'Top Thermal Radiation', 'cmap': 'inferno', 'vmax_percentile': 95, 'type': 'surface'}, # Vertical motion 'w': {'units': 'Pa/s', 'name': 'Vertical Velocity (Pressure)', 'cmap': 'coolwarm', 'vmax_percentile': 95, 'type': 'atmospheric'}, 'omega': {'units': 'Pa/s', 'name': 'Vertical Velocity (Omega)', 'cmap': 'coolwarm', 'vmax_percentile': 95, 'type': 'atmospheric'}, # Surface variables 'skt': {'units': 'K', 'name': 'Skin Temperature', 'cmap': 'RdYlBu', 'vmax_percentile': 95, 'type': 'surface'}, 'swvl1': {'units': 'm³/m³', 'name': 'Soil Water Level 1', 'cmap': 'Blues', 'vmax_percentile': 95, 'type': 'surface'}, 'stl1': {'units': 'K', 'name': 'Soil Temperature Level 1', 'cmap': 'RdYlBu', 'vmax_percentile': 95, 'type': 'surface'}, 'lsm': {'units': '0-1', 'name': 'Land-Sea Mask', 'cmap': 'viridis', 'vmax_percentile': 100, 'type': 'surface'}, # === OTHER COMMON NETCDF VARIABLES === # Generic/Unknown variables (fallback) 'var': {'units': 'unknown', 'name': 'Variable', 'cmap': 'viridis', 'vmax_percentile': 95, 'type': 'unknown'}, 'data': {'units': 'unknown', 'name': 'Data', 'cmap': 'viridis', 'vmax_percentile': 95, 'type': 'unknown'}, 'field': {'units': 'unknown', 'name': 'Field', 'cmap': 'viridis', 'vmax_percentile': 95, 'type': 'unknown'}, } # Maintain backward compatibility AIR_POLLUTION_VARIABLES = {k: v for k, v in NETCDF_VARIABLES.items() if 'pollution' in k.lower() or any(pollutant in k.lower() for pollutant in ['pm', 'no', 'so', 'o3', 'co', 'nh3', 'aod', 'column'])} # Available color themes for plotting COLOR_THEMES = { 'YlOrRd': 'Yellow-Orange-Red', 'Oranges': 'Oranges', 'Reds': 'Reds', 'Purples': 'Purples', 'Blues': 'Blues', 'Greens': 'Greens', 'viridis': 'Viridis', 'plasma': 'Plasma', 'inferno': 'Inferno', 'magma': 'Magma', 'cividis': 'Cividis', 'coolwarm': 'Cool-Warm', 'RdYlBu': 'Red-Yellow-Blue', 'Spectral': 'Spectral' } # India map boundaries INDIA_BOUNDS = { 'lat_min': 6.0, 'lat_max': 38.0, 'lon_min': 68.0, 'lon_max': 98.0 } # Common pressure levels for atmospheric variables (in hPa) PRESSURE_LEVELS = [50, 100, 150, 200, 250, 300, 400, 500, 600, 700, 850, 925, 1000] # File upload settings ALLOWED_EXTENSIONS = {'nc', 'zip'} MAX_FILE_SIZE = 500 * 1024 * 1024 # 500MB