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

add model parameter in RasterLayer class method #240

Merged
merged 1 commit into from
Sep 2, 2024

Conversation

wang-boyu
Copy link
Member

Fix #236 as mentioned in #236 (comment)

@wang-boyu wang-boyu added the bug Release notes label label Sep 1, 2024
Copy link

codecov bot commented Sep 1, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 78.32%. Comparing base (ce501b6) to head (488c1cf).
Report is 34 commits behind head on main.

Files with missing lines Patch % Lines
mesa_geo/raster_layers.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #240      +/-   ##
==========================================
+ Coverage   78.21%   78.32%   +0.11%     
==========================================
  Files          10        9       -1     
  Lines         693      766      +73     
  Branches      151      173      +22     
==========================================
+ Hits          542      600      +58     
- Misses        127      131       +4     
- Partials       24       35      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@EwoutH
Copy link
Member

EwoutH commented Sep 1, 2024

Thanks for the fix. Could you check against one of the examples if this fixes the issue? I can remember doing something like this but it still not working out.

@wang-boyu
Copy link
Member Author

It's a bit difficult to test - we removed old visualization in #212. When latest mesa-geo is installed, gis example throws errors for visualization module.

If I remove all visualizations in the rainfall example and add some print statements in RasterLayer's constructor, this is what I get before this fix:

RasterLayer.__init__
width: 285, height: 143, crs: None, total_bounds: [-122.26638888878, 42.855833333, -121.94972222209202, 43.01472222189958]
model: <class 'rainfall.space.LakeCell'>, cell_cls: <class 'mesa_geo.raster_layers.Cell'>

and after this fix (also need to fix the example by adding self.model when creating raster layer from file):

RasterLayer.__init__
width: 285, height: 143, crs: None, total_bounds: [-122.26638888878, 42.855833333, -121.94972222209202, 43.01472222189958]
model: <rainfall.model.Rainfall object at 0x12239a7e0>, cell_cls: <class 'rainfall.space.LakeCell'>

Copy link
Member

@EwoutH EwoutH left a comment

Choose a reason for hiding this comment

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

Thanks. We can merge first and see if it’s sufficient to update the examples.

@EwoutH EwoutH merged commit 5fb2dde into projectmesa:main Sep 2, 2024
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Release notes label
Projects
None yet
2 participants