Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

215 roughness update defaults #265

Merged
merged 9 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/autoblack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ jobs:
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git checkout $GITHUB_HEAD_REF
git commit -am "fixup: Format Python code with Black"
git push
git push
26 changes: 9 additions & 17 deletions .github/workflows/update_pages.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
name: Deploy Sphinx documentation to Pages

name: Pages
on:
push:
branches:
- main
branches: [main] # branch to trigger deployment

jobs:
build:
pages:
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v2
- id: deployment
uses: sphinx-notes/pages@v3
with:
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo

- name: Build and Commit
uses: sphinx-notes/pages@master
with:
documentation_path: docs

- name: Push changes
uses: ad-m/github-push-action@master
publish: false
- uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
publish_dir: ${{ steps.deployment.outputs.artifact }}
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "geofabrics"
version = "1.1.21"
version = "1.1.22"
description = "A package for creating geofabrics for flood modelling."
readme = "README.md"
authors = [{ name = "Rose pearson", email = "[email protected]" }]
Expand Down
23 changes: 23 additions & 0 deletions src/geofabrics/dem.py
Original file line number Diff line number Diff line change
Expand Up @@ -2715,6 +2715,29 @@ def add_lidar(
self._dem = self._dem.where(mask)
self._write_netcdf_conventions_in_place(self._dem, self.catchment_geometry.crs)

def add_roads(self, roads_polygon: dict):
"""Set roads to paved and unpaved roughness values.

Parameters
----------

roads_polygon
Dataframe with polygon and associated roughness values
"""


# Set unpaved roads
mask = clip_mask(
self._dem.z, roads_polygon[roads_polygon["surface"]=="unpaved"].geometry, self.chunk_size
)
self._dem["zo"] = self._dem.zo.where(~mask, self.default_values["unpaved"])
# Then set paved roads
mask = clip_mask(
self._dem.z, roads_polygon[roads_polygon["surface"]=="paved"].geometry, self.chunk_size
)
self._dem["zo"] = self._dem.zo.where(~mask, self.default_values["paved"])
self._write_netcdf_conventions_in_place(self._dem, self.catchment_geometry.crs)

def _add_tiled_lidar_chunked(
self,
lidar_datasets_info: dict,
Expand Down
Loading
Loading