mirror of
https://github.com/DOI-DO/j40-cejst-2.git
synced 2025-07-26 19:51:17 -07:00
Data directory should adopt standard Poetry-suggested python package structure (#457)
* Fixes #456 - Our data directory should adopt standard python package structure * a few missed references * updating readme * updating requirements * Running Black * Fixes for flake8 * updating pylint
This commit is contained in:
parent
4d7465c833
commit
c1568e87c0
61 changed files with 1273 additions and 1256 deletions
59
data/data-pipeline/data_pipeline/tile/generate.py
Normal file
59
data/data-pipeline/data_pipeline/tile/generate.py
Normal file
|
@ -0,0 +1,59 @@
|
|||
import os
|
||||
from pathlib import Path
|
||||
from subprocess import call
|
||||
|
||||
from data_pipeline.utils import get_module_logger, remove_all_from_dir
|
||||
|
||||
logger = get_module_logger(__name__)
|
||||
|
||||
|
||||
def generate_tiles(data_path: Path) -> None:
|
||||
|
||||
score_tiles_path = data_path / "score" / "tiles"
|
||||
high_tile_path = score_tiles_path / "high"
|
||||
low_tile_path = score_tiles_path / "low"
|
||||
score_geojson_dir = data_path / "score" / "geojson"
|
||||
|
||||
USA_HIGH_MIN_ZOOM = 5
|
||||
USA_HIGH_MAX_ZOOM = 11
|
||||
USA_LOW_MIN_ZOOM = 0
|
||||
USA_LOW_MAX_ZOOM = 7
|
||||
|
||||
# remove existing mbtiles file
|
||||
remove_all_from_dir(score_tiles_path)
|
||||
|
||||
# create dirs
|
||||
os.mkdir(high_tile_path)
|
||||
os.mkdir(low_tile_path)
|
||||
|
||||
# generate high mbtiles file
|
||||
logger.info("Generating USA High mbtiles file")
|
||||
cmd = "tippecanoe "
|
||||
cmd += f"--minimum-zoom={USA_HIGH_MIN_ZOOM} --maximum-zoom={USA_HIGH_MAX_ZOOM} --layer=blocks "
|
||||
cmd += f"--output={high_tile_path}/usa_high.mbtiles "
|
||||
cmd += str(score_geojson_dir / "usa-high.json")
|
||||
call(cmd, shell=True)
|
||||
|
||||
# generate high mvts
|
||||
logger.info("Generating USA High mvt folders and files")
|
||||
cmd = "tippecanoe "
|
||||
cmd += f"--minimum-zoom={USA_HIGH_MIN_ZOOM} --maximum-zoom={USA_HIGH_MAX_ZOOM} --no-tile-compression "
|
||||
cmd += f"--output-to-directory={high_tile_path} "
|
||||
cmd += str(score_geojson_dir / "usa-high.json")
|
||||
call(cmd, shell=True)
|
||||
|
||||
# generate low mbtiles file
|
||||
logger.info("Generating USA Low mbtiles file")
|
||||
cmd = "tippecanoe "
|
||||
cmd += f"--minimum-zoom={USA_LOW_MIN_ZOOM} --maximum-zoom={USA_LOW_MAX_ZOOM} --layer=blocks "
|
||||
cmd += f"--output={low_tile_path}/usa_low.mbtiles "
|
||||
cmd += str(score_geojson_dir / "usa-low.json")
|
||||
call(cmd, shell=True)
|
||||
|
||||
# generate low mvts
|
||||
logger.info("Generating USA Low mvt folders and files")
|
||||
cmd = "tippecanoe "
|
||||
cmd += f"--minimum-zoom={USA_LOW_MIN_ZOOM} --maximum-zoom={USA_LOW_MAX_ZOOM} --no-tile-compression "
|
||||
cmd += f"--output-to-directory={low_tile_path} "
|
||||
cmd += str(score_geojson_dir / "usa-low.json")
|
||||
call(cmd, shell=True)
|
Loading…
Add table
Add a link
Reference in a new issue