Commit 0641a54c authored by Cecilia Nievas's avatar Cecilia Nievas
Browse files

Changed file structure to search for ESRM20 boundaries

parent 93647423
Pipeline #41526 passed with stage
in 2 minutes and 23 seconds
...@@ -456,6 +456,7 @@ class ExposureModelESRM20(AggregatedExposureModel): ...@@ -456,6 +456,7 @@ class ExposureModelESRM20(AggregatedExposureModel):
"second": "short", "second": "short",
} }
self.boundary_filename_pattern = { self.boundary_filename_pattern = {
"subfolder": "Adm%s",
"filename": "Adm%s_%s.shp", "filename": "Adm%s_%s.shp",
"first": "data_units_level", "first": "data_units_level",
"second": "name", "second": "name",
...@@ -1248,10 +1249,15 @@ class ExposureModelESRM20(AggregatedExposureModel): ...@@ -1248,10 +1249,15 @@ class ExposureModelESRM20(AggregatedExposureModel):
], ],
getattr(exposure_entity, self.boundary_filename_pattern["second"]), 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) # Read the data file (errors will be handled by geopandas)
geometries_table = geopandas.GeoDataFrame.from_file( 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") geometries_table = geometries_table.to_crs("EPSG:4326")
...@@ -1295,10 +1301,11 @@ class ExposureModelESRM20(AggregatedExposureModel): ...@@ -1295,10 +1301,11 @@ class ExposureModelESRM20(AggregatedExposureModel):
0, 0,
exposure_entity_name, exposure_entity_name,
) )
subfolder = self.boundary_filename_pattern["subfolder"] % (0)
# Read the data file (errors will be handled by geopandas) # Read the data file (errors will be handled by geopandas)
geometries_table = geopandas.GeoDataFrame.from_file( 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") 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