GFDRR / CCDR-tools

Geoanalytics for climate and disaster risk screening
https://gfdrr.github.io/CCDR-tools/
12 stars 8 forks source link

Modularization and further Code Cleanup #36

Closed jasperschroeder closed 1 week ago

jasperschroeder commented 1 week ago

This Pull request encompasses three major topics:

  1. Modularization of widgets for notebooks
  2. Passing period and scenario as function parameters
  3. Further Code Cleanup

1 Modularization of widgets for notebooks In order to modularize code and to avoid duplication of code blocks, I created common and notebook-specific helper files that contain code to create the widgets. Storing these in dedicated files instead of repeating code across multiple notebooks will help to make code more maintainable. (This goes into direction of modularization as raised in Issue 35.

2 Passing period and scenario as function parameters I noticed that period and scenario variables were not yet passed as function parameters in the corresponding function definitions and calls. Thus, I modified the code so that these are now passed as function parameters.

3 Further Code Cleanup I further cleaned up the code, most notable is that I removed the "from common import *" statement in runAnalysis as this behavior can clutter the namespace and makes it harder to track if, e.g., libraries are imported but not used. Other items include moving the URL for the world pop into the common file (to align with the rest_api_url parameter).