nptscot / npt

Data processing code, also use this repo for issue tracking for the Network Planning Tool. See https://nptscot.github.io for development version
https://www.npt.scot/
GNU Affero General Public License v3.0
5 stars 0 forks source link

full build july relocatefile #521

Closed wangzhao0217 closed 2 months ago

wangzhao0217 commented 3 months ago
Robinlovelace commented 2 months ago

Here's the code I wrote for debugging:

The aim of the code in this document is to test the DataZones files, starting with the v2024-07-02 release. Get that with:

#| eval: false
cd outputdata
gh release download v2024-07-02 --clobber

The code above automatically downloads the data from this release: https://github.com/nptscot/outputdata/releases/tag/v2024-07-02

Let's unzip the zip file:

data_zones_zip_file = "outputdata/DataZone_json.zip"
file.exists(data_zones_zip_file)
data_zones_exdir = "outputdata/DataZone_2024-07-02"
unzip(data_zones_zip_file, exdir = data_zones_exdir)
data_zone_files = list.files(data_zones_exdir, full.names = TRUE)
length(data_zone_files) # 770, too few?

Let's load the zones data to find out which zones are missing:

library(targets)
tar_load(zones)
library(sf)
library(tidyverse)
zones |>
  sf::st_geometry() |>
  plot()
nrow(zones) # 2837 for Glasgow