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

fix spatial variation of water level in rainfall example #108

Merged
merged 1 commit into from
Oct 10, 2022

Conversation

wang-boyu
Copy link
Member

Use scaled blue color to represent water level. The differences between cells are small so it may be hard to visualize the spatial variation.

Before the fix:

rainfall_example backup

Now:

rainfall_example

@codecov
Copy link

codecov bot commented Oct 9, 2022

Codecov Report

Base: 79.50% // Head: 79.50% // No change to project coverage 👍

Coverage data is based on head (92613a9) compared to base (a46ca04).
Patch has no changes to coverable lines.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #108   +/-   ##
=======================================
  Coverage   79.50%   79.50%           
=======================================
  Files           6        6           
  Lines         610      610           
  Branches       99       99           
=======================================
  Hits          485      485           
  Misses        108      108           
  Partials       17       17           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -19,7 +19,13 @@ def cell_portrayal(cell: LakeCell) -> Tuple[float, float, float, float]:
if cell.water_level == 0:
return cell.elevation, cell.elevation, cell.elevation, 1
else:
return 0, 0, 255, 1
# return scaled blue color for water level
return (
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this supposed to be a color gradient? I couldn't spot any noticeable gradient. What if you exaggerate the gradient further?

Copy link
Member Author

Choose a reason for hiding this comment

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

The screenshot was taken after 20 steps. Is it slightly better after 100 steps (or not)?

Screen Shot 2022-10-09 at 8 53 59 PM

I guess initially there may not be enough raindrops to make a difference.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. You probably need to add a comment explaining that an array returns a color gradient.

Copy link
Member Author

Choose a reason for hiding this comment

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

Something like the recent update?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not enough info. People are not likely to be aware that an array instead of a scalar means gradient.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm how about now

Copy link
Contributor

Choose a reason for hiding this comment

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

Huh it does mean a single color after all. I thought we have color varying across space, and within a cell. In https://github.com/projectmesa/mesa/blob/fed83543487f6834b172f3a7c88754733e12c539/examples/shape_example/shape_example/server.py#L18, if you specify 2 color in an array, it becomes a gradient of color within 1 portrayal.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks better, merging.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes sorry about the confusion 😅

@wang-boyu wang-boyu added this to the v0.4.0 milestone Oct 10, 2022
@rht rht merged commit e50d28b into projectmesa:main Oct 10, 2022
@wang-boyu wang-boyu deleted the fix/rainfall-example branch October 10, 2022 14:45
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