Handle GEE NTL date windows, first-night selection, AOI boundary constraints, and robust reduction settings for event impact analysis.
Prevent common failure modes in GEE nighttime light analysis:
filterDate end-date exclusivity.scale/maxPixels/tileScale.Use this skill when task includes any of:
VNP46A2 / VIIRS daily analysis.pre-event, first-night, post-event).reduceRegion/reduceRegions).filterDate(start, end) is end-exclusive.end = start + 1 day.first_night = D+1.scale and maxPixels in reductions.bestEffort=True or tileScale>1.from datetime import datetime, timedelta
def to_exclusive_end(date_str: str) -> str:
return (datetime.strptime(date_str, "%Y-%m-%d") + timedelta(days=1)).strftime("%Y-%m-%d")
# Example: single day 2025-03-29
# filterDate("2025-03-29", to_exclusive_end("2025-03-29"))
from datetime import datetime, timedelta