Added more functions to create cells around SERA industrial points

Cecilia Nievas requested to merge feature/ind03 into master

The industrial exposure of several European countries is defined in the European Seismic Risk Model 2020 (ESRM20, or SERA model) on a 30-arcsec grid. The ESRM20/SERA files only provide points (lon, lat) in which buildings exist, not the full definition of the 30-arcscec grid. We need to define the polygons of the cells of which the given points are centroids in order to then treat them as the equivalent of "districts" for the industrial case.

This merge request is the third of several that aim at implementing this feature. The following is included in this third merge request:

  • Added six functions to
    • build_adjusted_cells_dataframe(): update the geometries of the input GeoDataFrame as indicated by the coordinates in a dictionary given as input (the dictionary which is output of adjust_coords()).
    • overlap_by_full_geom_intersection(): carry out the intersection of all the geometries in the input GeoDataFrame with each other, going row by row. Used to detect overlaps (and gaps when the cells in the input GeoDataFrame have been expanded by a buffer, in combination with swell_cells_with_buffer() and other steps).
    • define_col_names(): auxiliary function for overlap_by_full_geom_intersection() to define column names.
    • swell_cells_with_buffer(): expand the cells in the input GeoDataFrame as per the offsets given as input. Used to detect gaps between cells (combined with a geometry subtraction in a separate step).
    • enforce_boundaries_lon(): auxiliary function for swell_cells_with_buffer() to force longitude values in the input array to be in the range [-180.0,+180.0].
    • enforce_boundaries_lat(): auxiliary function for swell_cells_with_buffer() to force latitude values in the input array to be in the range [-90.0,+90.0].
  • Added tests to those six functions to

This feature is associated with dynamicexposure/collaboration#40

Previous merger request: !12 (merged) (merged)

Note: print statements are used to indicate errors/problems as a full logger functionality is not yet part of the prototype code (quite a manual logging system is set up in some core scripts, though; a full logger functionality will probably not be incorporated to the prototype code but go directly in the refactoring).

\approve @fd

\rfc @ds

\fyi @tara @shinde

Edited by Cecilia Nievas

Merge request reports