Commit 6fd0c02c authored by Cecilia Nievas's avatar Cecilia Nievas
Browse files

Changed file structure to search for ESRM20 boundaries

parent 93647423
Pipeline #41525 canceled with stage
in 18 seconds
......@@ -456,6 +456,7 @@ class ExposureModelESRM20(AggregatedExposureModel):
"second": "short",
}
self.boundary_filename_pattern = {
"subfolder": "Adm%s",
"filename": "Adm%s_%s.shp",
"first": "data_units_level",
"second": "name",
......@@ -805,6 +806,7 @@ class ExposureModelESRM20(AggregatedExposureModel):
# Check that the data units cover all of the exposure entity; if not, create an
# additional filler unit to "fill in" the gaps
"""
if len(data_units_ids) > 0: # nothing to "fill in" if no data units are defined at all
filler_data_unit_geometry_table = self.ensure_full_geographic_coverage(
exposure_entity_name,
......@@ -854,7 +856,7 @@ class ExposureModelESRM20(AggregatedExposureModel):
},
building_classes_proportions_and_properties,
)
"""
return
def ensure_full_geographic_coverage(
......@@ -1248,10 +1250,15 @@ class ExposureModelESRM20(AggregatedExposureModel):
],
getattr(exposure_entity, self.boundary_filename_pattern["second"]),
)
subfolder = self.boundary_filename_pattern["subfolder"] % (
exposure_entity.occupancy_cases[occupancy_case][
self.boundary_filename_pattern["first"]
]
)
# Read the data file (errors will be handled by geopandas)
geometries_table = geopandas.GeoDataFrame.from_file(
os.path.join(configuration.boundaries_pathname, filename),
os.path.join(configuration.boundaries_pathname, subfolder, filename),
)
geometries_table = geometries_table.to_crs("EPSG:4326")
......@@ -1295,10 +1302,11 @@ class ExposureModelESRM20(AggregatedExposureModel):
0,
exposure_entity_name,
)
subfolder = self.boundary_filename_pattern["subfolder"] % (0)
# Read the data file (errors will be handled by geopandas)
geometries_table = geopandas.GeoDataFrame.from_file(
os.path.join(configuration.boundaries_pathname, filename),
os.path.join(configuration.boundaries_pathname, subfolder, filename),
)
geometries_table = geometries_table.to_crs("EPSG:4326")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment