Skip to content

Commit

Permalink
Merge pull request #2401 from eurodatacube/reccap-layercontrol-xcube
Browse files Browse the repository at this point in the history
Enable colormap and value stretch selection for RECCAP2 amazon data cube data
  • Loading branch information
lubojr authored Nov 23, 2023
2 parents 0043517 + 85f3266 commit 856bbec
Show file tree
Hide file tree
Showing 6 changed files with 203 additions and 61 deletions.
118 changes: 59 additions & 59 deletions app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
"dependencies": {
"@chenfengyuan/vue-countdown": "^1.1.5",
"@eox/layercontrol": "^0.9.0",
"@eox/layercontrol": "^0.11.1",
"@turf/difference": "^6.5.0",
"axios": "^0.21.1",
"chart.js": "2.9.3",
Expand Down
1 change: 1 addition & 0 deletions app/src/components/map/LayerControl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<eox-layercontrol
:for="'#' + mapId "
:titleProperty.prop="'name'"
:tools.prop="['config', 'opacity', 'sort']"
class="pointerEvents">
</eox-layercontrol>
</v-card>
Expand Down
1 change: 1 addition & 0 deletions app/src/components/map/layers.js
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,7 @@ export function createLayerFromConfig(config, map, _options = {}) {
minZoom: typeof config.minZoom !== 'undefined' ? config.minZoom : 1,
visible: config.visible,
layerControlOptional: config.layerControlOptional,
layerConfig: config.layerConfig,
});
if (config.drawnAreaLimitExtent || config?.features?.drawnAreaLimitExtent) {
const areaUpdate = (time, drawnArea, configUpdate, l) => {
Expand Down
109 changes: 109 additions & 0 deletions app/src/config/layers.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,112 @@ export const overlayLayers = Object.freeze({
},
},
});

export const xcubeViewerColormaps = [
'magma',
'inferno',
'plasma',
'viridis',
'cividis',
'Blues',
'BuGn',
'BuPu',
'GnBu',
'Greens',
'Greys',
'OrRd',
'Oranges',
'PuBu',
'PuBuGn',
'PuRd',
'Purples',
'RdPu',
'Reds',
'YlGn',
'YlGnBu',
'YlOrBr',
'YlOrRd',
'Wistia',
'afmhot',
'autumn',
'binary',
'bone',
'cool',
'copper',
'gist_gray',
'gist_heat',
'gist_yarg',
'gray',
'hot',
'pink',
'spring',
'summer',
'winter',
'BrBG',
'PRGn',
'PiYG',
'PuOr',
'RdBu',
'RdGy',
'RdYlBu',
'RdYlGn',
'Spectral',
'bwr',
'coolwarm',
'seismic',
'Accent',
'Dark2',
'Paired',
'Pastel1',
'Pastel2',
'Set1',
'Set2',
'Set3',
'tab10',
'tab20',
'tab20b',
'tab20c',
'twilight',
'twilight_shifted',
'hsv',
'reg_map',
'thermal',
'haline',
'solar',
'ice',
'gray',
'oxy',
'deep',
'dense',
'algae',
'matter',
'turbid',
'speed',
'amp',
'tempo',
'rain',
'phase',
'topo',
'balance',
'delta',
'curl',
'diff',
'tarn',
'turbo',
'CMRmap',
'brg',
'cubehelix',
'flag',
'gist_earth',
'gist_ncar',
'gist_rainbow',
'gist_stern',
'gnuplot',
'gnuplot2',
'jet',
'nipy_spectral',
'ocean',
'prism',
'rainbow',
'terrain',
];
33 changes: 32 additions & 1 deletion app/src/config/trilateral.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { DateTime } from 'luxon';
import {
simplifiedshTimeFunction, shTimeFunction, shS2TimeFunction, shWeeklyTimeFunction,
} from '@/utils';
import { baseLayers, overlayLayers } from '@/config/layers';
import { baseLayers, overlayLayers, xcubeViewerColormaps } from '@/config/layers';
import availableDates from '@/config/data_dates.json';
import locations from '@/config/locations.json';
import {
Expand Down Expand Up @@ -1076,6 +1076,37 @@ const createRECCAP2Config = (indicatorCode, name, variable, vmin, vmax, cbar, ti
inputData: [''],
yAxis,
display: {
layerConfig: {
schema: {
type: 'object',
properties: {
vminmax: {
title: 'Value stretch',
type: 'object',
properties: {
vmin: {
type: 'number',
minimum: vmin,
maximum: vmax,
format: 'range',
},
vmax: {
type: 'number',
minimum: vmin,
maximum: vmax,
format: 'range',
},
},
format: 'minmax',
},
cbar: {
title: 'Colorbar',
type: 'string',
enum: xcubeViewerColormaps,
},
},
},
},
presetView: {
type: 'FeatureCollection',
features: [{
Expand Down

0 comments on commit 856bbec

Please sign in to comment.