Skip to content

Instantly share code, notes, and snippets.

View acoiman's full-sized avatar
🎯
Focusing

Abraham Coiman acoiman

🎯
Focusing
View GitHub Profile
@acoiman
acoiman / haversine_distance.py
Created July 5, 2020 16:38
Haversine distance formula
import math
x_dist = math.radians(lon2-lon)
y_dist = math.radians(lat2-lat)
y1_rad = math.radians(lat)
y2_rad = math.radians(lat2)
a = math.sin(y_dist/2)**2 + math.sin(x_dist/2)**2 \
* math.cos(y1_rad) * math.cos(y2_rad)
c = 2*math.asin(math.sqrt(a))
distance = c * 6371 # kilometers
print()
Data Source Link
Yosemite National Park polygon WDPA: World Database on Protected Areas (polygons) https://developers.google.com/earth-engine/datasets/catalog/WCMC_WDPA_current_polygons
100-hour dead fuel moisture GRIDMET: University of Idaho Gridded Surface Meteorological Dataset https://developers.google.com/earth-engine/datasets/catalog/IDAHO_EPSCOR_GRIDMET
Wind direction GRIDMET: University of Idaho Gridded Surface Meteorological Dataset https://developers.google.com/earth-engine/datasets/catalog/IDAHO_EPSCOR_GRIDMET
Wind velocity GRIDMET: University of Idaho Gridded Surface Meteor