-
Notifications
You must be signed in to change notification settings - Fork 18
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
Categorical color mapping #977
Conversation
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.
Various change requests / suggestions but only minor stuff, so approving since I don't need to see it again.
`"#RRGGBBAA"`. | ||
|
||
The `type` values are | ||
- `"node"`: control points are nodes of a continuous color gradient. |
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.
A "control point" is what was called a "control value" in the previous paragraph, right? If so I'd prefer to standardize on a single term.
cmap_norm: Color map normalisation. One of "lin" (linear), "log" | ||
(logarithmic), "cat" (categorical). |
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 instinctively want to introduce an enum, but I guess it's not worth it when we need the string representation to interface with the viewer anyway...
This service publishes its map layers via special URLs that | ||
contain an image tile's x- and y-coordinates and an optional zoom level z. | ||
|
||
**WTS Layer URL**: The URL of layer offered by a TMS. It must contain |
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.
**WTS Layer URL**: The URL of layer offered by a TMS. It must contain | |
**WMTS Layer URL**: The URL of layer offered by a WMTS. It must contain |
Co-authored-by: Pontus Lurcock <pontus.lurcock@brockmann-consult.de>
xcube server's tile API can now handle user-defined colormaps from xcube
viewer. Custom color bars are still passed using query parameter
cmap
toendpoint
/tiles/{datasetId}/{varName}/{z}/{y}/{x}
,but in the case of custom color bars it is a JSON-encoded object with the
following format:
{"name": <str>, "type": <str>, "colors": <list>}
. (User-defined color bars #975)The object properties are
name
: a unique name.type
: optional type of control values.colors
: a list of pairs[[<v1>,<c1>], [<v2>,<c2>], [<v3>,<c3>], ...]
that map a control value to a hexadecimal color value using CSS format
"#RRGGBBAA"
.The
type
values are"node"
: control points are nodes of a continuous color gradient."bound"
: control points form bounds that map to a color, which meansthe last color is unused.
"key"
: control points are keys (integers) that identify a color.xcube server's tile API now allows specifying the data normalisation step
before a color mapping is applied to the variable data to be visualized.
This affects endpoint
/tiles/{datasetId}/{varName}/{z}/{y}/{x}
and the WMTSAPI. The possible normalisation values are
lin
: linear mapping of data values betweenvmin
andvmax
to range 0 to 1(uses
matplotlib.colors.Normalize(vmin, vmax)
).log
: logarithmic mapping of data values betweenvmin
andvmax
to range 0 to 1(uses
matplotlib.colors.LogNorm(vmin, vmax)
).cat
: categorical mapping of data values into to indexes into the color mapping.(uses
matplotlib.colors.BoundaryNorm(categories)
). This normalisationcurrently only works with user-defined colormaps of type
key
orbound
(see above).The normalisation can be specified in three different ways (in order):
norm
passed to the tile endpoint.Norm
in theStyles/ColorMapping
element in xcube server configuration.color_norm
.The xcube viewer part of this PR is PR xcube-dev/xcube-viewer#338.
Checklist:
docs/source/*
CHANGES.md