Skip to content

improve upscaling example#73

Merged
DirkEilander merged 1 commit intomainfrom
upscaling_example_output
Jul 16, 2025
Merged

improve upscaling example#73
DirkEilander merged 1 commit intomainfrom
upscaling_example_output

Conversation

@DirkEilander
Copy link
Copy Markdown
Contributor

Issue addressed

Fixes #72

Explanation

Explain how you addressed the bug/feature request, what choices you made and why.

Checklist

  • Updated tests or added new tests
  • Branch is up to date with main
  • Updated documentation if needed
  • Updated CHANGELOG.rst if needed

Additional Notes (optional)

Add any additional notes or information that may be helpful.

@DirkEilander DirkEilander requested a review from Copilot July 16, 2025 12:24
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Enhance the upscaling example notebook by adding steps to persist upscaled outputs, correct a typo, and align notebook metadata.

  • Added cells to save the upscaled flow direction raster and vector network files
  • Fixed spelling in a markdown comment ("contributing")
  • Updated notebook kernelspec display name and Python version in metadata
Comments suppressed due to low confidence (2)

examples/upscaling.ipynb:37

  • [nitpick] Consider renaming prof to profile for clarity and consistency with rasterio naming conventions.
    "    prof = src.profile\n",

examples/upscaling.ipynb:169

  • This cell references the variable s outside its original loop context, which may be undefined or only retain its last value. Wrap this save operation inside the same loop over s or explicitly define s to ensure files are named correctly for each scale.
    "with rasterio.open(f\"rhine_d8_upscale{s}.tif\", \"w\", **prof) as src:\n",

Comment thread examples/upscaling.ipynb
" width=flw1.shape[1],\n",
" height=flw1.shape[0],\n",
" transform=flw1.transform,\n",
" nodata=247,\n",
Copy link

Copilot AI Jul 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using a hard-coded nodata value like 247. Consider using the original dataset's nodata value (e.g., prof['nodata'] or src.nodata) to maintain consistency and avoid magic numbers.

Suggested change
" nodata=247,\n",
" nodata=prof.get('nodata', 247),\n",

Copilot uses AI. Check for mistakes.
@DirkEilander DirkEilander merged commit cba5715 into main Jul 16, 2025
2 checks passed
@DirkEilander DirkEilander deleted the upscaling_example_output branch July 16, 2025 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How to save upscaled flow direction data as a raster file

2 participants