Skip to content

Commit

Permalink
update untis class
Browse files Browse the repository at this point in the history
  • Loading branch information
Santonia27 committed Nov 8, 2024
1 parent 3b03270 commit 2dea02a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
18 changes: 15 additions & 3 deletions hydromt_fiat/api/data_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,21 @@ class ExtractionMethod(str, Enum):


class Units(str, Enum):
meters = ["meters", "m"]
feet = ["feet", "ft"]

meters = "meters",
feet = "feet"
@classmethod
def from_string(cls, value: str):
"""Map different strings to the correct Units enum."""
mappings = {
"meters": cls.meters,
"m": cls.meters,
"feet": cls.feet,
"ft": cls.feet,
}
try:
return mappings[value]
except KeyError:
raise ValueError(f"Unknown unit: {value}")

class Conversion(float, Enum):
meters_to_feet = 3.28084
Expand Down
1 change: 1 addition & 0 deletions hydromt_fiat/api/exposure_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ def set_asset_locations_source_and_get_data(
ground_elevation_unit=ground_elevation_unit,
bf_conversion=bf_conversion,
keep_unclassified=keep_unclassified,
unit=Units.meters.value,
)
primary_object_types = (
self.exposure.exposure_db["Primary Object Type"].unique().tolist()
Expand Down

0 comments on commit 2dea02a

Please sign in to comment.