Tools
maskmypy.tools
¶
checksum(gdf)
¶
Calculate SHA256 checksum of a GeoDataFrame and return the first 8 characters. Two completely identical GeoDataFrames will always return the exact same value, whereas two similar, but not completely identical GeoDataFrames will return entirely different values.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gdf |
GeoDataFrame
|
Any valid GeoDataFrame. |
required |
Returns:
Type | Description |
---|---|
str
|
The first 8 characters of the SHA256 checksum of the input GeoDataFrame. |
Source code in maskmypy/tools.py
gen_rng(seed=None)
¶
Create a seeded numpy default_rng() object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
seed |
int
|
An integer used to seed the random number generator. A seed is randomly generated using gen_seed() if one is not provided. |
None
|
Returns:
Type | Description |
---|---|
object
|
numpy.default_rng() |
Source code in maskmypy/tools.py
gen_seed()
¶
Generate a 16-digit random integer to seed random number generators.
Returns:
Type | Description |
---|---|
int
|
A 16 digit random integer. |
snap_to_streets(gdf)
¶
Relocates each point of a GeoDataFrame to the nearest node on the OpenStreetMap driving network. Performing this on masked datasets may reduce the chances of false attribution, and may provide an additional layer of obfuscation.
This is not an alternative to masking.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
gdf |
GeoDataFrame
|
A GeoDataFrame containing point data. |
required |
Returns:
Type | Description |
---|---|
GeoDataFrame
|
A GeoDataFrame containing points that have been snapped to street nodes. |