Commit b611fa57 authored by Cecilia Nievas's avatar Cecilia Nievas
Browse files

Added capacity to handle issues with input boundaries

parent 0641a54c
Pipeline #41578 passed with stage
in 2 minutes and 28 seconds
...@@ -1164,6 +1164,11 @@ class ExposureModelESRM20(AggregatedExposureModel): ...@@ -1164,6 +1164,11 @@ class ExposureModelESRM20(AggregatedExposureModel):
sep=",", sep=",",
) )
if exposure_entity.name == "France" and "ID_5" in datatypes:
data_table["ID_5"] = numpy.array(
[val.zfill(5) for val in data_table["ID_5"].values]
)
# Fill in data_table with potentially missing columns with default values # Fill in data_table with potentially missing columns with default values
to_add_if_non_existent = [ to_add_if_non_existent = [
self.csv_column_names["settlement_type"], self.csv_column_names["settlement_type"],
...@@ -1259,6 +1264,11 @@ class ExposureModelESRM20(AggregatedExposureModel): ...@@ -1259,6 +1264,11 @@ class ExposureModelESRM20(AggregatedExposureModel):
geometries_table = geopandas.GeoDataFrame.from_file( geometries_table = geopandas.GeoDataFrame.from_file(
os.path.join(configuration.boundaries_pathname, subfolder, filename), os.path.join(configuration.boundaries_pathname, subfolder, filename),
) )
if geometries_table.crs is None:
# Assume 4326 if CRS definition missing in file
geometries_table.crs = pyproj.CRS("EPSG:4326")
else:
geometries_table = geometries_table.to_crs("EPSG:4326") geometries_table = geometries_table.to_crs("EPSG:4326")
# Force data types (dtype=datatypes not working in geopandas.GeoDataFrame.from_file) # Force data types (dtype=datatypes not working in geopandas.GeoDataFrame.from_file)
......
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