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: raster import and TimeSeriesMap rendering issues #5416

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

sudhanshu112233shukla
Copy link

Resolved raster import failure and corrected TimeSeriesMap rendering by handling dataset accessibility and granularity errors. Closes #5304 .

@github-actions github-actions bot added temporal Related to temporal data processing Python Related code is in Python libraries module tests Related to Test Suite notebook labels Mar 19, 2025
@sudhanshu112233shukla sudhanshu112233shukla changed the title Fix raster import and TimeSeriesMap rendering issues fix: raster import and TimeSeriesMap rendering issues Mar 19, 2025
@petrasovaa
Copy link
Contributor

I tested it, but it doesn't help. I think this will need larger changes.

@sudhanshu112233shukla
Copy link
Author

@petrasovaa can you guide me , or give me some overview I will try my best to solve this.

@petrasovaa
Copy link
Contributor

TimeSeriesMap and SeriesMap were written separately and then later we created a BaseSeriesMap because they have a lot in common. But that was not done entirely correctly, some of the TSM structures are different then the SM, which is somehow causing the bug. So I would look at the rendering commands when they are called.

Choose a reason for hiding this comment

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

@petrasovaa test it ma'am .

Copy link
Contributor

Choose a reason for hiding this comment

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

Please fix the formatting issue first. I am not convinced this will work, could you post here a quick screencast showing TimeSeriesMap and SeriesMap example with your changes? We have example notebooks in doc/examples/notebooks

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

ruff

[ruff] reported by reviewdog 🐶

@@ -28,7 +28,8 @@
from .utils import get_number_of_cores, save_gif



Copy link
Contributor

Choose a reason for hiding this comment

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

[ruff] reported by reviewdog 🐶

Suggested change

@@ -98,13 +99,30 @@
self._base_calls.append((grass_module, kwargs))

return wrapper

Copy link
Contributor

Choose a reason for hiding this comment

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

[ruff] reported by reviewdog 🐶

Suggested change

Comment on lines +106 to +107
self._layers_rendered = False # Force re-render

Copy link
Contributor

Choose a reason for hiding this comment

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

[ruff] reported by reviewdog 🐶

Suggested change
self._layers_rendered = False # Force re-render
self._layers_rendered = False # Force re-render

def _apply_overlays(self, img):
"""Apply overlay commands (d.vect, d.barscale) to map instance"""
for grass_module, kwargs in self._base_calls:
img.run(grass_module, **kwargs)
Copy link
Contributor

Choose a reason for hiding this comment

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

[ruff] reported by reviewdog 🐶

Suggested change
img.run(grass_module, **kwargs)
img.run(grass_module, **kwargs)

Comment on lines +122 to +124
img.d_legend(**self._legend)


Copy link
Contributor

Choose a reason for hiding this comment

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

[ruff] reported by reviewdog 🐶

Suggested change
img.d_legend(**self._legend)
img.d_legend(**self._legend)


# Create instance
precip_map = TimeSeriesMap(use_region=True)

Copy link
Contributor

Choose a reason for hiding this comment

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

[ruff] reported by reviewdog 🐶

Suggested change


# Add raster series
precip_map.add_raster_series("precip_sum_2018")

Copy link
Contributor

Choose a reason for hiding this comment

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

[ruff] reported by reviewdog 🐶

Suggested change

precip_map.d_vect(map="boundary_country", fill_color="none")
precip_map.d_barscale()
precip_map.d_legend(color="black", at=(10, 40, 2, 6))

Copy link
Contributor

Choose a reason for hiding this comment

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

[ruff] reported by reviewdog 🐶

Suggested change


# Render frames (headless)
precip_map.render()

Copy link
Contributor

Choose a reason for hiding this comment

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

[ruff] reported by reviewdog 🐶

Suggested change

# Verify layers
assert precip_map._layers is not None, "No layers loaded"
assert len(precip_map._layers) > 0, "Layers list is empty"

Copy link
Contributor

Choose a reason for hiding this comment

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

[ruff] reported by reviewdog 🐶

Suggested change

Copy link
Contributor

Choose a reason for hiding this comment

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

[ruff] reported by reviewdog 🐶

Copy link
Contributor

Choose a reason for hiding this comment

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

[ruff] reported by reviewdog 🐶

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libraries module notebook Python Related code is in Python temporal Related to temporal data processing tests Related to Test Suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] grass.jupyter.TimeSeriesMap incorrect layer rendering
3 participants