All changes
This commit is contained in:
parent
593f380581
commit
49f7ec2f5a
60 changed files with 1783 additions and 679 deletions
|
|
@ -45,7 +45,7 @@ def main() -> None:
|
|||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
with tempfile.TemporaryDirectory(delete=False) as cache_dir:
|
||||
with tempfile.TemporaryDirectory() as cache_dir:
|
||||
cache = Path(cache_dir)
|
||||
zip_path = cache / "broadband_performance.zip"
|
||||
extract_dir = cache / "extracted"
|
||||
|
|
@ -53,7 +53,6 @@ def main() -> None:
|
|||
|
||||
download(PERFORMANCE_URL, zip_path)
|
||||
extract_zip(zip_path, extract_dir)
|
||||
print(list((extract_dir / "202507_fixed_coverage_r01").glob("*")))
|
||||
extract_zip(
|
||||
extract_dir
|
||||
/ "202507_fixed_coverage_r01"
|
||||
|
|
|
|||
|
|
@ -14,19 +14,7 @@ from tqdm import tqdm
|
|||
|
||||
from .pois import UK_BBOX_EAST, UK_BBOX_NORTH, UK_BBOX_SOUTH, UK_BBOX_WEST
|
||||
|
||||
PLACE_TYPES = {
|
||||
"city",
|
||||
# "borough",
|
||||
# "town",
|
||||
# "suburb",
|
||||
# "quarter",
|
||||
# "neighbourhood",
|
||||
# "village",
|
||||
# "hamlet",
|
||||
# "locality",
|
||||
# "island",
|
||||
# "isolated_dwelling",
|
||||
}
|
||||
PLACE_TYPES = {"city"}
|
||||
|
||||
# Suffixes to strip from raw station names before appending the typed suffix.
|
||||
_STATION_STRIP = (
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ def _build(
|
|||
.rename(
|
||||
{
|
||||
"date_of_transfer": "Date of last transaction",
|
||||
"construction_age_band": "Construction age",
|
||||
"construction_age_band": "Construction year",
|
||||
"is_construction_date_approximate": "Is construction date approximate",
|
||||
"pp_address": "Address per Property Register",
|
||||
"epc_address": "Address per EPC",
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ from collections import defaultdict
|
|||
|
||||
import numpy as np
|
||||
from scipy.spatial import Voronoi
|
||||
from scipy.spatial.qhull import QhullError
|
||||
from shapely import make_valid
|
||||
from shapely.geometry import MultiPolygon, Polygon
|
||||
from shapely.ops import unary_union
|
||||
|
|
@ -67,7 +68,7 @@ def compute_voronoi_regions(
|
|||
|
||||
try:
|
||||
vor = Voronoi(all_points)
|
||||
except Exception:
|
||||
except (ValueError, QhullError):
|
||||
# Fallback: split boundary equally among all postcodes present
|
||||
all_pcs = list(dict.fromkeys(unique_pcs))
|
||||
if len(all_pcs) == 1:
|
||||
|
|
|
|||
|
|
@ -8,10 +8,14 @@ Source: Ordnance Survey GeoSure (Open Data)
|
|||
"""
|
||||
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
|
||||
import numpy as np
|
||||
import polars as pl
|
||||
from pathlib import Path
|
||||
import shapefile as shp
|
||||
from pyproj import Transformer
|
||||
from shapely import STRtree, points
|
||||
from shapely.geometry import shape as to_shapely
|
||||
|
||||
_GEOSURE_RISKS = [
|
||||
("CollapsibleDeposits", "collapsible_deposits_risk"),
|
||||
|
|
@ -25,11 +29,6 @@ _GEOSURE_RISKS = [
|
|||
|
||||
def transform(geosure_dir: Path, arcgis_path: Path) -> pl.DataFrame:
|
||||
"""Spatial-join GeoSure 5km hex grid risk data to postcode centroids."""
|
||||
import shapefile as shp
|
||||
from pyproj import Transformer
|
||||
from shapely import STRtree, points
|
||||
from shapely.geometry import shape as to_shapely
|
||||
|
||||
to_wgs84 = Transformer.from_crs("EPSG:27700", "EPSG:4326", always_xy=True)
|
||||
|
||||
print("Loading postcode centroids for GeoSure join...")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue