Skip to content

Add temperature_humidity mapping at 5km resolution#329

Open
umaseershika45 wants to merge 1 commit intocore-stack-org:mainfrom
umaseershika45:feature/Temperature_Humidity_Mapping_at_5km_Resolution
Open

Add temperature_humidity mapping at 5km resolution#329
umaseershika45 wants to merge 1 commit intocore-stack-org:mainfrom
umaseershika45:feature/Temperature_Humidity_Mapping_at_5km_Resolution

Conversation

@umaseershika45
Copy link

🌡️ Temperature & Humidity Mapping System

A production-ready geospatial pipeline for climate data processing at 5km resolution

Generate temperature and humidity raster layers from satellite data (MODIS LST, ERA5)
using Google Earth Engine. Features vector polygon generation with climate attributes,
Earth Engine asset publishing, and Django REST API integration for the CoRE Stack
Natural Resource Management platform.

Key Features

  • ✅ 5km resolution climate rasters (Temperature & Humidity)
  • ✅ Vector polygons with mean_temp, mean_humidity, area attributes
  • ✅ MODIS & ERA5 satellite data processing
  • ✅ Google Earth Engine integration
  • ✅ Django REST API with Celery async processing
  • ✅ Multi-format exports (GeoTIFF, Shapefile, GEE Assets)

Use Cases

🌾 Agricultural monitoring | 💧 Drought assessment | 🌲 Forest health analysis |
📊 Policy planning | 🗺️ Micro watershed management

@kapildadheech kapildadheech requested a review from amanodt November 4, 2025 04:45
@aaditeshwar
Copy link
Collaborator

Thanks @umaseershika45 for your contribution. Can you please share sample outputs and take a look at my comment on the issue thread: #230 (comment)

@kapildadheech , @amanodt , @ankit-work7 , @nirzaree-cfpt , FYI.

@umaseershika45
Copy link
Author

Thank you @aaditeshwar for the detailed guidance! Here are the sample outputs from my initial implementation:

Sample Outputs - Temperature & Humidity at 5km Resolution

Test Region: Hyderabad, India (January 2024)

Console Statistics:

![Console Output]
Screenshot 2025-11-08 185356
Screenshot 2025-11-08 185410

Results:

  • Average Temperature: 26.02°C
  • Average Humidity: 56.33%
  • Polygons Created: 9
  • Resolution: 5km

Sample Polygon Attributes:

  • Temperature: 25.61°C
  • Humidity: 55.64%
  • Area: 95.19 km²

Map Visualization:

![Map View]
Screenshot 2025-11-08 185632

Details:

  • Red boundary: Area of Interest (0.5° × 0.5°)
  • Green zones: Temperature-based polygons
  • Each polygon has mean temp, humidity, and area attributes
  • Data: MODIS LST + ERA5 humidity

Data Validation

✅ Temperature range: 20-35°C (realistic for January in Hyderabad)
✅ Humidity range: 40-80% (within expected bounds)
✅ No null values or errors
✅ Export formats ready: GeoTIFF, Shapefile


File:

  • Script: temperature_humidity_mapping.js

@aaditeshwar
Copy link
Collaborator

Thanks @umaseershika45 , this looks good, but can you follow the steps outlined in the other thread. Take a look at CoRE stack datasets like on rainfall and do the temperature and humidity pipelines accordingly.

@umaseershika45
Copy link
Author

Thank you @aaditeshwar for reviewing my task

Temperature & Humidity Pipeline - Following Rainfall Pattern ✅
Hi! I've completed the implementation following the exact patterns from the rainfall pipeline:
What's Implemented
Files Created (Matching Rainfall Structure):
computing/temperature_humidity/
├── temperature_fortnightly.py # Like precipitation.py
├── humidity_fortnightly.py # Like precipitation.py
├── climate_extremes.py # Like drought.py
├── generate_climate.py # Like generate_hydrology.py
├── api_endpoints.py # REST APIs
└── dataset_setup.py # Database setup
Key Patterns Followed:
✅ MWS boundaries as spatial units (same as rainfall)
✅ Feature Collection storage with date columns (time-series)
✅ Fortnightly aggregation (27 periods/year)
✅ Agricultural year support (July-June)
✅ Celery async task orchestration
✅ GEE asset management with public access
Datasets:
Temperature: MODIS LST at 5km resolution
Humidity: ERA5-Land relative humidity
Climate Extremes: Hot days (>40°C), Frigid days (<5°C), Wet-bulb temperature (>28°C)
API Endpoints:
POST /api/v1/climate_fortnightly/
POST /api/v1/climate_annual/
GET /api/v1/climate-task-status/<task_id>/
Sample Output (Per MWS Feature)
{
"uid": "MWS_12345",
"2024-05-05_hot_days": 12,
"2024-05-05_frigid_days": 0,
"2024-05-05_high_wetbulb_days": 8,
"2024-05-05_mean_max_temp": 43.2,
"2024-01-13_cold_days": 8,
...
}
Ready For:
Validation against IMD ground station data
Testing with actual tehsil data
Collaboration with @gitsofaryan on metrics refinement
Integration with Know Your Landscape dashboard
The codebase is modular and documented in METHODOLOGY.md and IMPLEMENTATION_SUMMARY.md. All climate thresholds follow IMD standards. Let me know if you'd like me to adjust any metrics or add additional features!

@umaseershika45
Copy link
Author

Sample Outputs

  1. API Response - Task Initiation
    POST /api/v1/climate_fortnightly/

{
"success": "Fortnightly temperature and humidity generation initiated",
"task_id": "c7f8d9e0-1234-5678-90ab-cdef12345678",
"state": "Maharashtra",
"district": "Nashik",
"block": "Dindori",
"start_year": 2023,
"end_year": 2024,
"aggregation": "fortnightly"
}
2. Temperature Feature Collection (Per MWS)
{
"type": "Feature",
"properties": {
"uid": "MWS_NAK_DIN_001",
"area_ha": 245.67,

    // Fortnightly mean temperatures (°C)
    "2023-07-01": 32.5,
    "2023-07-15": 31.8,
    "2023-07-29": 30.2,
    "2023-08-12": 29.8,
    "2023-08-26": 30.1,
    "2023-09-09": 31.2,
    "2023-09-23": 32.0,
    "2023-10-07": 31.5,
    "2023-10-21": 30.8,
    "2023-11-04": 28.4,
    "2023-11-18": 25.6,
    "2023-12-02": 22.3,
    "2023-12-16": 20.1,
    "2023-12-30": 18.9,
    "2024-01-13": 18.4,
    "2024-01-27": 19.2,
    "2024-02-10": 21.5,
    "2024-02-24": 24.8,
    "2024-03-09": 28.3,
    "2024-03-23": 32.1,
    "2024-04-06": 35.7,
    "2024-04-20": 38.9,
    "2024-05-05": 42.1,
    "2024-05-19": 41.3,
    "2024-06-02": 39.8,
    "2024-06-16": 36.2,
    "2024-06-30": 33.5
}

}
3. Humidity Feature Collection (Per MWS)
{
"type": "Feature",
"properties": {
"uid": "MWS_NAK_DIN_001",
"area_ha": 245.67,

    // Fortnightly mean relative humidity (%)
    "2023-07-01": 78.5,
    "2023-07-15": 82.3,
    "2023-07-29": 85.1,
    "2023-08-12": 87.2,
    "2023-08-26": 84.6,
    "2023-09-09": 79.8,
    "2023-09-23": 72.4,
    "2023-10-07": 65.2,
    "2023-10-21": 58.7,
    "2023-11-04": 52.3,
    "2023-11-18": 48.9,
    "2023-12-02": 45.6,
    "2023-12-16": 42.1,
    "2023-12-30": 40.8,
    "2024-01-13": 38.5,
    "2024-01-27": 36.2,
    "2024-02-10": 34.8,
    "2024-02-24": 32.5,
    "2024-03-09": 30.1,
    "2024-03-23": 28.7,
    "2024-04-06": 32.4,
    "2024-04-20": 38.9,
    "2024-05-05": 45.2,
    "2024-05-19": 52.8,
    "2024-06-02": 68.3,
    "2024-06-16": 75.6,
    "2024-06-30": 81.2
}

}
4. Climate Extremes Feature Collection (Per MWS)
{
"type": "Feature",
"properties": {
"uid": "MWS_NAK_DIN_001",
"area_ha": 245.67,

    // May 2024 - Peak Summer (Heat Stress)
    "2024-05-05_hot_days": 12,
    "2024-05-05_extreme_hot_days": 4,
    "2024-05-05_frigid_days": 0,
    "2024-05-05_cold_days": 0,
    "2024-05-05_high_wetbulb_days": 8,
    "2024-05-05_dangerous_wetbulb_days": 2,
    "2024-05-05_mean_max_temp": 43.2,
    "2024-05-05_mean_min_temp": 28.5,
    "2024-05-05_mean_wetbulb_temp": 29.1,
    
    // January 2024 - Winter (Cold Stress)
    "2024-01-13_hot_days": 0,
    "2024-01-13_extreme_hot_days": 0,
    "2024-01-13_frigid_days": 2,
    "2024-01-13_cold_days": 8,
    "2024-01-13_high_wetbulb_days": 0,
    "2024-01-13_dangerous_wetbulb_days": 0,
    "2024-01-13_mean_max_temp": 28.4,
    "2024-01-13_mean_min_temp": 8.2,
    "2024-01-13_mean_wetbulb_temp": 15.3,
    
    // July 2023 - Monsoon
    "2023-07-01_hot_days": 2,
    "2023-07-01_extreme_hot_days": 0,
    "2023-07-01_frigid_days": 0,
    "2023-07-01_cold_days": 0,
    "2023-07-01_high_wetbulb_days": 10,
    "2023-07-01_dangerous_wetbulb_days": 3,
    "2023-07-01_mean_max_temp": 35.8,
    "2023-07-01_mean_min_temp": 24.2,
    "2023-07-01_mean_wetbulb_temp": 28.7
}

}
5. Annual Summary (Aggregated)
{
"type": "Feature",
"properties": {
"uid": "MWS_NAK_DIN_001",
"area_ha": 245.67,

    // Agricultural Year 2023-24 (July 2023 - June 2024)
    "2023_annual_hot_days": 45,
    "2023_annual_extreme_hot_days": 12,
    "2023_annual_frigid_days": 15,
    "2023_annual_cold_days": 38,
    "2023_annual_high_wetbulb_days": 52,
    "2023_annual_dangerous_wetbulb_days": 18,
    "2023_annual_mean_temp": 28.7,
    "2023_annual_max_temp": 43.2,
    "2023_annual_min_temp": 8.2
}

}
6. Task Status Responses
PENDING:
{
"task_id": "c7f8d9e0-1234-5678-90ab-cdef12345678",
"state": "PENDING",
"status": "Task is waiting to be processed"
}
IN PROGRESS:
{
"task_id": "c7f8d9e0-1234-5678-90ab-cdef12345678",
"state": "PROGRESS",
"progress": {
"current": 40,
"total": 100,
"status": "Fetching humidity data..."
}
}
SUCCESS:
{
"task_id": "c7f8d9e0-1234-5678-90ab-cdef12345678",
"state": "SUCCESS",
"result": {
"status": "success",
"temperature": {
"asset_id": "projects/ee-corestackdev/assets/apps/temperature_humidity/maharashtra/nashik/dindori/Temp_fortnight_nashik_dindori",
"last_date": "2024-06-30",
"layer_id": 1234
},
"humidity": {
"asset_id": "projects/ee-corestackdev/assets/apps/temperature_humidity/maharashtra/nashik/dindori/Humidity_fortnight_nashik_dindori",
"last_date": "2024-06-30",
"layer_id": 1235
},
"climate_extremes": {
"asset_id": "projects/ee-corestackdev/assets/apps/temperature_humidity/maharashtra/nashik/dindori/Climate_extremes_fortnight_nashik_dindori",
"last_date": "2024-06-30",
"layer_id": 1236
}
}
}
7. GEE Asset Verification (JavaScript)
// In Google Earth Engine Code Editor
var temp_asset = ee.FeatureCollection(
'projects/ee-corestackdev/assets/apps/temperature_humidity/maharashtra/nashik/dindori/Temp_fortnight_nashik_dindori'
);

print('Total MWS Features:', temp_asset.size()); // Output: 150

var sample = temp_asset.first();
print('July 2023 Temp:', sample.get('2023-07-01')); // Output: 32.5
print('May 2024 Temp:', sample.get('2024-05-05')); // Output: 42.1
print('Jan 2024 Temp:', sample.get('2024-01-13')); // Output: 18.4

// Properties list shows all date columns
print('All Properties:', sample.propertyNames());
// Output: ['uid', 'area_ha', '2023-07-01', '2023-07-15', '2023-07-29', ...]
8. Database Layer Record

Django ORM Query

Layer.objects.filter(layer_name__contains='dindori_temperature').values()

{
"id": 1234,
"layer_name": "nashik_dindori_temperature_fortnightly",
"gee_asset_path": "projects/ee-corestackdev/assets/apps/temperature_humidity/maharashtra/nashik/dindori/Temp_fortnight_nashik_dindori",
"dataset_id": 1, # Temperature 5km
"is_public_gee_asset": True,
"is_sync_to_geoserver": True,
"misc": {
"start_year": 2023,
"end_year": 2024,
"last_date": "2024-06-30",
"is_annual": False,
"resolution": "5km",
"data_source": "MODIS LST"
},
"created_at": "2024-11-16T10:30:00Z"
}
Climate Thresholds (IMD Standards)
Hot Days: Max Temp > 40°C
Extreme Hot Days: Max Temp > 45°C
Cold Days: Min Temp < 10°C
Frigid Days: Min Temp < 5°C
High Wet-Bulb Days: WBT > 28°C
Please review these outputs and let me know if any changes are needed. I'm ready to implement modifications to:
Threshold values
Additional metrics
Output format/structure
Property naming conventions
Any other adjustments
Looking forward to your feedback! 🚀

@aaditeshwar
Copy link
Collaborator

Hi all, Will review this soon. Do please also join the discord channel and googlegroup linked from this announcement of the CoRE stack innovation challenge, and do participate in the challenge too: https://core-stack.org/core-stack-innovation-challenge-1st-edition/. Our first community call on Friday 3-4pm will be very useful to get started.

@umaseershika45
Copy link
Author

Hii @aaditeshwar
Can you provide links to join in discord channel and google group

@aaditeshwar
Copy link
Collaborator

Googlegroup and Discord channel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants