Skip to content

Instantly share code, notes, and snippets.

View gkahiu's full-sized avatar

Kahiu gkahiu

View GitHub Profile
@gkahiu
gkahiu / constant_rasters_ui.py
Last active October 25, 2025 10:45
Pseudocode for validating UI design of constant raster module
# Modify cplus.gui.component_item_model.py
class ComponentItemModel(QtGui.QStandardItemModel):
"""View model for ModelComponent objects."""
def __init__(self, parent=None, is_checkable=False):
super().__init__(parent)
self.setColumnCount(1)
# Added in v1.1.18
@gkahiu
gkahiu / constant_rasters.py
Created October 23, 2025 08:48
Pseudo code for a module of creating constant rasters
# Definitions in cplus.definitions.defaults.py
YEARS_EXPERIENCE_ID = "years_experience"
YEARS_EXPERIENCE_NAME = "Years of Experience"
# cplus.lib.constant_raster.py creates an application-wide registry
constant_raster_registry = ConstantRasterRegistry()
# cplus.main.py to register different constant raster collections
from cplus.lib.constant_raster import ConstantRasterMetadata, constant_raster_registry
from cplus.model.constant_raster import ConstantRasterCollection
@gkahiu
gkahiu / carbon.py
Created October 10, 2025 07:25
Carbon calculations
# -*- coding: utf-8 -*-
"""
Contains functions for carbon calculations.
"""
from functools import partial
import math
from numbers import Number
import os
import typing