Skip to content

Commit

Permalink
Merge branch 'main' into precipitation-planetary
Browse files Browse the repository at this point in the history
  • Loading branch information
barneydobson authored Dec 2, 2024
2 parents 4aad843 + ffb465a commit b981943
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ repos:
- id: check-merge-conflict
- id: debug-statements
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.7.4"
rev: "v0.8.0"
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand All @@ -17,7 +17,7 @@ repos:
additional_dependencies:
[types-requests, types-PyYAML]
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.42.0
rev: v0.43.0
hooks:
- id: markdownlint
args: ["--disable", "MD013", "--disable", "MD025", "--"]
Expand Down
12 changes: 8 additions & 4 deletions src/swmmanywhere/prepare_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import rioxarray.merge as rxr_merge
import xarray as xr
from geopy.geocoders import Nominatim
from packaging.version import Version
from pyarrow import RecordBatchReader
from pyarrow.compute import field
from pyarrow.dataset import dataset
Expand Down Expand Up @@ -153,8 +154,9 @@ def download_street(
nx.MultiDiGraph: Street network with type drive and
``truncate_by_edge set`` to True.
"""
west, south, east, north = bbox
bbox = (north, south, east, west) # not sure why osmnx uses this order
if Version(ox.__version__) < Version("2.0.0b1"):
west, south, east, north = bbox
bbox = (north, south, east, west)
graph = ox.graph_from_bbox(
bbox=bbox, network_type=network_type, truncate_by_edge=True
)
Expand All @@ -172,10 +174,12 @@ def download_river(bbox: tuple[float, float, float, float]) -> nx.MultiDiGraph:
nx.MultiDiGraph: River network with type waterway and
``truncate_by_edge set`` to True.
"""
west, south, east, north = bbox
try:
if Version(ox.__version__) < Version("2.0.0b1"):
west, south, east, north = bbox
bbox = (north, south, east, west)
graph = ox.graph_from_bbox(
bbox=(north, south, east, west),
bbox=bbox,
truncate_by_edge=True,
custom_filter='["waterway"]',
retain_all=True,
Expand Down

0 comments on commit b981943

Please sign in to comment.