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

THREDDS 5.x: Add support for palettes returned by THREDDS GetMetadata call #6893

Open
sppigot opened this issue Sep 18, 2023 · 3 comments
Open
Assignees

Comments

@sppigot
Copy link
Contributor

sppigot commented Sep 18, 2023

At the moment TerriaJS correctly reads the available styles that can be used with a THREDDS WMS layer from the GetCapabilities document i.e. the <Style> elements embedded in the element. e.g.:

<Style>
     <Name>raster/default</Name>
     <Title>raster/default</Title>
     <Abstract>raster style, using the default palette. Available palettes can be found in the response to https://thredds.roam.im:443/thredds/wms/roam/292/breakertypes-reprojected.nc?request=GetMetadata&item=layerDetails&layerName=H_mean </Abstract>
     <LegendURL width="110" height="264">
       <Format>image/png</Format>
       <OnlineResource xlink:type="simple" xlink:href="https://thredds.roam.im:443/thredds/wms/roam/292/breakertypes-reprojected.nc?REQUEST=GetLegendGraphic&PALETTE=default&LAYERS=H_mean&STYLES=raster/default"/>
     </LegendURL>
</Style>

These styles appear as a drop down in the Layer info displayed in the workbench:

terriaworkbench

However the GetLegendGraphic URLs included in the <Style> elements specify the PALETTE as default. This means TerriaJS can only use the default palette to colour a THREDDS layer.

But the <Style> element also provides info on how to retrieve the list of palettes that can be used to style the layer. This is a THREDDS specific GetMetadata call (which conveniently returns JSON):

e.g. https://thredds.roam.im:443/thredds/wms/roam/292/breakertypes-reprojected.nc?request=GetMetadata&item=layerDetails&layerName=H_mean

Which returns:

{
    "scaleRange": [
        -50,
        50
    ],
    "categorical": false,
    "belowMinColor": "extend",
    "noDataColor": "extend",
    "downloadable": true,
    "datesWithData": {"2023": {"7": [
        3,
        4,
        5
    ]}},
    "continuousT": false,
    "bbox": [
        150.77268981933594,
        -22.654677426260164,
        150.80520629882812,
        -22.62298249999918
    ],
    "supportsProfiles": false,
    "palettes": [
        "default",
        "default-inv",
        "div-BrBG",
        "div-BrBG-inv",
        "div-BuRd",
        "div-BuRd-inv",
        "div-BuRd2",
        "div-BuRd2-inv",
        "div-PRGn",
        "div-PRGn-inv",
        "div-PiYG",
        "div-PiYG-inv",
        "div-PuOr",
        "div-PuOr-inv",
        "div-RdBu",
        "div-RdBu-inv",
        "div-RdGy",
        "div-RdGy-inv",
        "div-RdYlBu",
        "div-RdYlBu-inv",
        "div-RdYlGn",
        "div-RdYlGn-inv",
        "div-Spectral",
        "div-Spectral-inv",
        "psu-inferno",
        "psu-inferno-inv",
        "psu-magma",
        "psu-magma-inv",
        "psu-plasma",
        "psu-plasma-inv",
        "psu-viridis",
        "psu-viridis-inv",
        "seq-BkBu",
        "seq-BkBu-inv",
        "seq-BkGn",
        "seq-BkGn-inv",
        "seq-BkRd",
        "seq-BkRd-inv",
        "seq-BkYl",
        "seq-BkYl-inv",
        "seq-BlueHeat",
        "seq-BlueHeat-inv",
        "seq-Blues",
        "seq-Blues-inv",
        "seq-BuGn",
        "seq-BuGn-inv",
        "seq-BuPu",
        "seq-BuPu-inv",
        "seq-BuYl",
        "seq-BuYl-inv",
        "seq-GnBu",
        "seq-GnBu-inv",
        "seq-Greens",
        "seq-Greens-inv",
        "seq-Greys",
        "seq-Greys-inv",
        "seq-GreysRev",
        "seq-GreysRev-inv",
        "seq-Heat",
        "seq-Heat-inv",
        "seq-OrRd",
        "seq-OrRd-inv",
        "seq-Oranges",
        "seq-Oranges-inv",
        "seq-PuBu",
        "seq-PuBu-inv",
        "seq-PuBuGn",
        "seq-PuBuGn-inv",
        "seq-PuRd",
        "seq-PuRd-inv",
        "seq-Purples",
        "seq-Purples-inv",
        "seq-RdPu",
        "seq-RdPu-inv",
        "seq-Reds",
        "seq-Reds-inv",
        "seq-YlGn",
        "seq-YlGn-inv",
        "seq-YlGnBu",
        "seq-YlGnBu-inv",
        "seq-YlOrBr",
        "seq-YlOrBr-inv",
        "seq-YlOrRd",
        "seq-YlOrRd-inv",
        "seq-cubeYF",
        "seq-cubeYF-inv",
        "x-Ncview",
        "x-Ncview-inv",
        "x-Occam",
        "x-Occam-inv",
        "x-Rainbow",
        "x-Rainbow-inv",
        "x-Sst",
        "x-Sst-inv"
    ],
    "units": "m",
    "numColorBands": 250,
    "supportedStyles": [
        "default-scalar",
        "colored_contours",
        "contours",
        "raster"
    ],
    "timeAxisUnits": "ISO8601",
    "defaultPalette": "x-Rainbow",
    "queryable": true,
    "supportsTimeseries": true,
    "nearestTimeIso": "2023-08-05T11:00:00.000Z",
    "aboveMaxColor": "extend",
    "noPaletteStyles": ["contours"],
    "supportsTransects": true,
    "logScaling": false
}

Included in this information is a 'defaultPalette' key that the THREDDS admin can set for the layer.

It would be great if:

  • the list of Palettes returned by this call could be displayed as a drop down in the workbench labelled as 'Palettes:'
  • TerriaJS would respect the 'defaultPalette' and 'scaleRange' information returned by the GetMetadata call. (As regards 'scaleRange', this information needs to be specified in the TerriaJS catalog item using 'colorScaleMinimum' and 'colorScaleMaximum' and our THREDDS server might not be respecting our rules for this, however TerriaJS should be able to use whatever GetMetadata returns)
@nf-s nf-s self-assigned this Oct 11, 2023
@nf-s
Copy link
Contributor

nf-s commented Dec 1, 2023

I believe this is a duplicate of

@nf-s nf-s assigned sixlighthouses and unassigned nf-s Jan 9, 2024
@AnaBelgun
Copy link
Member

Check "model dimensions" in github repo to see examples of selectable multiple dimensions

@sixlighthouses
Copy link
Contributor

Draft PR
#7059

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

No branches or pull requests

4 participants