src.j_output¶
This directory contains the function to postprocess the SOLWEIG_SOLFD output to data and maps usable for design.
src.j_output.user_output¶
- class src.j_output.user_output.TmrtOutput(output_folder, building_mask=None, water_mask=None)[source]¶
Bases:
objectHandles processing of Tmrt (Mean Radiant Temperature) rasters and computes PET (Physiological Equivalent Temperature) using precomputed lookup tables.
- output_folder¶
- Type:
str
- gdal_dataset¶
- Type:
gdal.Dataset) Internal reference for GDAL dataset (if needed later
- valid_mask¶
- Type:
np.ndarray) Boolean mask marking valid (non-building, non-water
- tmrt_arrays_by_time¶
- Type:
dict
- time_groups¶
- Type:
dict) Tmrt arrays grouped by time of day (‘morning’, ‘afternoon’, ‘evening’
- averaged_tmrt¶
- Type:
dict
- pet_arrays_by_time¶
- Type:
dict
- classified_pet_by_time¶
- Type:
dict
- averaged_pet¶
- Type:
dict
- averaged_class_pet¶
- Type:
dict
- average_time_groups()[source]¶
Computes the average Tmrt for each time of day group.
- Returns:
Dictionary mapping time groups to mean Tmrt raster arrays.
- Return type:
dict
- calc_arrays(output_folder)[source]¶
Reads Tmrt raster files from the given folder and loads them into a dictionary keyed by time.
- Parameters:
output_folder (str) – Path to folder containing Tmrt_YYYY_DDD_HHMM.tif files.
- Returns:
Dictionary mapping time keys to Tmrt raster arrays.
- Return type:
dict
- calc_pet(Ta, RH, va, body_type='standard_man', lookup_file='src/databases/pet_lookup.h5')[source]¶
Computes PET and classified PET for each timestep and averaged Tmrt using the lookup table.
- Parameters:
Ta (float) – Air temperature in °C.
RH (float) – Relative humidity in %.
va (float) – Wind speed in m/s.
body_type (str) – Body type (‘standard_man’, ‘elderly_woman’, ‘standard_woman’, ‘young_child’).
lookup_file (str) – Path to PET HDF5 lookup file.
- calculate_stats_and_bins(array, pixel_size=0.5, isTmrt=True)[source]¶
Computes statistics and area coverage by thermal stress bin.
- Parameters:
array (np.ndarray) – Input Tmrt or PET raster array.
pixel_size (float) – Pixel size in meters (default is 0.5).
isTmrt (bool) – If True, use Tmrt bins; otherwise use PET bins.
- Returns:
Statistics including mean, median, min, max, and bin area/percentage breakdown.
- Return type:
dict
- classify_pet(pet_array)[source]¶
Classifies PET values into 9 thermal stress bins.
- Parameters:
pet_array (np.ndarray) – PET raster array.
- Returns:
Raster with integer bin class values (NaN where PET is invalid).
- Return type:
np.ndarray
- get_pet_raster_from_lookup(tmrt_raster, wind_speed, air_temp, rh, body_type, lookup_file='src/databases/pet_lookup.h5', tmrt_min=0, tmrt_max=65, tmrt_step=0.5, wind_speeds=None, rhs=None, temps=None)[source]¶
Returns the PET raster for the given TMRT raster and atmospheric conditions using a lookup table.
- Parameters:
tmrt_raster (np.ndarray) – Input TMRT raster.
wind_speed (float) – Wind speed in m/s.
air_temp (float) – Air temperature in °C.
rh (float) – Relative humidity in %.
body_type (str) – Type of body for lookup (‘standard_man’, ‘elderly_woman’, ‘standard_woman’, ‘young_child’).
lookup_file (str) – Path to HDF5 lookup file.
tmrt_min (float) – Minimum TMRT value in the lookup table.
tmrt_max (float) – Maximum TMRT value in the lookup table.
tmrt_step (float) – Step size for TMRT values in lookup.
wind_speeds (list) – Wind speed values in lookup (optional).
rhs (list) – Relative humidity values in lookup (optional).
temps (list) – Air temperature values in lookup (optional).
- Returns:
PET raster aligned with the input TMRT raster.
- Return type:
np.ndarray
- get_time_group(time_str)[source]¶
Assigns a time string to a part of the day: morning, afternoon, or evening.
- Parameters:
time_str (str) – Time string in HHMM format (e.g., “1300”).
- Returns:
Time group name or None if outside expected ranges.
- Return type:
str or None
- group_by_time_of_day()[source]¶
Groups Tmrt arrays by time of day into ‘morning’, ‘afternoon’, and ‘evening’.
- Returns:
Dictionary mapping time groups to lists of Tmrt arrays.
- Return type:
dict
- init_mask(building_mask, water_mask)[source]¶
Initializes the valid mask by excluding building and water areas.
- Parameters:
building_mask (np.ndarray) – Binary mask where non-zero indicates valid (non-building) pixels.
water_mask (np.ndarray) – Binary mask where non-zero indicates valid (non-water) pixels.