Skip to content

Commit

Permalink
corrected unit conversion bug for risk
Browse files Browse the repository at this point in the history
  • Loading branch information
panosatha committed Sep 27, 2023
1 parent 177adb8 commit 86b79c5
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions hydromt_fiat/fiat.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,6 @@ def setup_hazard(
# da = da.squeeze('timemax').drop('timemax')
da = da.isel(timemax=0).drop("timemax")

# Convert to units of the exposure data if required
if self.exposure.unit != da.units:
da = da * unit_conversion_factor

else:
if not self.region.empty:
Expand All @@ -405,6 +402,7 @@ def setup_hazard(
da = self.data_catalog.get_rasterdataset(da_map_fn)
else:
da = self.data_catalog.get_rasterdataset(da_map_fn)
# Convert to units of the exposure data if required
# reading from the datacatalog
else:
if not self.region.empty:
Expand All @@ -414,7 +412,8 @@ def setup_hazard(
da = self.data_catalog.get_rasterdataset(map_fn, variables=da_name)
else:
da = self.data_catalog.get_rasterdataset(map_fn, variables=da_name)

if self.exposure.unit != da.units:
da = da * unit_conversion_factor
da.encoding["_FillValue"] = None
da = da.raster.gdal_compliant()

Expand Down

0 comments on commit 86b79c5

Please sign in to comment.