Skip to content

Conversation

@nakul-py
Copy link
Contributor

@nakul-py nakul-py commented Aug 29, 2025

Description

Addresses #881

  • Currently, Color Ramp Type only supports Divergent colors such as balance, delta , curl, diff and tarn so other colormaps are still show type unknown. Enable users to set a min and max value and also get self-populated min max values for the colormap.
  • Also updates Color Ramp when user setted to reverse.

Bug Fix - This pr also fixes the selection of bands on SingleBand Pseudocolor


Checklist

  • PR has a descriptive title and content.
  • PR description contains references to any issues the PR resolves, e.g. Resolves #XXX.
  • PR has one of the labels: documentation, bug, enhancement, feature, maintenance
  • Checks are passing.
    Failing lint checks can be resolved with:
    • pre-commit run --all-files
    • jlpm run lint

📚 Documentation preview: https://jupytergis--912.org.readthedocs.build/en/912/
💡 JupyterLite preview: https://jupytergis--912.org.readthedocs.build/en/912/lite

@github-actions
Copy link
Contributor

Binder 👈 Launch a Binder on branch nakul-py/jupytergis/divergent

@github-actions
Copy link
Contributor

github-actions bot commented Aug 29, 2025

Integration tests report: appsharing.space

@nakul-py nakul-py changed the title Wip: Supporting divergent colomaps with critical value Supporting divergent colomaps with critical value Sep 2, 2025
@nakul-py nakul-py marked this pull request as ready for review September 2, 2025 12:16
Copy link
Contributor Author

@nakul-py nakul-py left a comment

Choose a reason for hiding this comment

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

cmocean's "balance" is cool :)

@mfisher87 mfisher87 added the enhancement New feature or request label Sep 3, 2025
Copy link
Member

@mfisher87 mfisher87 left a comment

Choose a reason for hiding this comment

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

Hey Nakul! This looks really good so far! I have some thoughts on the implementation details, most importantly around saving the min & max into the project file as symbologyState.min, symbologyState.max and updating singleband pseudocolor (for raster data) to share the same behavior. We can definitely share a common component!

@mfisher87 mfisher87 changed the title Supporting divergent colomaps with critical value Support divergent color ramps Sep 3, 2025
@mfisher87 mfisher87 requested a review from arjxn-py September 3, 2025 16:13
@nakul-py nakul-py marked this pull request as draft September 5, 2025 08:53
@nakul-py nakul-py marked this pull request as ready for review September 9, 2025 11:02
@nakul-py nakul-py requested a review from mfisher87 September 9, 2025 11:02
@mfisher87
Copy link
Member

Hey @nakul-py I'm a bit overwhelmed with interviewing folks for an internship program. I may be a bit delayed!

Co-authored-by: Nakul Verma <[email protected]>
Copy link
Member

@mfisher87 mfisher87 left a comment

Choose a reason for hiding this comment

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

Nakul and I worked on this together for a little bit today. Just leaving some thoughts we talked about -- I'll get to a more comprehensive review on Monday!

@mfisher87
Copy link
Member

cf7fe08 removes the min/max source input fields. But now the rendering is non-deterministic. Try clicking classify, then OK, then re-open symbology, re-classify, and click OK. The rendered data can look different each time.

@mfisher87
Copy link
Member

mfisher87 commented Oct 3, 2025

443d195 resolves the initialization of the OpenLayers Source object's min/max values from the symbology info. This is follow-on work resolving problems introduced in cf7fe08. We still need to initialize the symbology info from the file at initialization time (here, if symbologyState isn't defined, look at the data to find the min and max and save it into symbology state: https://github.com/nakul-py/jupytergis/blob/443d19524930b610859583a03f6d3f2f93d5b68a/packages/base/src/mainview/mainView.tsx#L798-L799)

@nakul-py
Copy link
Contributor Author

nakul-py commented Oct 4, 2025

4755f5e this commit fixes that we always get 0/100 fallback values as min/max. Now we got min/max from actual data.

@nakul-py
Copy link
Contributor Author

nakul-py commented Oct 7, 2025

Hey @mfisher87

9b55f00 (#912) This commit implement calculation logic for actual min/max values from maps raster data because some maps are very big So i have added some fallbacks so we can now get min/max values loaded in symbology in 5-25 seconds maximum instead of 3-4 minutes. I think now this can be the easiest and fastest way to calculate symbology.

@nakul-py nakul-py requested a review from mfisher87 October 7, 2025 10:28
@nakul-py nakul-py requested a review from mfisher87 October 13, 2025 08:45
) => void;
showModeRow: boolean;
showRampSelector: boolean;
renderType:
| 'Graduated'
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
| 'Graduated'
'Graduated'

Leading | doesn't do anything and can be omitted to avoid confusion

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I remove this but it regenerates while formatting unless it give lint error.

…g as expected

dataMin and dataMax should be attributes of the `source`, not the
layer/symbology. This only impacts performance, so let's punt it for
later.
These are different things! The data minimum and maximum are attributes
of the data, and symbology min/max are user preference.
let dataMax = image.fileDirectory.STATISTICS_MAXIMUM;

if (dataMin === undefined || dataMax === undefined) {
// 2. Try smallest overview if available
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// 2. Try smallest overview if available
// 2. Try smallest overview if available
// A consequence of this method is that we will almost never find the **true** minimum and maximum for the whole raster, as overviews are aggregate data, averaging groups of grid cells to calculate lower-resolution grid cells. However, calculating the minimum and maximum from the entire dataset may be prohibitively expensive on CPU and memory!

There's probably a better way to do this, but we don't need to solve that now. We just need to document the tradeoff we're making :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Singleband pseudocolor band selector doesn't respect user selection

2 participants