Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gde_calculations_prototype
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 7
    • Issues 7
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Dynamic Exposure
  • Legacy
  • gde_calculations_prototype
  • Issues
  • #10

Closed
Open
Created May 31, 2021 by Cecilia Nievas@cnievasMaintainer

Deal with NULL database values when reading built-up area

The function calculate_weights() in GDE_TOOLS_general.py crashes when the input cells_param_vals comes from having retrieved NULL values from the tiles database (https://git.gfz-potsdam.de/dynamicexposure/legacy/gde_calculations_prototype/-/blob/master/GDE_TOOLS_general.py#L162). The error is the following:

  File "SERA_distributing_exposure_to_cells.py", line 121, in <module>
    run_this_file(config_dict)     
  File "SERA_distributing_exposure_to_cells.py", line 100, in run_this_file
    cells_ids_weights= gdet_gral.calculate_weights(cells_param_vals, gdet_psql.define_subweights_of_cells(cells_ids, 'all'))
  File "/.../gde_calculations_prototype/GDE_TOOLS_general.py", line 162, in calculate_weights
    aux_array= cells_param_vals * subweights
TypeError: unsupported operand type(s) for *: 'NoneType' and 'float'

The code retrieved the values of ghs_km2 for the cells associated with a particular admin ID, but some of them were NULL because the code that assigned them had not been run (issue of running parts of a country and forgetting that the whole country is not run, for example). If we can guarantee that this never happens when refactoring the code, then this is not a problem. However, if we cannot guarantee that NULL values will never be retrieved, then this needs to be dealt with.

Assignee
Assign to
Time tracking