geofabrics.geometry

This module contains classes associated with manipulating vector data.

Classes

CatchmentGeometry

A class defining revelant catchment regions by polygons.

BathymetryContours

A class for sampling from bathymetry contours.

OceanPoints

A class for accesing marine bathymetry points. These can be used as

ElevationPoints

A class for accessing estimated or measured river, mouth and waterway

ElevationContours

Resample at spatial resolution at points

TileInfo

A class for working with tiling information.

RiverMouthFan

A class for creating an appropiate river mouth fan to transition from

Module Contents

class geofabrics.geometry.CatchmentGeometry(catchment_file, crs, resolution, foreshore_buffer=2)

A class defining revelant catchment regions by polygons.

The CRS is a dictionary containing the EPSG code for a ‘horizontal’ and ‘vertical’ datum.

Specifically, this defines polygon regions like ‘land’, ‘foreshore’, ‘offshore’, and ensures all regions are defined in the same CRS.

The ‘land’, ‘foreshore’ and ‘offshore’ regions are clipped within the ‘catchment’, but do not overlap. The ‘land’ is polygon is defined by a specified polygon which is clipped within the ‘catchment’. The ‘foreshore’ is defined as a ‘foreshore_buffer’ x ‘resolution’ outward buffer from the ‘land’ and within the ‘catchment’ extents. The ‘offshore’ region is any remaining region within the ‘catchment’ and outside the ‘land’ and ‘foreshore’ polygons.

It also supports functions for determining how much of a region is outside an exclusion zone. I.E. is outside lidar_extents see class method land_and_foreshore_without_lidar for an example.

It is initalised with the catchment. The land must be added before the other regions (i.e. land, offshore, foreshore, etc) can be accessed.

Parameters:
  • catchment_file (Union[str, pathlib.Path])

  • crs (dict)

  • resolution (float)

  • foreshore_buffer (int)

property catchment

Return the catchment region

property land

Return the catchment land region

property full_land

Return the full land region

property foreshore

Return the catchment foreshore region

property land_and_foreshore

Return the catchment land and foreshore region

property foreshore_and_offshore

Return the catchment foreshore and offshore region

property offshore

Return the catchment offshore region

land_and_foreshore_without_lidar(dense_extents)

Return the land and foreshore region without LiDAR

Parameters:

dense_extents (geopandas.GeoDataFrame)

offshore_without_lidar(dense_extents)

Return the offshore region without LiDAR

Parameters:

dense_extents (geopandas.GeoDataFrame)

offshore_dense_data_edge(dense_extents)

Return the offshore edge of where there is ‘dense data’ i.e. LiDAR or reference DEM

Parameters:

dense_extents (geopandas.GeoDataFrame)

offshore_no_dense_data(lidar_extents)

Return the offshore area where there is no ‘dense data’ i.e. LiDAR

class geofabrics.geometry.BathymetryContours(contour_file, catchment_geometry, z_label=None, exclusion_extent=None)

A class for sampling from bathymetry contours.

Assumes contours to be sampled to the catchment_geometry resolution

Parameters:
sample_contours(resolution)

Sample the contours at the specified resolution.

Parameters:

resolution (float)

Return type:

numpy.ndarray

class geofabrics.geometry.OceanPoints(points_file, catchment_geometry, is_depth=False, z_label=None)

A class for accesing marine bathymetry points. These can be used as depths to interpolate elevations offshore.

Parameters:
  • points_file (str)

  • catchment_geometry (CatchmentGeometry)

  • is_depth (bool)

  • z_label (str)

property boundary

Return the bounding box containing data

property points

Return the points

property x

The x values

property y

The y values

property z

The z values

sample()

Return points - rename in future.

Return type:

numpy.ndarray

class geofabrics.geometry.ElevationPoints(points_files, polygon_files, catchment_geometry, filter_osm_ids=[], z_labels=None)

A class for accessing estimated or measured river, mouth and waterway elevations as points. Paired elevation and polygon files are expected. The elevations are used to interpolate elevations within the polygons.

Parameters:
  • points_files (list)

  • polygon_files (list)

  • catchment_geometry (CatchmentGeometry)

  • filter_osm_ids (list)

  • z_labels (list)

property polygons: geopandas.GeoDataFrame

Return the polygons.

Return type:

geopandas.GeoDataFrame

property points_array: numpy.ndarray

Return the points as a single array.

Return type:

numpy.ndarray

property points

Return the points

bank_heights_exist()

Return true if the bank heights are defined in array

Return type:

bool

bank_height_points()

Return the points with ‘Z’ being the estimated bank height as a single array.

Return type:

numpy.ndarray

property x

The x values

property y

The y values

property z

The z values

class geofabrics.geometry.ElevationContours(points_files, polygon_files, catchment_geometry, z_labels=None)

Bases: ElevationPoints

Resample at spatial resolution at points

Parameters:
  • points_files (list)

  • polygon_files (list)

  • catchment_geometry (CatchmentGeometry)

  • z_labels (list)

sample_contours(resolution)

Sample the contours at the specified resolution.

Parameters:

resolution (float)

Return type:

numpy.ndarray

class geofabrics.geometry.TileInfo(tile_file, catchment_geometry)

A class for working with tiling information.

Parameters:
property tile_names

Return the names of all tiles within the catchment

class geofabrics.geometry.RiverMouthFan(aligned_channel_file, river_bathymetry_file, river_polygon_file, ocean_contour_file, ocean_points_file, crs, cross_section_spacing, elevation_labels, ocean_contour_depth_label=None)

A class for creating an appropiate river mouth fan to transition from river depth estimates to the ocean bathymetry values. This fan region defines a transition from river to coast within a fan shaped polygon (15 degrees on each

side).

The fan begins with the most downstream river width estimate, and ends with the first contour of either more than 2x the depth of the mouth. This aims to ensure their is a defined fan that is slightly deeper than the surrounding during the transition. A fan is caculated for both river bed elevation approach. TODO In future,it may move to defining the width as 10x the mouth width. If no width at mouth - move back to where there is a valid width

Parameters:
  • aligned_channel_file (str)

  • river_bathymetry_file (str)

  • river_polygon_file (str)

  • ocean_contour_file (str)

  • ocean_points_file (str)

  • crs (int)

  • cross_section_spacing (float)

  • elevation_labels (list)

  • ocean_contour_depth_label (str)

crs  The horizontal CRS to be used. i.e. EPSG

2193

cross_section_spacing  The spacing in
Type:

m

aligned_channel_file  Thefile name for the aligned river channel file.
river_bathymetry_file  The file name for the river bathymetry values.
ocean_contour_file  The file name for the ocean contours. Depths are positive
ocean_points_file The file name for the ocean points. Elevations are negative.
ocean_contour_depth_label  The column label for the depth values.
polygon_and_bathymetry()

Calculate and return the fan polygon values. Perform calculations for both rive bed estimation approaches, so both have a smooth transition to offshore bathyemtry.