Skip to content

Refactored functions with inheritance

Karsten Prehn requested to merge feature/inheritance into main

This MR does not add any new code, but shifts existing code around. I felt that discretize.py was growing too big, so I refactored code into thematically fitting classes and then let discretize.py inherit from those classes. This will also help me to easily re-use functions in the upcoming MRs.

  • basicclass.py (NEW): almost every class now inherits from this class. Does the check for config and log parameters that used to be in each class' constructor.
  • config.py (NEW): here is now all the configuration initialization code from discretize.py.
  • spatialfunctions.py (NEW): all generic spatial functions from discretize.py (for now it's only 1 function)
  • quadtile.py (NEW): all functions from discretize.py that calculate something tile related. Inherits from spatialfunctions.py.
  • discretize.py now inherits from, both, config.py and quadtile.py.

Nothing else changed, but discretize.py is now ~400 lines of code smaller, making it better readable and giving the project as a whole a better structure.

\approve @ds @marius

Merge request reports

Loading