-
Notifications
You must be signed in to change notification settings - Fork 59
Support divergent color ramps #912
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
base: main
Are you sure you want to change the base?
Conversation
Integration tests report: appsharing.space |
There was a problem hiding this 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 :)
There was a problem hiding this 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!
packages/base/src/dialogs/symbology/components/color_ramp/ColorRamp.tsx
Outdated
Show resolved
Hide resolved
packages/base/src/dialogs/symbology/components/color_ramp/ColorRamp.tsx
Outdated
Show resolved
Hide resolved
packages/base/src/dialogs/symbology/components/color_ramp/ColorRamp.tsx
Outdated
Show resolved
Hide resolved
packages/base/src/dialogs/symbology/components/color_ramp/ColorRamp.tsx
Outdated
Show resolved
Hide resolved
packages/base/src/dialogs/symbology/components/color_ramp/ColorRamp.tsx
Outdated
Show resolved
Hide resolved
packages/base/src/dialogs/symbology/components/color_ramp/ColorRamp.tsx
Outdated
Show resolved
Hide resolved
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 <nakulverma.py@gmail.com>
3a488a0
to
b478a85
Compare
Co-authored-by: Nakul Verma <nakulverma.py@gmail.com>
There was a problem hiding this 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!
const [selectedMode, setSelectedMode] = useState(''); | ||
const [numberOfShades, setNumberOfShades] = useState(''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not for this PR: These should be typed better! numberOfShades
should be number
and selectedMode
should be a union of string literals.
Co-authored-by: Yao-Ting Yao <94820616+YaoTingYao@users.noreply.github.com> Co-authored-by: Nakul Verma <173621577+nakul-py@users.noreply.github.com>
Co-authored-by: Yao-Ting Yao <94820616+YaoTingYao@users.noreply.github.com> Co-authored-by: Nakul Verma <173621577+nakul-py@users.noreply.github.com>
Co-authored-by: Yao-Ting Yao <94820616+YaoTingYao@users.noreply.github.com> Co-authored-by: Nakul Verma <173621577+nakul-py@users.noreply.github.com>
Co-authored-by: Yao-Ting Yao <94820616+YaoTingYao@users.noreply.github.com> Co-authored-by: Nakul Verma <173621577+nakul-py@users.noreply.github.com>
* Only display when in equal interval mode -- harder to calculate critical value in other modes * Dynamically calculate critical value instead of displaying 50% * Move under color ramp selector Co-authored-by: Yao-Ting Yao <94820616+YaoTingYao@users.noreply.github.com> Co-authored-by: Nakul Verma <173621577+nakul-py@users.noreply.github.com>
Co-authored-by: Yao-Ting Yao <94820616+YaoTingYao@users.noreply.github.com> Co-authored-by: Nakul Verma <173621577+nakul-py@users.noreply.github.com>
Reverse is successfully being loaded from the shared model, but not min/max :( Co-authored-by: Yao-Ting Yao <94820616+YaoTingYao@users.noreply.github.com> Co-authored-by: Nakul Verma <173621577+nakul-py@users.noreply.github.com>
…ngleBandPseudoColor components
Co-authored-by: Nakul Verma <173621577+nakul-py@users.noreply.github.com>
Thoughts on saving band-level min/max values: Should we use the state DB? Or should we use the shared document? (@martinRenou @arjxn-py @gjmooney would love your thoughts) I'm leaning towards the shared document. This would require some changes to the shared document schema. See Issue #946. This should not be part of this PR. It's mostly a performance concern. If the user clicks "Use actual range" and it looks at the data to find the min/max for the selected band at that time, it'd be a touch slower. But I think that's fine. For this PR: Remove the use of the global state DB and look at the data to find the dataMin/dataMax values for the "use actual range button". We'll make it faster later! We should also remove the |
Co-authored-by: Nakul Verma <173621577+nakul-py@users.noreply.github.com>
The symbology "OK" button sometimes doesn't work when manually changing the min and max. Changing the min and max again can re-enable the "OK" button. I'm not sure what the pattern is yet :) |
It was failing because symbologyState was not populated in the shared document at this point. Co-authored-by: Nakul Verma <173621577+nakul-py@users.noreply.github.com>
For singleband pseudocolor, the classification stops don't load on the 2nd, 3rd, etc. opens of the symbology menu. This is a pre-existing bug. Ignore this comment :) #947 |
return { | ||
...addNoData(sourceInfo), | ||
min: sourceInfo.min, | ||
max: sourceInfo.max, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this may be the difference in the rendering. We probably need to hook up the user's selected min/max values here. Testing...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! This fixes the problem: 5eb2a4c
Co-authored-by: Nakul Verma <173621577+nakul-py@users.noreply.github.com>
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. |
This data should come from symbology choices.
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) |
|
Description
Addresses #881
Currently, Color Ramp Type only supports Divergent colors such as
balance
,delta
,curl
,diff
andtarn
so other colormaps are still show type unknown. Enable users to set a minimum and maximum value for the colormap.Checklist
Resolves #XXX
.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