File: __init__.py

package info (click to toggle)
python-momepy 0.8.1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 51,428 kB
  • sloc: python: 11,098; makefile: 35; sh: 11
file content (26 lines) | stat: -rw-r--r-- 695 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from pathlib import Path

__all__ = ["available", "get_path"]

_module_path = Path(__file__).resolve().parent
available = ["bubenec", "tests", "nyc_graph"]


def get_path(dataset, extension="gpkg"):
    """
    Get the path to the data file.
    Parameters
    ----------
    dataset : str
        The name of the dataset. See ``momepy.datasets.available`` for
        all options.
    extension : str
        The extension of the data file
    """
    if dataset in available:
        return str(_module_path / (f"{dataset}.{extension}"))
    msg = (
        f"The dataset {dataset!r} is not available. "
        f"Available datasets are {', '.join(available)}"
    )
    raise ValueError(msg)