girs.feat.proc.get_thiessen_weights

get_thiessen_weights(point_shp, point_shp_id, polygon_shp, polygon_shp_id, valid_points=None, work_directory=None)

Create Thiessen weights of points in area

Thiessen polygons will be created with the given points and intersected with given polygons. The intersection areas divided by they corresponding polygon areas result the weights. The sum of the weights of a polygon is one.

This procedure will return a dictionary, where the key is the polygon_feat_code_field_name and the value is a list of dictionaries, which has a tuple(date_from, date_to) as key and a list of tuples (precip_feat_code_field_name, weight) as values. Depending on the input parameter valid_points, the key tuple may be (None, None).

This procedure can be used to determine for example the contribution of individual precipitation points in areas (e.g. watersheds) with different patterns of valid points for each time period (e.g. year)

Example 1: no time series for valid points

dict[polygon1] = dict1
dict1[(None,None)] = [(point1, 0.4), (point2, 0.4), (point3, 0.2)]
dict[polygon2] = dict2
dict2[(None,None)] = [(point1, 0.4), (point2, 0.4), (point3, 0.2)]

Example 2:

dict[polygon1] = dict1
dict1[(01.10.2000,30.09.2001)] = [(point1, 0.4), (point2, 0.4), (point3, 0.2)] dict1[(01.10.2001,30.09.2002)] = [(point1, 0.5), (point3, 0.5)] dict1[(01.10.2002,30.09.2003)] = [(point1, 0.4), (point2, 0.6)]
dict1[polygon2] = dict2
dict2[(01.10.2000,30.09.2001)] = [(point1, 0.4), (point3, 0.5), (point4, 0.1)] dict2[(01.10.2001,30.09.2002)] = [(point1, 0.45),(point3, 0.55)] dict2[(01.10.2002,30.09.2003)] = [(point1, 0.8), (point5, 0.2)]

The procedure includes the following steps:

  1. determination of Thiessen polygons
  2. intersection of Thiessen polygons with areas in polygon_shp
  3. determination of the weights of the intersections for each area. The weights of each area must sum up to one.
point_shp: full qualified name of the features used to create Thiessen
polygons. The geometry must be point
point_shp_id: name of the field containing unique record
values. It is recommended a user defined field instead of using feature IDs (FID). The field type must be number or string
polygon_shp: full qualified name of the features to be intersected with
the Thiessen polygon to calculate the weights by area
polygon_shp_id: name of the field containing unique record values.
Instead of using the features ID (FID), it is recommended a user defined field. The field type must be number or string
valid_points: Dictionary with tuple(datetime, datetime) as key and a list of field
values for point_shp_id representing valid records as values. The tuple(datetime, datetime) is intended to be set the validity of the results as tuple(date_from, date_to). If valid_points==None, all points will be used to create the Thiessen polygon, else only the points from the list. tuple(None, None) is also valid.
Parameters:
  • point_shp
  • point_shp_id
  • polygon_shp
  • polygon_shp_id
  • valid_points
  • work_directory
Returns: