Skip to content

VZ deprecate raster class#77

Merged
katieb1 merged 18 commits intomainfrom
vz-deprecate-raster-class
Mar 18, 2026
Merged

VZ deprecate raster class#77
katieb1 merged 18 commits intomainfrom
vz-deprecate-raster-class

Conversation

@vickimzhang
Copy link
Collaborator

@vickimzhang vickimzhang commented Mar 16, 2026

  • remove raster.py class
  • remove datasheet_raster function
  • remove all references to raster class from init and test
  • remove rasterio from requirements and set up
  • update test library to 5 timesteps and 3 iterations, and updated backup after deleting current result scenarios
  • remove raster class and datasheet_raster from docs
  • removed raster class and datasheet_raster function from testing suite
  • remove raster class and datasheet_raster function from examples/spatial_demo.py
  • rerun all tests

Summary by CodeRabbit

  • Chores

    • Removed the package’s raster-focused API surface and corresponding generated API docs.
    • Removed the raster I/O dependency from installation.
  • Breaking Changes

    • Raster-related public functionality is no longer available; code relying on it will need to use file-path-based workflows.
  • Examples

    • Updated example(s) to read raster files directly from datasheet paths.
  • Tests

    • Removed raster-related tests.
  • Docs

    • Updated copyright year.

@coderabbitai
Copy link

coderabbitai bot commented Mar 16, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Removed the Raster module and Raster re-export, deleted Scenario.datasheet_rasters, removed rasterio from dependencies, deleted related autosummary docs, updated example/tests to open rasters directly (datasheet-driven approach).

Changes

Cohort / File(s) Summary
Documentation (autosummary)
docs/_autosummary/pysyncrosim.raster.Raster.__init__.rst, docs/_autosummary/pysyncrosim.raster.Raster.crs.rst, docs/_autosummary/pysyncrosim.raster.Raster.dimensions.rst, docs/_autosummary/pysyncrosim.raster.Raster.extent.rst, docs/_autosummary/pysyncrosim.raster.Raster.name.rst, docs/_autosummary/pysyncrosim.raster.Raster.resolution.rst, docs/_autosummary/pysyncrosim.raster.Raster.rst, docs/_autosummary/pysyncrosim.raster.Raster.source.rst, docs/_autosummary/pysyncrosim.raster.Raster.values.rst, docs/_autosummary/pysyncrosim.scenario.Scenario.rst, docs/module_summary.rst
Removed autosummary fragments for raster.Raster and Scenario.datasheet_rasters; deleted generated API snippets and removed Raster from module autosummary.
Raster module & package export
pysyncrosim/raster.py, pysyncrosim/__init__.py
Deleted pysyncrosim.raster (the Raster class) and stopped re-exporting Raster from package top-level.
Scenario implementation
pysyncrosim/scenario.py
Removed Scenario.datasheet_rasters method (method deleted).
Examples & tests
examples/spatial_demo.py, tests/test_pysyncrosim.py
Example migrated to direct rasterio usage and datasheet-driven filepaths; many Raster-related tests and assertions removed.
Dependencies / packaging
requirements.txt, setup.py
Removed rasterio from requirements.txt and setup.py install_requires; updated copyright year.
Misc
LICENSE, docs/conf.py
Updated copyright year to 2026 in LICENSE and docs/conf.py.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • katieb1

Poem

🐇
I hopped through code and nudged a seed,
One class hopped off — now datasheets lead.
Docs grew lighter, examples sing,
I nibble carrots and watch tests spring. 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'VZ deprecate raster class' accurately reflects the main objective of the PR, which is to remove/deprecate the Raster class and all related functionality from the codebase.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch vz-deprecate-raster-class
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
examples/spatial_demo.py (2)

167-191: ⚠️ Potential issue | 🟠 Major

Demo code below TODO is broken and will raise AttributeError at runtime.

datasheet_rasters now returns dictionaries with keys "rpath", "iteration", and "timestep" instead of Raster objects. The following calls will fail:

  • spatialRaster.values() → dicts have no .values() method that returns cell data
  • spatialRaster.source → dicts have no .source attribute (use spatialRaster["rpath"] instead)
  • spatialRasters[15].values() → same issue

Consider either completing the update now or commenting out the broken code to prevent confusion.

💡 Example of updated usage with new dict-based API
# Get raster path from dict
raster_path = spatialRaster["rpath"]

# Use rasterio directly (if reinstated as optional dependency)
with rasterio.open(raster_path) as raster:
    cell_values = raster.read()
    pyplot.imshow(cell_values[0])
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/spatial_demo.py` around lines 167 - 191, The demo code after the
TODO uses Raster instance methods/attrs but datasheet_rasters now returns dicts;
update the snippet to use the new dict-based API or remove/comment it: replace
uses of spatialRaster.values(), spatialRaster.source and
spatialRasters[15].values() with extracting the raster path via
spatialRaster["rpath"] (and spatialRasters[i]["rpath"]) and then open with
rasterio (e.g., with rasterio.open(spatialRaster["rpath"]) to read and
pyplot.imshow the band), or simply comment out the broken block until Raster
objects are reinstated; reference datasheet_rasters, spatialRaster,
spatialRasters, values(), and source when making the changes.

10-10: ⚠️ Potential issue | 🔴 Critical

rasterio import will fail at runtime since it's no longer a dependency.

The rasterio package was removed from setup.py and requirements.txt, so this import will raise ModuleNotFoundError when running the demo.

🐛 Proposed fix: Remove the import or update the demo
-import rasterio

Note: The TODO at line 167 acknowledges this file needs updating, but leaving a broken import in the codebase means the demo cannot be executed at all until it's fixed.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/spatial_demo.py` at line 10, Top-level import "import rasterio" will
raise ModuleNotFoundError because rasterio is no longer a dependency; remove
this import and either (A) remove or replace any code that uses rasterio in this
demo, or (B) make rasterio an optional dependency by moving the import into the
specific function(s) that need it and surrounding it with a try/except that
raises a clear runtime message instructing users to install rasterio if they
attempt to run that part. Update any functions referencing rasterio accordingly
so the module can be executed without rasterio installed (or fails with a clear
message when rasterio functionality is invoked).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tests/test_pysyncrosim.py`:
- Around line 15-16: Replace the hardcoded user-specific string assigned to
git_repo_path in tests/test_pysyncrosim.py with a portable resolution: read a
fallback from an environment variable (e.g., GIT_REPO_PATH) and if not set,
derive a path relative to the test file using the test module's location (e.g.,
Path(__file__).resolve().parent) so the test works on other machines and CI;
update any references/tests that use git_repo_path to accept the new resolution
method.

---

Outside diff comments:
In `@examples/spatial_demo.py`:
- Around line 167-191: The demo code after the TODO uses Raster instance
methods/attrs but datasheet_rasters now returns dicts; update the snippet to use
the new dict-based API or remove/comment it: replace uses of
spatialRaster.values(), spatialRaster.source and spatialRasters[15].values()
with extracting the raster path via spatialRaster["rpath"] (and
spatialRasters[i]["rpath"]) and then open with rasterio (e.g., with
rasterio.open(spatialRaster["rpath"]) to read and pyplot.imshow the band), or
simply comment out the broken block until Raster objects are reinstated;
reference datasheet_rasters, spatialRaster, spatialRasters, values(), and source
when making the changes.
- Line 10: Top-level import "import rasterio" will raise ModuleNotFoundError
because rasterio is no longer a dependency; remove this import and either (A)
remove or replace any code that uses rasterio in this demo, or (B) make rasterio
an optional dependency by moving the import into the specific function(s) that
need it and surrounding it with a try/except that raises a clear runtime message
instructing users to install rasterio if they attempt to run that part. Update
any functions referencing rasterio accordingly so the module can be executed
without rasterio installed (or fails with a clear message when rasterio
functionality is invoked).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0c294c27-87fe-44a2-9ede-2065c497548f

📥 Commits

Reviewing files that changed from the base of the PR and between c13cd5e and 6f126e8.

📒 Files selected for processing (18)
  • docs/_autosummary/pysyncrosim.raster.Raster.__init__.rst
  • docs/_autosummary/pysyncrosim.raster.Raster.crs.rst
  • docs/_autosummary/pysyncrosim.raster.Raster.dimensions.rst
  • docs/_autosummary/pysyncrosim.raster.Raster.extent.rst
  • docs/_autosummary/pysyncrosim.raster.Raster.name.rst
  • docs/_autosummary/pysyncrosim.raster.Raster.resolution.rst
  • docs/_autosummary/pysyncrosim.raster.Raster.rst
  • docs/_autosummary/pysyncrosim.raster.Raster.source.rst
  • docs/_autosummary/pysyncrosim.raster.Raster.values.rst
  • docs/module_summary.rst
  • examples/spatial_demo.py
  • pysyncrosim/__init__.py
  • pysyncrosim/raster.py
  • pysyncrosim/scenario.py
  • requirements.txt
  • setup.py
  • tests/spatial-example.ssimbak
  • tests/test_pysyncrosim.py
💤 Files with no reviewable changes (13)
  • requirements.txt
  • docs/_autosummary/pysyncrosim.raster.Raster.crs.rst
  • docs/module_summary.rst
  • docs/_autosummary/pysyncrosim.raster.Raster.name.rst
  • docs/_autosummary/pysyncrosim.raster.Raster.resolution.rst
  • docs/_autosummary/pysyncrosim.raster.Raster.init.rst
  • docs/_autosummary/pysyncrosim.raster.Raster.rst
  • pysyncrosim/init.py
  • docs/_autosummary/pysyncrosim.raster.Raster.values.rst
  • docs/_autosummary/pysyncrosim.raster.Raster.source.rst
  • docs/_autosummary/pysyncrosim.raster.Raster.extent.rst
  • docs/_autosummary/pysyncrosim.raster.Raster.dimensions.rst
  • pysyncrosim/raster.py

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@examples/spatial_demo.py`:
- Around line 157-158: Fix the typo in the inline comment that starts with "#
Get a raster (returns a dicionary with keys for the path "rpath"," by changing
"dicionary" to "dictionary"; locate the comment that mentions the keys "rpath",
"iteration", and "timestep" and update the spelling only (no logic/code
changes).
- Around line 168-171: The standalone expression `cell_values` is flagged as a
useless expression; update the raster read block using
`rasterio.open(spatialRaster["rpath"])` so that `cell_values` is either used or
explicitly displayed—either remove the bare expression, replace it with an
explicit `print(cell_values)` if you intend to show the values, or add a clear
comment (e.g., "# Intentional: show cell_values in interactive session") to
silence the linter while keeping the existing `cell_values` variable.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 94d1957d-226f-44fe-a7df-1369e7890427

📥 Commits

Reviewing files that changed from the base of the PR and between 6f126e8 and 4432cc5.

📒 Files selected for processing (1)
  • examples/spatial_demo.py

@vickimzhang vickimzhang requested a review from katieb1 March 16, 2026 21:33
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@examples/spatial_demo.py`:
- Around line 177-185: Implement a public datasheet_rasters method on the
Scenario class that validates inputs using __validate_datasheet_raster_inputs,
calls __retrieve_raster_column to fetch the raw raster column values, uses
__list_datasheet_rasters to resolve or copy files as needed, and returns a list
of dictionaries where each dict contains at least the "rpath" key pointing to
the local raster path; ensure the new Scenario.datasheet_rasters wraps the
existing helpers, accepts the same parameters used in the example (datasheet,
column), and raises or forwards validation errors when helpers indicate invalid
inputs.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 74c23a58-1b63-4091-9bf0-d95273cae959

📥 Commits

Reviewing files that changed from the base of the PR and between 4432cc5 and e61ccfc.

📒 Files selected for processing (2)
  • examples/spatial_demo.py
  • pysyncrosim/scenario.py
💤 Files with no reviewable changes (1)
  • pysyncrosim/scenario.py

Comment on lines +177 to +185
# Get multiple rasters in a list (returns a list of dicts)
spatialRasters = myResultsScenario.datasheet_rasters(
datasheet = "helloworldSpatial_IntermediateDatasheet",
column = "OutputRasterFile")

spatialRasters[15]

pyplot.imshow(spatialRasters[15].values(), cmap = "pink")
with rasterio.open(spatialRasters[15]["rpath"]) as raster:
pyplot.imshow(raster.read(1), cmap = "pink")
Copy link

@coderabbitai coderabbitai bot Mar 17, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify the public datasheet_rasters method exists and check its return type construction

# Search for the public datasheet_rasters method definition
echo "=== Searching for datasheet_rasters method definition ==="
ast-grep --pattern $'def datasheet_rasters($$$):
    $$$'

# Check how the method constructs its return value
echo ""
echo "=== Checking return statements in scenario.py ==="
rg -n -A 10 'def datasheet_rasters' --type py

Repository: syncrosim/pysyncrosim

Length of output: 173


🏁 Script executed:

# Search for datasheet_rasters in all files (not just method definitions)
echo "=== Searching for 'datasheet_rasters' in entire codebase ==="
rg -i "datasheet_rasters" --type py -n

# Check the example file to understand context
echo ""
echo "=== Checking examples/spatial_demo.py around lines 177-185 ==="
cat -n examples/spatial_demo.py | sed -n '170,190p'

Repository: syncrosim/pysyncrosim

Length of output: 3049


🏁 Script executed:

# Search for the method in scenario.py more broadly (may be property or use decorators)
echo "=== Searching in scenario.py for datasheet_rasters pattern ==="
rg -n "datasheet_rasters" pysyncrosim/scenario.py -B 3 -A 15

# Look for the Scenario class definition and its methods
echo ""
echo "=== Checking Scenario class structure ==="
rg -n "class Scenario" pysyncrosim/scenario.py -A 5

# Check if it's dynamically added or inherited
echo ""
echo "=== Checking imports and base classes in scenario.py ==="
head -50 pysyncrosim/scenario.py

Repository: syncrosim/pysyncrosim

Length of output: 2709


🏁 Script executed:

# Get the size of scenario.py
wc -l pysyncrosim/scenario.py

# Search for all method definitions in scenario.py
echo "=== All def statements in scenario.py ==="
rg -n "^\s*def " pysyncrosim/scenario.py

# Search for `@property` decorator before datasheet
echo ""
echo "=== Searching for property decorators in scenario.py ==="
rg -n "@property" pysyncrosim/scenario.py -A 1

Repository: syncrosim/pysyncrosim

Length of output: 2972


🏁 Script executed:

# Search for datasheet_rasters in all Python files in pysyncrosim package
echo "=== Searching entire pysyncrosim package for datasheet_rasters ==="
rg "def datasheet_rasters" pysyncrosim/ -n

# Also check if it's dynamically added or inherited
echo ""
echo "=== Checking __init__.py files ==="
find pysyncrosim -name "__init__.py" -exec grep -l "datasheet_rasters" {} \;

# List all Python files in pysyncrosim
echo ""
echo "=== Python files in pysyncrosim ==="
find pysyncrosim -name "*.py" -type f | head -20

Repository: syncrosim/pysyncrosim

Length of output: 416


🏁 Script executed:

# Check the test file to understand context of datasheet_rasters calls
echo "=== Test file context around datasheet_rasters ==="
rg -n "myResultsScenario" tests/test_pysyncrosim.py | head -20

# Get more context from test - what is myResultsScenario
echo ""
echo "=== Getting test context ==="
sed -n '925,960p' tests/test_pysyncrosim.py

# Check if method might be defined elsewhere or if it's genuinely missing
echo ""
echo "=== Complete grep for datasheet_rasters pattern ==="
grep -r "datasheet_rasters" pysyncrosim/ || echo "NOT FOUND IN PYSYNCROSIM"

Repository: syncrosim/pysyncrosim

Length of output: 3559


🏁 Script executed:

# Check if tests are skipped or marked as expected failures
echo "=== Checking if test_datasheet_rasters tests are skipped ==="
sed -n '930,1050p' tests/test_pysyncrosim.py | grep -E "@pytest|@skip|xfail|TODO"

# Check for any comments about implementation status
echo ""
echo "=== Searching for TODO/FIXME related to datasheet_rasters ==="
rg -i "todo|fixme" pysyncrosim/scenario.py | head -10

# Check git log to see if method was recently removed or planned
echo ""
echo "=== Checking for any implementation placeholders ==="
sed -n '800,850p' pysyncrosim/scenario.py

Repository: syncrosim/pysyncrosim

Length of output: 2678


🏁 Script executed:

# Let me check if there's a method stub or if it might be defined with a different pattern
echo "=== Searching for all public methods (not starting with __) in Scenario ==="
rg -n "^\s+def [a-z]" pysyncrosim/scenario.py | tail -20

# Check end of scenario.py to see if there's anything at the end
echo ""
echo "=== Last 50 lines of scenario.py ==="
tail -50 pysyncrosim/scenario.py

# Double-check: search for the exact method name in all files
echo ""
echo "=== Final search for datasheet_rasters definition ==="
find . -name "*.py" -type f -exec grep -l "def datasheet_rasters" {} \;

Repository: syncrosim/pysyncrosim

Length of output: 2691


The datasheet_rasters method is not implemented in the Scenario class.

This example code cannot work as written. The method datasheet_rasters is called on line 178 but does not exist in pysyncrosim/scenario.py. While helper methods like __validate_datasheet_raster_inputs, __retrieve_raster_column, and __list_datasheet_rasters are present, the public datasheet_rasters method that wraps these and returns a list of dictionaries with "rpath" keys is missing entirely. The code will fail at runtime with an AttributeError. This method needs to be implemented to make the example functional.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/spatial_demo.py` around lines 177 - 185, Implement a public
datasheet_rasters method on the Scenario class that validates inputs using
__validate_datasheet_raster_inputs, calls __retrieve_raster_column to fetch the
raw raster column values, uses __list_datasheet_rasters to resolve or copy files
as needed, and returns a list of dictionaries where each dict contains at least
the "rpath" key pointing to the local raster path; ensure the new
Scenario.datasheet_rasters wraps the existing helpers, accepts the same
parameters used in the example (datasheet, column), and raises or forwards
validation errors when helpers indicate invalid inputs.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed

Copy link

Choose a reason for hiding this comment

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
echo "=== Checking current state of examples/spatial_demo.py for datasheet_rasters ==="
grep -n "datasheet_rasters" examples/spatial_demo.py || echo "NOT FOUND in spatial_demo.py"

echo ""
echo "=== Current View spatial results section ==="
grep -n "datasheet_rasters\|spatialRaster\|rasterio\|rpath" examples/spatial_demo.py | head -30

Length of output: 786


🏁 Script executed:

#!/bin/bash
echo "=== Checking for datasheet_rasters definition in scenario.py ==="
grep -n "def datasheet_rasters\|datasheet_rasters" pysyncrosim/scenario.py | head -20

echo ""
echo "=== Checking all Python files in pysyncrosim for datasheet_rasters ==="
grep -rn "def datasheet_rasters" pysyncrosim/ || echo "NOT FOUND"

Length of output: 212


@vickimzhang, it looks like the issue is still present. The datasheet_rasters calls at lines 159 and 178 of examples/spatial_demo.py remain, but the public datasheet_rasters method is still not defined anywhere in pysyncrosim/scenario.py — only the private helper __list_datasheet_rasters exists (line 836). Running this example would still raise an AttributeError.

To clarify my original comment: the concern wasn't about the Raster class usage (which you've correctly removed), but about the missing public datasheet_rasters method that the example relies on.

You have two options to resolve this:

  1. Implement the public datasheet_rasters method in pysyncrosim/scenario.py that wraps the existing private helpers and returns a list of dicts with "rpath" keys (as the example expects).
  2. Remove or rewrite the spatial results section in examples/spatial_demo.py to not use datasheet_rasters if the method is being fully deprecated alongside the raster class.

Would you like me to help implement either approach?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

should be removed now

Copy link

Choose a reason for hiding this comment

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
echo "=== Checking current state of examples/spatial_demo.py for datasheet_rasters ==="
grep -n "datasheet_rasters\|spatialRaster\|rpath" examples/spatial_demo.py || echo "NOT FOUND in spatial_demo.py"

echo ""
echo "=== Checking for public datasheet_rasters definition in scenario.py ==="
grep -n "def datasheet_rasters" pysyncrosim/scenario.py || echo "NOT FOUND in scenario.py"

echo ""
echo "=== Checking full View spatial results section ==="
grep -n -A 2 -B 2 "spatial" examples/spatial_demo.py | tail -30

Length of output: 1638


@vickimzhang, the datasheet_rasters calls are still present in examples/spatial_demo.py (lines 159 and 178), and the public datasheet_rasters method is still not defined in pysyncrosim/scenario.py. The issue persists — running this example would still raise an AttributeError at runtime.

The two calls that remain:

  • Line 159: myResultsScenario.datasheet_rasters(datasheet="IntermediateDatasheet", column="OutputRasterFile", iteration=3, timestep=4)
  • Line 178: myResultsScenario.datasheet_rasters(datasheet="helloworldSpatial_IntermediateDatasheet", column="OutputRasterFile")

Could you either:

  1. Remove the entire "View spatial results" section (lines 155–186) from examples/spatial_demo.py if this functionality is being deprecated, or
  2. Implement the public datasheet_rasters method in pysyncrosim/scenario.py if it's still needed?

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/test_pysyncrosim.py (1)

7-7: ⚠️ Potential issue | 🔴 Critical

Remove unused rasterio import that will cause ImportError.

The PR removes rasterio from requirements and setup, but this import remains. Since all raster-related tests were deleted, this import is now unused and will cause tests to fail with ModuleNotFoundError once the dependency is removed.

🐛 Proposed fix
-import rasterio
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/test_pysyncrosim.py` at line 7, Remove the unused import of rasterio
from tests/test_pysyncrosim.py: delete the top-level "import rasterio" statement
so the test module no longer depends on the removed dependency; verify there are
no other references to rasterio in the file (e.g., functions or fixtures) and
run tests to ensure no missing imports remain.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@tests/test_pysyncrosim.py`:
- Line 7: Remove the unused import of rasterio from tests/test_pysyncrosim.py:
delete the top-level "import rasterio" statement so the test module no longer
depends on the removed dependency; verify there are no other references to
rasterio in the file (e.g., functions or fixtures) and run tests to ensure no
missing imports remain.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9566f28b-d5c8-4826-a398-8503469c2ed8

📥 Commits

Reviewing files that changed from the base of the PR and between e61ccfc and 90a20ad.

📒 Files selected for processing (3)
  • LICENSE
  • docs/_autosummary/pysyncrosim.scenario.Scenario.rst
  • tests/test_pysyncrosim.py
💤 Files with no reviewable changes (1)
  • docs/_autosummary/pysyncrosim.scenario.Scenario.rst
✅ Files skipped from review due to trivial changes (1)
  • LICENSE

Copy link
Member

@katieb1 katieb1 left a comment

Choose a reason for hiding this comment

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

Just 2 minor updates needed!

@vickimzhang vickimzhang requested a review from katieb1 March 17, 2026 23:40
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
docs/conf.py (1)

138-139: ⚠️ Potential issue | 🟡 Minor

Remove stale rasterio mock import from Sphinx config.

rasterio is still listed in autodoc_mock_imports (Line 138), which conflicts with the PR goal of removing raster/rasterio references.

Suggested diff
-autodoc_mock_imports = ['numpy', 'pandas', 'os', 're', 'io', 'tempfile',
-                        'shutil', 'rasterio', 'subprocess']
+autodoc_mock_imports = ['numpy', 'pandas', 'os', 're', 'io', 'tempfile',
+                        'shutil', 'subprocess']
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/conf.py` around lines 138 - 139, Remove the stale "rasterio" entry from
the autodoc_mock_imports list in the Sphinx config (the autodoc_mock_imports
symbol) so the project no longer mocks or references rasterio; update the
autodoc_mock_imports list to omit "rasterio" and keep the remaining imports
unchanged.
examples/spatial_demo.py (1)

10-11: ⚠️ Potential issue | 🔴 Critical

Add rasterio as an optional dependency or document the requirement.

The example script imports and uses rasterio at multiple points (lines 169–176, 183) to open and display raster data. However, rasterio has been removed from requirements.txt and setup.py and is not included in extras_require. Users running this example will encounter an ImportError.

Resolve by either:

  1. Adding rasterio to extras_require (e.g., "spatial": ["rasterio"]) to make it an optional dependency
  2. Adding a note in the example file or documentation that rasterio must be installed separately
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/spatial_demo.py` around lines 10 - 11, The example imports the
rasterio module (symbol: rasterio) but rasterio was removed from package
dependencies, so either add it as an optional dependency named "spatial" (e.g.,
in setup.py/pyproject extras_require add "spatial": ["rasterio"]) so users can
pip install it via extras, or update the example (spatial_demo.py) to document
the requirement by adding a top-of-file comment and/or a try/except around
"import rasterio" that raises a clear message instructing users to pip install
rasterio; implement one of these fixes and keep the import symbol rasterio
unchanged in the demo.
🧹 Nitpick comments (1)
examples/spatial_demo.py (1)

182-184: Consider clarifying or computing the index instead of hardcoding.

The index 15 is a magic number that assumes specific run parameters (5 iterations × 10 timesteps = 50 rasters). If someone modifies RunControl at lines 71-74, this could raise an IndexError.

Consider adding a brief comment explaining the choice, or computing the index dynamically:

# Access a specific raster (e.g., middle of the list)
idx = len(spatialRasters) // 2
with rasterio.open(spatialRasters[idx]) as raster:
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/spatial_demo.py` around lines 182 - 184, Replace the hardcoded index
15 when accessing spatialRasters to avoid IndexError if RunControl changes:
compute the desired index from the list (e.g., middle or a named selection)
using len(spatialRasters) and store it in a variable (referencing spatialRasters
and the rasterio.open usage) or at minimum add a clarifying comment explaining
why 15 is chosen so future changes to RunControl won’t break the access.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@examples/spatial_demo.py`:
- Around line 157-160: The call myResultsScenario.datasheet(...) uses a
non-existent method name; change it to
myResultsScenario.datasheets(name="helloworldSpatial_IntermediateDatasheet",
show_full_paths=True) so it matches the correct plural API used elsewhere (e.g.,
other calls around lines 150–151) and avoids the AttributeError at runtime.

---

Outside diff comments:
In `@docs/conf.py`:
- Around line 138-139: Remove the stale "rasterio" entry from the
autodoc_mock_imports list in the Sphinx config (the autodoc_mock_imports symbol)
so the project no longer mocks or references rasterio; update the
autodoc_mock_imports list to omit "rasterio" and keep the remaining imports
unchanged.

In `@examples/spatial_demo.py`:
- Around line 10-11: The example imports the rasterio module (symbol: rasterio)
but rasterio was removed from package dependencies, so either add it as an
optional dependency named "spatial" (e.g., in setup.py/pyproject extras_require
add "spatial": ["rasterio"]) so users can pip install it via extras, or update
the example (spatial_demo.py) to document the requirement by adding a
top-of-file comment and/or a try/except around "import rasterio" that raises a
clear message instructing users to pip install rasterio; implement one of these
fixes and keep the import symbol rasterio unchanged in the demo.

---

Nitpick comments:
In `@examples/spatial_demo.py`:
- Around line 182-184: Replace the hardcoded index 15 when accessing
spatialRasters to avoid IndexError if RunControl changes: compute the desired
index from the list (e.g., middle or a named selection) using
len(spatialRasters) and store it in a variable (referencing spatialRasters and
the rasterio.open usage) or at minimum add a clarifying comment explaining why
15 is chosen so future changes to RunControl won’t break the access.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 529f3502-7f2b-4811-8415-276e93132a3a

📥 Commits

Reviewing files that changed from the base of the PR and between 90a20ad and 8167014.

📒 Files selected for processing (3)
  • docs/conf.py
  • examples/spatial_demo.py
  • setup.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • setup.py

Copy link
Member

@katieb1 katieb1 left a comment

Choose a reason for hiding this comment

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

Looks good!

@katieb1 katieb1 merged commit 91e819d into main Mar 18, 2026
@katieb1 katieb1 deleted the vz-deprecate-raster-class branch March 18, 2026 19:51
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.

2 participants