Skip to content

Commit 05ac4b8

Browse files
committed
handle early return for None case in _update_template_units for clarity
1 parent 5fe0ea2 commit 05ac4b8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/mdio/converters/segy.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,12 +316,13 @@ def _get_spatial_coordinate_unit(segy_file_info: SegyFileInfo) -> LengthUnitMode
316316

317317
def _update_template_units(template: AbstractDatasetTemplate, unit: LengthUnitModel | None) -> AbstractDatasetTemplate:
318318
"""Update the template with dynamic and some pre-defined units."""
319-
if unit is None:
320-
return template
321-
322319
# Add units for pre-defined: angle and azimuth etc.
323320
new_units = {key: AngleUnitModel(angle=AngleUnitEnum.DEGREES) for key in ANGLE_UNIT_KEYS}
324321

322+
# If a spatial unit is not provided, we return as is
323+
if unit is None:
324+
return template
325+
325326
# Dynamically add units based on the spatial coordinate unit
326327
for key in SPATIAL_UNIT_KEYS:
327328
current_value = template.get_unit_by_key(key)

0 commit comments

Comments
 (0)