diff --git a/hydromt_fiat/fiat.py b/hydromt_fiat/fiat.py index 149554b4..0f242a39 100644 --- a/hydromt_fiat/fiat.py +++ b/hydromt_fiat/fiat.py @@ -1286,19 +1286,24 @@ def read_geoms(self): fns = glob.glob(Path(self.root, "geoms", "*.geojson").as_posix()) if self.spatial_joins["aggregation_areas"]: - fns_aggregation = glob.glob(Path(self.root, "geoms", "aggregation_areas","*.geojson").as_posix()) - fns.append(fns_aggregation[0]) + fns_aggregation = glob.glob(Path(self.root, "geoms", "aggregation_areas/*").as_posix()) + fns.extend(fns_aggregation) if self.spatial_joins["additional_attributes"]: - if len(glob.glob(Path(self.root, "geoms", "additional_attributes","*.geojson").as_posix())) > 0: - fns_additional_attributes = glob.glob(Path(self.root, "geoms", "additional_attributes","*.geojson").as_posix()) - fns.append(fns_additional_attributes[0]) + if len(glob.glob(Path(self.root, "geoms", "additional_attributes/*").as_posix())) > 0: + fns_additional_attributes = glob.glob(Path(self.root, "geoms", "additional_attributes/*").as_posix()) + fns.extend(fns_additional_attributes) if len(glob.glob(Path(self.root, "geoms", "building_footprints","*.geojson").as_posix())) > 0: - fns_building_footprints = glob.glob(Path(self.root, "geoms", "building_footprints","*.geojson").as_posix()) - fns.append(fns_building_footprints[0]) + fns_building_footprints = glob.glob(Path(self.root, "geoms", "building_footprints/*").as_posix()) + self.building_footprint = gpd.read_file(fns_building_footprints[0]) if len(fns) >= 1: self.logger.info("Reading static geometries") for fn in fns: - name = Path(fn).stem + if "aggregation_areas" in fn: + name = f"aggregation_areas/{Path(fn).stem}" + elif "additional_attributes" in fn: + name = f"additional_attributes/{Path(fn).stem}" + else: + name = Path(fn).stem self.set_geoms(gpd.read_file(fn), name=name) def write(self): diff --git a/hydromt_fiat/workflows/exposure_vector.py b/hydromt_fiat/workflows/exposure_vector.py index 12c4538b..eea6c32e 100644 --- a/hydromt_fiat/workflows/exposure_vector.py +++ b/hydromt_fiat/workflows/exposure_vector.py @@ -1029,7 +1029,8 @@ def setup_ground_elevation( ) # Unit conversion - self.unit_conversion("Ground Elevation", grnd_elev_unit) + if grnd_elev_unit: + self.unit_conversion(parameter = "Ground Elevation", unit = grnd_elev_unit) else: self.logger.warning( @@ -2021,8 +2022,8 @@ def get_continent_name(self, continent_code: str) -> str: } return continent_dict[continent_code] - def unit_conversion(self, parameter: str,unit: Union[str, Units]) -> Union[str, Units]: - # Unit conversion + def unit_conversion(self, parameter: str, unit:Units) -> None: + # Unit conversion if unit != self.length_unit: if (unit == Units.meters.value) and (self.length_unit == Units.feet.value): self.exposure_db[parameter] = self.exposure_db[