Parameter mapping

groundhog.general.parameter_mapping.get_projected_point(lon1, lat1, lon2, lat2, lon3, lat3)[source]

Finds the coordinates of a point projected onto a line

Purpose - lon1,lat1,lon2,lat2 = Two points representing the ends of the line segment in lat/lon

lon3,lat3 = The lat/lon of the point for which the offset needs to be known

Returns - lon4,lat4, outsidebounds = Returns the Point on the line perpendicular to the offset and whether the projection is outside the line

groundhog.general.parameter_mapping.latlon_distance(lon1, lat1, lon2, lat2)[source]

Calculates the offset in meters from two pairs of coordinates specified in longitude and latitude (WGS84)

Parameters:
  • lon1 – Longitude (easting) of the first point

  • lat1 – Latitude (northing) of the first point

  • lon2 – Longitude (easting) of the second point

  • lat2 – Latitude (northing) of the second point

Returns:

distance in meters

groundhog.general.parameter_mapping.map_depth_properties(target_df, layering_df, target_z_key=None, layering_zfrom_key=None, layering_zto_key=None)[source]

Maps properties defined in a dataframe with layers to a dataframe with nodal depth positions.

Note that numerical parameters in the layering dataframe should contain a unit between square brackets (e.g. ‘Friction angle [deg]’). String parameters don’t have the square brackets (e.g. ‘Soil type’). Do not use square brackets anywhere else in the column keys.

Note that if a node of the target dataframe corresponds to a layer change, the properties of the layer layer below the selected node are assigned.

Parameters:
  • target_df – Pandas dataframe to which the properties need to be mapped

  • layering_df – Pandas dataframe with the layering definition

  • target_z_key – Depth key in the target dataframe. If unspecified, ‘z [m]’ is used

  • layering_zfrom_key – Start depth key in the layering dataframe. If unspecified, ‘z from [m]’ is used

  • layering_zto_key – End depth key in the layering dataframe. If unspecified, ‘z to [m]’ is used

Returns:

groundhog.general.parameter_mapping.merge_two_dicts(x, y)[source]

Merges two dictionaries :param x: First dictionary :param y: Second dictionary :return: Updated dictionary

groundhog.general.parameter_mapping.offsets(startpoint, endpoint, point, latlon=False)[source]

Calculates the offset between a point and a line joining a given start- and endpoint. The offset from the projected point to the start and end point is also calculated. Through analytical calculations, the position of the point is also determined.

Parameters:
  • startpoint – Tuple with x and y coordinates of the starting point

  • endpoint – Tuple with x and y coordinates of the end point

  • point – Point for which the offset to the section needs to be computed

  • latlon – Boolean defining whether coordinates are specified in latitude/longitude (default=False)

Returns:

Dictionary with the following keys:

  • ’offset start to point’: Distance between start point and point of interest

  • ’offset end to point’: Distance between end point and point of interest

  • ’offset to line’: Offset between point and the line joining start and end point

  • ’offset to start projected’: Offset from the start point (negative is before the start point)

  • ’offset to end projected’: Offset from the end point (negative is behing the end point)

  • ’angle start [deg]’: Angle between line joining start and end point and line joining point and start point

  • ’angle end [deg]’: Angle between line joining start and end point and line joining point and end point

  • ’before start’: Boolean determining if point lies before the start point

  • ’behind end’: Boolean determining if point lies behind the end point

groundhog.general.parameter_mapping.reverse_dict(input_dict)[source]

Turn dictionary keys into values and values into keys :param input_dict: Dictionary with just 1 level :return: Dictionary with keys turned into values and vice-versa