OSOceanAcoustics / echoregions

Interfacing water column sonar data with annotations and labels
https://echoregions.readthedocs.io/
Apache License 2.0
6 stars 6 forks source link

Disentangle nested if-else under `Regions2D.select_region` #140

Closed leewujung closed 8 months ago

leewujung commented 11 months ago

The below section can be disentangled by doing all the current else (error) conditions first. In that case, when the else (error) conditions occur, the subsequent code will not be executed, so the flow would be a lot cleaner without the nested if-else. https://github.com/OSOceanAcoustics/echoregions/blob/ae1e8c2be57c056a5c4fd182708b8185824480f9/echoregions/regions2d/regions2d.py#L132-L170

The same comments go with the block on depth as well: https://github.com/OSOceanAcoustics/echoregions/blob/ae1e8c2be57c056a5c4fd182708b8185824480f9/echoregions/regions2d/regions2d.py#L171-L210