Skip to content

Instantly share code, notes, and snippets.

@phargogh
Created November 7, 2025 19:54
Show Gist options
  • Select an option

  • Save phargogh/c14404abac7d3e178a022349913073bb to your computer and use it in GitHub Desktop.

Select an option

Save phargogh/c14404abac7d3e178a022349913073bb to your computer and use it in GitHub Desktop.
Skeleton for a raster_map equation
"""Calculate work intensity with the Hothaps function.
Written by request of @empavia to try out as a new work function for the InVEST Urban Cooling Model.
To install dependencies, `mamba install pygeoprocessing`.
"""
import pygeoprocessing
def calculate_work_intensity(target_raster, wbgt_raster, alpha1, alpha2):
"""Calculate work intensity with the Hothaps function.
Args:
target_raster (str): The path to the new work intensity raster being created.
wbgt_raster (str): The path to an already-calulated Wet Bulb Globe Temp raster.
alpha1 (float): The alpha1 parameter.
alpha2 (float): The alpha2 paramter.
Returns:
``None``.
"""
def _calculate_workability(wbgt):
return 0.1 + (0.9/(1+((wbgt/alpha1)**alpha2)))
pygeoprocessing.raster_map(_calculate_workability, [wbgt_raster], target_raster)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment