Reference Manual¶
Main Pipeline¶
CLI tool for estimating solar irradiance on buildings from digital surface models.
detect_grass_base()
¶
Auto-detect GRASS GIS installation path based on operating system.
Source code in src/pipeline.py
40 41 42 43 44 45 46 47 | |
Utility Modules¶
Building Outlines¶
Building outlines utilities for GRASS GIS.
This module contains helper functions to import building footprint vectors into a GRASS mapset, apply building masks so raster operations affect only building areas, extract masked raster values into building-specific rasters, and export final multi-band GeoTIFFs that include computed rasters (for example, solar irradiance) together with slope and aspect bands.
apply_building_mask(building_vector, grass_module)
¶
Apply a raster mask based on building outlines.
The mask created by r.mask restricts subsequent raster operations to the
area covered by the given vector. Typical workflows call this beforehand to copy
or compute values only for buildings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
building_vector
|
str
|
Name of the building footprint vector in GRASS. |
required |
output_name
|
Friendly name returned by the function (no effect on mask). |
required | |
grass_module
|
Any
|
The GRASS Python scripting Module class. |
required |
Returns:
| Type | Description |
|---|---|
None
|
None |
Source code in src/utils/building_outlines.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
calculate_outline_raster(solar_irradiance_raster, building_vector, output_name, grass_module)
¶
Create a raster containing values only for building outlines.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
solar_irradiance_raster
|
str
|
Name of the solar irradiance raster to be masked. |
required |
building_vector
|
str
|
Name of the building footprint vector to use for masking. |
required |
output_name
|
str
|
Name to assign to the resulting building-only raster. |
required |
grass_module
|
Any
|
The GRASS Python scripting Module class. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The GRASS raster name. |
Source code in src/utils/building_outlines.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
export_final_raster(raster_name, slope, aspect, output_tif, grass_module, output_dir=None)
¶
Export a multi-band GeoTIFF containing raster, slope, and aspect.
This function
- Creates an imagery group containing the three rasters using
i.group. - Calls
r.out.gdalto export the group as a multi-band GeoTIFF. - Removes the temporary imagery group.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
raster_name
|
str
|
Name of the primary raster to export (e.g., building-only GHI). |
required |
slope
|
str
|
Name of the slope raster to include as a band. |
required |
aspect
|
str
|
Name of the aspect raster to include as a band. |
required |
output_tif
|
str
|
Filename (or path) for the output GeoTIFF file to create. If output_dir is provided, the file is written inside that directory. |
required |
grass_module
|
Any
|
The GRASS Python scripting Module class. |
required |
output_dir
|
Optional[Path]
|
Optional directory in which to write the output file. When provided, output_tif is treated as a filename and joined with output_dir to form the full path. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
The full |
Source code in src/utils/building_outlines.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | |
load_building_outlines(shapefile, output_name, grass_module)
¶
Import building outlines (vector) from a shapefile into GRASS.
This uses the v.in.ogr GRASS module to import a vector dataset from a
shapefile into the current GRASS mapset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shapefile
|
str
|
Path to the directory containing a building footprints shapefile. |
required |
output_name
|
str
|
Name to assign to the vector map inside GRASS. |
required |
grass_module
|
Any
|
The GRASS Python scripting Module class. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The GRASS vector name. |
Source code in src/utils/building_outlines.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | |
remove_masks(grass_module)
¶
Remove any active raster mask(s) in the current GRASS session.
This helper attempts to reset raster masking by calling r.mask -r.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
grass_module
|
Any
|
The GRASS Python scripting Module class. |
required |
Returns:
| Type | Description |
|---|---|
None
|
None |
Raises:
| Type | Description |
|---|---|
Exception
|
if removing the mask encounters an error. |
Source code in src/utils/building_outlines.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |
DSM Utilities¶
Digital Surface Model (DSM) utilities.
This module contains helper functions for working with DSM rasters, using GDAL and GRASS GIS.
High-level responsibilities: - Attaching virtual rasters (VRT) to GRASS as external rasters. - Merging tiled DSM GeoTIFFs into a single VRT (optionally can be translated to a GeoTIFF). - Calculating slope and aspect rasters from a DSM. - Filtering rasters.
calculate_slope_aspect_rasters(dsm, grass_module)
¶
Compute slope and aspect rasters from a DSM using GRASS r.slope.aspect.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dsm
|
str
|
Name of the DSM raster in the GRASS mapset. |
required |
grass_module
|
Any
|
The GRASS Python scripting Module class. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[str, str]
|
A tuple |
Source code in src/utils/dsm.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | |
filter_raster_by_slope(input_raster, slope_raster, max_slope_degrees, output_name, grass_module)
¶
Filter input_raster to only keep pixels where slope <= max_slope_degrees.
This function uses a r.mapcalc expression to produce a masked
raster where any pixel with slope greater than max_slope_degrees is set
to NULL (GRASS NULL) and valid pixels retain their original value.
Example expression used
output = if(slope_raster <= max_slope_degrees, input_raster, null())
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_raster
|
str
|
GRASS raster name containing the values to be filtered. |
required |
slope_raster
|
str
|
GRASS raster name containing slope in degrees. |
required |
max_slope_degrees
|
float
|
Maximum allowed slope (inclusive). Pixels with slope greater than this value will be masked to NULL. |
required |
output_name
|
str
|
Name for the output raster. |
required |
grass_module
|
Any
|
The GRASS Python scripting Module class. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The name of the output raster. |
Source code in src/utils/dsm.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
load_virtual_raster_into_grass(input_vrt, output_name, grass_module)
¶
Attach a VRT (virtual raster) to GRASS using r.external and set region.
Using r.external avoids copying data into the GRASS database; the VRT is
referenced externally which is faster and uses no additional disk space.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_vrt
|
str
|
Path to the VRT file on disk. |
required |
output_name
|
str
|
The raster name to expose inside GRASS. |
required |
grass_module
|
Any
|
The GRASS Python scripting Module class. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The GRASS raster name. |
Source code in src/utils/dsm.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | |
merge_rasters(dsm_file_glob, area_name, output_dir)
¶
Merge tiled DSM files into a single VRT using GDAL.
This function discovers DSM tiles using a glob pattern, builds a GDAL VRT
(virtual raster) that mosaics them together, and returns the VRT filename.
The function intentionally leaves the VRT on disk instead of translating to
a final GeoTIFF so callers can decide on translation parameters (compression,
data type, nodata handling) or feed the VRT directly to GRASS via r.external.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dsm_file_glob
|
str
|
Glob pattern matching input DSM tiles. |
required |
area_name
|
str
|
Prefix to use for the generated VRT filename. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The path to the generated VRT file. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the glob pattern matches no files. |
RuntimeError
|
If GDAL fails to create the VRT for any reason. |
Source code in src/utils/dsm.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | |
Solar Irradiance¶
Solar irradiance calculation utilities for GRASS GIS.
This module provides functions for calculating solar irradiance using the GRASS GIS r.sun module. It supports both single-day calculations and interpolated multi-day calculations for seasonal analysis, as well as creating normalized coefficient rasters for WRF data adjustment.
The main workflow (if WRF data is provided) involves: 1. Calculate solar irradiance for key sample days using r.sun 2. Interpolate between key days to generate daily irradiance maps 3. Normalize to create coefficient rasters to adjust WRF data
calculate_solar_coefficients(day_irradiance_rasters, dsm, grass_module)
¶
Calculate percent-of-max solar coefficients for each day's irradiance.
Converts irradiance values (Wh/m²) to relative coefficients (0-1) using percent-of-max normalization.
The coefficients are then used to adjust WRF irradiance data so it accounts for roof shape, shading, etc.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
day_irradiance_rasters
|
dict[int, str]
|
Dict mapping day-of-year to irradiance raster names, as returned by calculate_solar_irradiance_interpolated(). |
required |
dsm
|
str
|
Name of the DSM raster, used as a prefix for output names. |
required |
grass_module
|
The GRASS Python scripting Module class. |
required |
Returns:
| Type | Description |
|---|---|
dict[int, str]
|
Dict mapping day-of-year (int) to coefficient raster name (str). |
Source code in src/utils/solar_irradiance.py
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | |
calculate_solar_irradiance(dsm, grass_output, aspect, slope, day, step, grass_module)
¶
Calculate solar irradiance for a single day using the GRASS r.sun module.
This function wraps the r.sun solar radiation model to compute global horizontal irradiance (GHI) under clear-sky conditions. The Linke turbidity factor is automatically interpolated based on the day of year.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dsm
|
str
|
Name of the input Digital Surface Model (elevation) raster in GRASS. |
required |
grass_output
|
str
|
Name for the output global radiation raster. |
required |
aspect
|
Name of the aspect raster (direction of slope) in GRASS. |
required | |
slope
|
Name of the slope raster (steepness) in GRASS. |
required | |
day
|
int
|
Day of year (1-365) for the irradiance calculation. |
required |
step
|
float
|
Time step in hours for the r.sun calculation. Smaller values (e.g., 0.5) give more accurate results but take longer. |
required |
grass_module
|
The GRASS Python scripting Module class for running GRASS commands. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The name of the output global radiation raster (same as grass_output). |
Note
This function assumes the GRASS computational region is already set appropriately for the DSM. The output units are Wh/m²/day.
Source code in src/utils/solar_irradiance.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
calculate_solar_irradiance_interpolated(dsm, aspect, slope, key_days, step, grass_module, export=False, output_dir=None)
¶
Calculate interpolated solar irradiance between key sample days.
This function computes solar irradiance for a set of key days, then uses linear interpolation (via r.series.interp) to estimate irradiance for all days in the range.
Workflow
- Run r.sun for each key day to get irradiance values
- Interpolate between key days to fill in the intermediate days
- Sum all daily rasters to get total irradiance over the period
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dsm
|
str
|
Name of the Digital Surface Model raster in GRASS. |
required |
aspect
|
Name of the aspect raster in GRASS. |
required | |
slope
|
Name of the slope raster in GRASS. |
required | |
key_days
|
list[int]
|
List of day-of-year values (1-365) to estimate irradiance. |
required |
step
|
float
|
Time step in hours for the r.sun calculation. Smaller values (e.g., 0.5) give more accurate results but take longer. |
required |
grass_module
|
The GRASS Python scripting Module class. |
required | |
export
|
bool
|
If True, export the summed irradiance raster as a GeoTIFF. Defaults to False. |
False
|
output_dir
|
Optional[Path]
|
Optional directory in which to write the exported GeoTIFF. Only used when export is True. When None, the file is written to the current working directory. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[dict[int, str], str]
|
A tuple containing: - day_irradiance_rasters: Dict mapping day-of-year (int) to the irradiance raster name (str) for each day in the range from min(key_days) to max(key_days). This includes both the exact r.sun calculations for key_days and interpolated values for days in between. The caller is responsible for cleaning up these rasters when no longer needed. - summed_irradiance: Name of the raster containing the sum of all daily irradiance values (total Wh/m² over the period). |
Source code in src/utils/solar_irradiance.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | |
Statistics¶
Statistics helpers for rooftop solar calculations in GRASS GIS.
This module provides helpers to compute per-building statistics by sampling rasters (clear-sky irradiance and optional WRF-adjusted irradiance) using GRASS vector/raster database functions. The workflow implemented here is:
- Use
v.rast.statsto compute aggregated raster statistics (sum, count) for each building polygon. - Create and update attribute columns (kWh, MWh, usable sqm) using
v.db.addcolumnandv.db.update. - Optionally compute WRF-derived statistics and a percent loss comparison between the calculated clear-sky values and WRF measured values.
- Export results to a GeoPackage and optionally a CSV.
create_stats(area, building_outlines, output_dir, rooftop_raster, grass_module, wrf_raster=None, output_csv=True)
¶
High-level workflow to produce building-level rooftop irradiance statistics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
area
|
str
|
Descriptive name for the area used as a prefix for output files. |
required |
building_outlines
|
str
|
GRASS vector name containing building polygons. |
required |
rooftop_raster
|
str
|
GRASS raster name containing rooftop irradiance (Wh). |
required |
grass_module
|
Any
|
The GRASS Python scripting Module class. |
required |
wrf_raster
|
Optional[str]
|
Optional GRASS raster name for WRF-adjusted irradiance. |
None
|
output_csv
|
bool
|
If True, also export a CSV summary. Defaults to True. |
True
|
Returns:
| Type | Description |
|---|---|
str
|
Path to the generated GeoPackage file containing building statistics. |
Source code in src/utils/stats.py
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | |
Weather (WRF)¶
WRF (Weather Research and Forecasting) functionality for GRASS GIS workflows.
This module contains utilities to load, reproject, clip, import and summarise WRF-derived solar variables (surface downward shortwave radiation).
High level responsibilities: - Read WRF NetCDF files via xarray and manage the CRS, including reprojections, and creating per-day WRF rasters. - Helpers to multiply WRF rasters by normalized coefficient rasters, sum per-day adjusted rasters, and produce a summed WRF raster for comparison against clear-sky modeled values.
calculate_wrf_adjusted_per_day(wrf_day_rasters, coefficient_rasters, grass_module, output_prefix='wrf_adjusted')
¶
Multiply per-day WRF rasters by corresponding coefficient rasters.
This creates a new GRASS raster for each day named "
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wrf_day_rasters
|
Dict[int, str]
|
Mapping from day-of-year (int) to GRASS raster name containing that day's WRF data. |
required |
coefficient_rasters
|
Dict[int, str]
|
Mapping from day-of-year (int) to GRASS raster name containing the normalized coefficient (0-1) for that day. |
required |
grass_module
|
Any
|
The GRASS Python scripting Module class. |
required |
output_prefix
|
str
|
Prefix to use when naming the adjusted rasters. |
'wrf_adjusted'
|
Returns:
| Type | Description |
|---|---|
Dict[int, str]
|
Mapping from day-of-year to the created adjusted raster names. |
Source code in src/utils/wrf.py
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | |
calculate_wrf_on_buildings(wrf_summed_raster, building_vector, output_name, grass_module)
¶
Apply a building mask and create a building-only WRF raster.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wrf_summed_raster
|
str
|
Name of the summed WRF raster in GRASS. |
required |
building_vector
|
str
|
Name of the building footprints vector in GRASS. |
required |
output_name
|
str
|
Name to create for the building-only WRF raster. |
required |
grass_module
|
Any
|
GRASS Module-like callable. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The name of the created building-only raster ( |
Source code in src/utils/wrf.py
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 | |
cleanup_wrf_intermediates(day_rasters, summed_raster, grass_module)
¶
Remove intermediate WRF rasters from the GRASS mapset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
day_rasters
|
Union[Dict[int, str], Iterable[str]]
|
Dict or iterable containing the names of per-day rasters. |
required |
summed_raster
|
Optional[str]
|
Optional name of the summed raster to remove as well. |
required |
grass_module
|
Any
|
The GRASS Python scripting Module class. |
required |
Returns:
| Type | Description |
|---|---|
None
|
None |
Source code in src/utils/wrf.py
324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | |
process_wrf_for_grass(nc_file_path, output_prefix, grass_module, source_crs='EPSG:4326', target_crs=None, days=None, clip_to_raster=None, print_diagnostics=False)
¶
Load WRF NetCDF, (optionally) reproject, import per-day rasters into GRASS and sum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
nc_file_path
|
str
|
Path to the WRF NetCDF file. |
required |
output_prefix
|
str
|
Prefix to use when naming imported rasters in GRASS. |
required |
grass_module
|
Any
|
The GRASS Python scripting Module class. |
required |
source_crs
|
str
|
CRS to attach to the raw WRF dataset (default EPSG:4326). |
'EPSG:4326'
|
target_crs
|
Optional[str]
|
If provided, reproject the dataset to this CRS before import. |
None
|
days
|
Optional[Iterable[int]]
|
Iterable of day-of-year integers to import. If None, the function imports the full range present in the dataset. |
None
|
clip_to_raster
|
Optional[str]
|
If provided, set the GRASS region to this raster and clip imported rasters to that region. |
None
|
print_diagnostics
|
bool
|
If True, call the diagnostics helper to print dataset metadata. |
False
|
Returns:
| Type | Description |
|---|---|
Dict[int, str]
|
A tuple (imported_rasters, summed_raster_name) where |
str
|
a dict mapping day-of-year to GRASS raster name and |
Tuple[Dict[int, str], str]
|
is the name of the combined total raster produced. |
Source code in src/utils/wrf.py
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 | |
sum_adjusted_rasters(adjusted_rasters, output_name, grass_module, cleanup=True)
¶
Sum a collection of per-day adjusted WRF rasters into a single raster.
This uses r.series (method=sum) when provided a list of raster names; if
a dict of day->raster is supplied the dict values are used.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adjusted_rasters
|
Union[Dict[int, str], Iterable[str]]
|
Mapping or iterable of raster names to sum. |
required |
output_name
|
str
|
Name for the summed raster in GRASS. |
required |
grass_module
|
Any
|
The GRASS Python scripting Module class. |
required |
cleanup
|
bool
|
If True, remove the input adjusted rasters from the mapset after the sum is created. |
True
|
Returns:
| Type | Description |
|---|---|
str
|
The name of the summed raster ( |
Source code in src/utils/wrf.py
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | |
Environment & GRASS Setup¶
GRASS GIS environment setup helper.
This module provides a single convenience function, setup_grass, which
enables the programmatic usage of GRASS GIS.
setup_grass(gisbase, grassdata_dir='grassdata', location='solar_estimates', mapset='PERMANENT')
¶
Prepare the GRASS Python bindings and initialize a session.
This function
- uses GISBASE to locate the GRASS installation
- appends relevant GRASS directories to PATH,
- ensures
grassdata_direxists and creates it if missing - calls
gscript.setup.init(grassdata_dir, location, mapset)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gisbase
|
str
|
Filesystem path to the GRASS installation root (contains |
required |
grassdata_dir
|
str
|
Directory to host GRASS locations (created if missing). |
'grassdata'
|
location
|
str
|
Name of the location under |
'solar_estimates'
|
mapset
|
str
|
GRASS mapset to initialize inside the Location. |
'PERMANENT'
|
Returns:
| Type | Description |
|---|---|
object
|
A tuple |
type
|
module and |
Tuple[object, type]
|
used for running GRASS's modules. |
Raises:
| Type | Description |
|---|---|
ImportError
|
If GRASS Python modules cannot be imported after modifying |
CalledProcessError
|
If the attempt to create a new GRASS Location fails. |
Source code in src/utils/grass_utils.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
Diagnostics¶
print_wrf_diagnostics(nc_file_path)
¶
Load a WRF NetCDF file and print comprehensive diagnostic information.
Source code in src/utils/diagnostics.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | |
Linke Turbidity¶
Logging Configuration¶
Logging configuration for the solar estimates pipeline.
This module provides structured logging with elapsed time since script start.
ElapsedTimeFormatter
¶
Bases: Formatter
Formatter that prefixes each log record with elapsed time since script start.
Source code in src/utils/logging_config.py
39 40 41 42 43 44 45 | |
get_logger(name=None)
¶
Get a logger instance for a module.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
Logger name, typically |
None
|
Returns:
| Type | Description |
|---|---|
Logger
|
A child logger under the |
Source code in src/utils/logging_config.py
69 70 71 72 73 74 75 76 77 78 | |
setup_logging(log_level=logging.INFO)
¶
Configure logging with elapsed time formatting.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
log_level
|
int
|
Logging level (default: INFO). |
INFO
|
Returns:
| Type | Description |
|---|---|
Logger
|
The configured root pipeline logger. |
Source code in src/utils/logging_config.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |