Skip to content

Commit

Permalink
change reprojection to Dem instead of output floodmap
Browse files Browse the repository at this point in the history
  • Loading branch information
Santonia27 committed Jan 7, 2025
1 parent f4f79db commit e5a6d64
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions flood_adapt/adapter/sfincs_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import hydromt_sfincs.utils as utils
import numpy as np
import pandas as pd
import rioxarray as rxr
import xarray as xr
from cht_tide.read_bca import SfincsBoundary
from cht_tide.tide_predict import predict
Expand Down Expand Up @@ -523,6 +522,7 @@ def write_geotiff(self, zsmax, demfile: Path, floodmap_fn: Path):
UnitTypesLength("meters")
)
dem = dem_conversion * self.sf_model.data_catalog.get_rasterdataset(demfile)
dem = dem.rio.reproject(self.sf_model.crs)

# determine conversion factor for output floodmap
floodmap_units = self.site.attrs.sfincs.floodmap_units
Expand All @@ -536,11 +536,6 @@ def write_geotiff(self, zsmax, demfile: Path, floodmap_fn: Path):
hmin=0.01,
floodmap_fn=str(floodmap_fn),
)
# reproject floodmap to sfincs projection
floodmap = rxr.open_rasterio(floodmap_fn, masked=True).squeeze()
crs = self.sf_model.crs
floodmap = floodmap.rio.reproject(crs)
floodmap.rio.to_raster(Path(floodmap_fn))

def downscale_hmax(self, zsmax, demfile: Path):
# read DEM and convert units to metric units used by SFINCS
Expand Down

0 comments on commit e5a6d64

Please sign in to comment.