Skip to content

Use a safe weed-detection buffer default - #250

Open
Renato L. de F. Cunha (renatolfc) wants to merge 1 commit into
microsoft:mainfrom
renatolfc:fix/issue-139-weed-buffer
Open

Use a safe weed-detection buffer default#250
Renato L. de F. Cunha (renatolfc) wants to merge 1 commit into
microsoft:mainfrom
renatolfc:fix/issue-139-weed-buffer

Conversation

@renatolfc

Copy link
Copy Markdown
Contributor

Weed detection defaults buffer to -50 in raster CRS units. For the WGS84 raster attached to #139, that means negative 50 degrees and collapses the boundary before rasterization.

This PR makes the generic default zero while preserving explicit projected-unit buffers. It also rejects a buffer that creates empty or invalid geometry before rasterization. A focused WGS84 regression covers both paths.

Closes #139.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adjusts the weed-detection op’s default boundary buffering to be safe for geographic (WGS84) rasters, avoiding negative-degree buffering that can collapse geometries and break rasterization. This aligns the op’s defaults with the intent that buffers are meaningful primarily in projected CRS units.

Changes:

  • Change the weed-detection op default buffer from -50 to 0.
  • Add a pre-rasterization validation step that rejects buffers producing empty/invalid geometries in the raster CRS.
  • Add a focused WGS84 regression test covering the new default and the invalid-buffer rejection path.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
ops/weed_detection/weed_detection.yaml Updates the default buffer parameter to 0 to avoid unsafe behavior in geographic CRS.
ops/weed_detection/weed_detection.py Validates buffered geometry before rasterization and reuses the buffered geometry for mask generation.
ops/weed_detection/test_weed_detection.py Adds regression coverage for WGS84 default buffer behavior and invalid-buffer error handling.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

Error with weed_detection workflow. Are there requirements for nput raster and boundary shapefile?

2 participants