Skip to content

Commit

Permalink
Correct netCDF files to be compatible with Delft-fiat
Browse files Browse the repository at this point in the history
Correct netCDF files to be compatible with Delft-fiat
  • Loading branch information
Mares2022 committed Jul 13, 2023
1 parent b4f4376 commit 3436286
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 25 deletions.
18 changes: 11 additions & 7 deletions hydromt_fiat/fiat.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,21 +370,25 @@ def setup_hazard(
# result_list = list(sfincs_model.results.keys())
# sfincs_model.write_raster("results.zsmax", compress="LZW")
da = sfincs_model.results["zsmax"]

# da = da.squeeze('timemax').drop('timemax')
da = da.isel(timemax=0).drop('timemax')

else:
if not self.region.empty:
da = self.data_catalog.get_rasterdataset(
da_map_fn, geom=self.region
)
# da = self.data_catalog.get_rasterdataset(
# da_map_fn, geom=self.region
# )
da = self.data_catalog.get_rasterdataset(da_map_fn)
else:
da = self.data_catalog.get_rasterdataset(da_map_fn)

da.encoding["_FillValue"] = None
# reading from the datacatalog
else:
if not self.region.empty:
# da = self.data_catalog.get_rasterdataset(
# name_catalog, variables=da_name, geom=self.region
# )
da = self.data_catalog.get_rasterdataset(
name_catalog, variables=da_name, geom=self.region
name_catalog, variables=da_name
)
else:
da = self.data_catalog.get_rasterdataset(
Expand Down
21 changes: 3 additions & 18 deletions tests/test_hazard.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
}


@pytest.mark.skip(reason="Not correctly implemented yet")
@pytest.mark.parametrize("case", list(_cases.keys()))
def test_hazard(case):
# Read model in examples folder.
Expand All @@ -39,25 +38,11 @@ def test_hazard(case):
nodata = configread(config_fn)["setup_hazard"]["nodata"]
var = configread(config_fn)["setup_hazard"]["var"]
chunks = configread(config_fn)["setup_hazard"]["chunks"]
configread(config_fn)["setup_hazard"]["maps_id"]
configread(config_fn)["setup_hazard"]["name_catalog"]
configread(config_fn)["setup_hazard"]["risk_output"]
configread(config_fn)["setup_config"]["hazard_type"]

param_lst, params = get_lists(
map_fn,
map_type,
chunks,
rp,
crs,
nodata,
var,
)

check_parameters(
param_lst,
params,
hyfm,
)
params = check_parameters_type(map_fn, map_type, rp, crs, nodata, var, chunks)
check_parameters_size(params)

assert hyfm
assert params

0 comments on commit 3436286

Please sign in to comment.