diff --git a/.github/workflows/semantic_release.yml b/.github/workflows/semantic_release.yml index 6317d82c5d..462ffd4d8c 100644 --- a/.github/workflows/semantic_release.yml +++ b/.github/workflows/semantic_release.yml @@ -22,6 +22,15 @@ jobs: - run: npm ci working-directory: ./typescript + - name: Dry-run Nx release + working-directory: ./typescript + run: npx nx release --dry-run + env: + GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Run semantic release working-directory: ./typescript run: npx nx run-many --target=semantic-release --parallel=false diff --git a/typescript/nx.json b/typescript/nx.json index 0225dec169..8d11f64098 100644 --- a/typescript/nx.json +++ b/typescript/nx.json @@ -13,5 +13,14 @@ "build": { "dependsOn": ["^build"] } + }, + "release": { + "version": { "conventionalCommits": true }, + "projectsRelationship": "independent", + "changelog": { + "projectChangelogs": { + "createRelease": "github" + } + } } } diff --git a/typescript/packages/group-tree-plot/project.json b/typescript/packages/group-tree-plot/project.json index b882678bea..f12304fbf0 100644 --- a/typescript/packages/group-tree-plot/project.json +++ b/typescript/packages/group-tree-plot/project.json @@ -1,4 +1,5 @@ { + "name": "group-tree-plot", "targets": { "semantic-release": { "executor": "@theunderscorer/nx-semantic-release:semantic-release" diff --git a/typescript/packages/subsurface-viewer/CHANGELOG.md b/typescript/packages/subsurface-viewer/CHANGELOG.md index 5ea65d96b5..242d089ac5 100644 --- a/typescript/packages/subsurface-viewer/CHANGELOG.md +++ b/typescript/packages/subsurface-viewer/CHANGELOG.md @@ -1,3 +1,10 @@ +## [0.30.3](https://github.com/equinor/webviz-subsurface-components/compare/subsurface-viewer@0.30.2...subsurface-viewer@0.30.3) (2024-09-11) + + +### Bug Fixes + +* **subsurface-viewer:** fix color map sampling for 3D grids ([#2234](https://github.com/equinor/webviz-subsurface-components/issues/2234)) ([43cf1b9](https://github.com/equinor/webviz-subsurface-components/commit/43cf1b9a900d18cf4bb61a7062cc8c6de5588080)) + ## [0.30.2](https://github.com/equinor/webviz-subsurface-components/compare/subsurface-viewer@0.30.1...subsurface-viewer@0.30.2) (2024-09-06) diff --git a/typescript/packages/subsurface-viewer/package.json b/typescript/packages/subsurface-viewer/package.json index fd2a5b8338..de91e4b57f 100644 --- a/typescript/packages/subsurface-viewer/package.json +++ b/typescript/packages/subsurface-viewer/package.json @@ -1,6 +1,6 @@ { "name": "@webviz/subsurface-viewer", - "version": "0.30.2", + "version": "0.30.3", "description": "3D visualization component for subsurface reservoir data", "keywords": [ "subsurface", diff --git a/typescript/packages/subsurface-viewer/project.json b/typescript/packages/subsurface-viewer/project.json index b882678bea..883cea91f8 100644 --- a/typescript/packages/subsurface-viewer/project.json +++ b/typescript/packages/subsurface-viewer/project.json @@ -1,4 +1,5 @@ { + "name": "subsurface-viewer", "targets": { "semantic-release": { "executor": "@theunderscorer/nx-semantic-release:semantic-release" diff --git a/typescript/packages/subsurface-viewer/src/layers/grid3d/privateGrid3dLayer.ts b/typescript/packages/subsurface-viewer/src/layers/grid3d/privateGrid3dLayer.ts index d6a948fd74..de31318afb 100644 --- a/typescript/packages/subsurface-viewer/src/layers/grid3d/privateGrid3dLayer.ts +++ b/typescript/packages/subsurface-viewer/src/layers/grid3d/privateGrid3dLayer.ts @@ -372,14 +372,20 @@ export default class PrivateLayer extends Layer { }; } private getTexture(context: DeckGLLayerContext): Texture { + const textureProps: TextureProps = { + sampler: DEFAULT_TEXTURE_PARAMETERS, + width: 256, + height: 1, + format: "rgb8unorm-webgl", + }; + if (this.props.colorMapFunction instanceof Uint8Array) { const imageData = this.getImageData(); const count = this.props.colorMapFunction.length / 3; if (count === 0) { const colormap = context.device.createTexture({ + ...textureProps, width: imageData.count, - height: 1, - format: "rgb8unorm-webgl", data: new Uint8Array([0, 0, 0, 0, 0, 0]), sampler: DISCRETE_TEXTURE_PARAMETERS, }); @@ -392,9 +398,8 @@ export default class PrivateLayer extends Layer { : DEFAULT_TEXTURE_PARAMETERS; const colormap = context.device.createTexture({ + ...textureProps, width: imageData.count, - height: 1, - format: "rgb8unorm-webgl", data: imageData.data as TextureData, sampler, }); @@ -409,9 +414,8 @@ export default class PrivateLayer extends Layer { ); const colormap = context.device.createTexture({ - width: 256, + ...textureProps, height: 1, - format: "rgb8unorm-webgl", data: data as TextureData, }); return colormap; diff --git a/typescript/packages/subsurface-viewer/src/storybook/examples/__image_snapshots__/subsurfaceviewer-examples--mixed-layer-definitions.png b/typescript/packages/subsurface-viewer/src/storybook/examples/__image_snapshots__/subsurfaceviewer-examples--mixed-layer-definitions.png index 69afab95fb..bf2f44095b 100644 Binary files a/typescript/packages/subsurface-viewer/src/storybook/examples/__image_snapshots__/subsurfaceviewer-examples--mixed-layer-definitions.png and b/typescript/packages/subsurface-viewer/src/storybook/examples/__image_snapshots__/subsurfaceviewer-examples--mixed-layer-definitions.png differ diff --git a/typescript/packages/subsurface-viewer/src/storybook/layers/Grid3DLayer.stories.tsx b/typescript/packages/subsurface-viewer/src/storybook/layers/Grid3DLayer.stories.tsx index b634678486..db2f688b11 100644 --- a/typescript/packages/subsurface-viewer/src/storybook/layers/Grid3DLayer.stories.tsx +++ b/typescript/packages/subsurface-viewer/src/storybook/layers/Grid3DLayer.stories.tsx @@ -27,6 +27,9 @@ import * as gridPolys from "../../layers/grid3d/test_data/DiscreteProperty/Polys import * as gridProps from "../../layers/grid3d/test_data/DiscreteProperty/Props.json"; import { default3DViews, defaultStoryParameters } from "../sharedSettings"; +import type { Grid3DLayerProps } from "../../layers"; +import { AxesLayer, Grid3DLayer } from "../../layers"; +import type { CompositeLayer } from "@deck.gl/core"; const stories: Meta = { component: SubsurfaceViewer, @@ -71,6 +74,31 @@ const parameters = { }, }; +const SIMPLE_GEOMETRY = { + points: [ + [0, 0, 0], + [100, 0, 0], + [100, 100, 0], + [0, 100, 0], + [200, 100, 0], + [200, 0, 0], + ], + polygons: [4, 0, 1, 2, 3, 4, 1, 2, 4, 5], +}; + +const SIMPLE_GEOMETRY_LAYER = { + ...grid3dLayer, + pickable: true, + pointsData: new Float32Array(SIMPLE_GEOMETRY.points.flat()), + polysData: new Uint32Array(SIMPLE_GEOMETRY.polygons), +}; + +const CATEGORICAL_COLOR_MAP = (value: number) => CATEGORICAL_COLOR_TABLE[value]; + +const BLUE_RED_HEAT_MAP = (value: number): [number, number, number] => { + return [value * 255, 0, (1 - value) * 255]; +}; + export const Simgrid: StoryObj = { args: { ...defaultProps, @@ -186,20 +214,20 @@ const toroidProperties = Array(ToroidVertexCount) .map(() => randomFunc() * 10); /* eslint-disable prettier/prettier */ -const colorTable = new Uint8Array([ - 0, 0, 255, // 0 - 0, 255, 0, // 1 - 0, 255, 255, // 2 - 255, 0, 0, // 3 - 255, 0, 255, // 4 - 255, 255, 0, // 5 - 0, 0, 100, // 6 - 0, 100, 0, // 7 - 0, 100, 100, // 8 - 100, 0, 0, // 9 - 100, 0, 100, // 10 - 100, 100, 0, // 11 -]); +const CATEGORICAL_COLOR_TABLE: [number, number, number][] = [ + [0, 0, 255], // 0 + [0, 255, 0], // 1 + [0, 255, 255], // 2 + [255, 0, 0], // 3 + [255, 0, 255], // 4 + [255, 255, 0], // 5 + [0, 0, 100], // 6 + [0, 100, 0], // 7 + [0, 100, 100], // 8 + [100, 0, 0], // 9 + [100, 0, 100], // 10 + [100, 100, 0], // 11 +]; const propertyValueNames = [ { value: 1, name: "blue"}, // 0 @@ -214,7 +242,7 @@ const propertyValueNames = [ { value: 10, name: "dark red"}, // 9 { value: 3, name: "dark magenta"}, // 10 { value: -10, name: "dark yellow"},// 11 -] +]; /* eslint-enable prettier/prettier */ export const PolyhedralCells: StoryObj = { @@ -268,7 +296,7 @@ const layerArrays = { pointsData: new Float32Array(gridPoints), polysData: new Uint32Array(gridPolys), propertiesData: new Uint16Array(gridProps), - colorMapFunction: colorTable, + colorMapFunction: new Uint8Array(CATEGORICAL_COLOR_TABLE.flat()), }, }; @@ -305,6 +333,45 @@ function replaceLayerArrays( } } +export const ContinuousProperty: StoryObj = { + args: { + id: "grid-property", + layers: [ + new AxesLayer({ + ...axes, + bounds: [-300, -300, -2200, 300, 300, -1000], + }), + new Grid3DLayer({ + ...SIMPLE_GEOMETRY_LAYER, + propertiesData: new Float32Array([-1, 100.5]), + colorMapFunction: BLUE_RED_HEAT_MAP, + }) as CompositeLayer, + ], + }, + parameters: parameters, + render: (args) => , +}; + +export const DiscreteProperty: StoryObj = { + args: { + id: "grid-property", + layers: [ + new AxesLayer({ + ...axes, + bounds: [-300, -300, -2200, 300, 300, -1000], + }), + new Grid3DLayer({ + ...SIMPLE_GEOMETRY_LAYER, + propertiesData: new Uint16Array([0, 1]), + discretePropertyValueNames: propertyValueNames, + colorMapFunction: CATEGORICAL_COLOR_MAP, + }) as CompositeLayer, + ], + }, + parameters: parameters, + render: (args) => , +}; + export const DiscretePropertyWithClamping: StoryObj = { args: { bounds: [-2500, -2500, 2500, 2500] as NumberQuad, diff --git a/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--continuous-property.png b/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--continuous-property.png new file mode 100644 index 0000000000..e1d227c229 Binary files /dev/null and b/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--continuous-property.png differ diff --git a/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--custom-color-func-with-clamping.png b/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--custom-color-func-with-clamping.png index 017d977b89..493de65709 100644 Binary files a/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--custom-color-func-with-clamping.png and b/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--custom-color-func-with-clamping.png differ diff --git a/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--discrete-property.png b/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--discrete-property.png index cad22cc35b..e7b4f02f3c 100644 Binary files a/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--discrete-property.png and b/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--discrete-property.png differ diff --git a/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--polyhedral-cells.png b/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--polyhedral-cells.png index 5c39aeda37..0a7cad254e 100644 Binary files a/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--polyhedral-cells.png and b/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--polyhedral-cells.png differ diff --git a/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--simgrid-2-x.png b/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--simgrid-2-x.png index cb14f8974e..3c29db7a55 100644 Binary files a/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--simgrid-2-x.png and b/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--simgrid-2-x.png differ diff --git a/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--simgrid-4-x.png b/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--simgrid-4-x.png index 692fc2ae38..7b3687fb48 100644 Binary files a/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--simgrid-4-x.png and b/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--simgrid-4-x.png differ diff --git a/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--simgrid-8-x-i-jonly.png b/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--simgrid-8-x-i-jonly.png index 764918c49e..7dc3c5f619 100644 Binary files a/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--simgrid-8-x-i-jonly.png and b/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--simgrid-8-x-i-jonly.png differ diff --git a/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--simgrid-array-input.png b/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--simgrid-array-input.png index 96aeae51be..e5d822d1b2 100644 Binary files a/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--simgrid-array-input.png and b/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--simgrid-array-input.png differ diff --git a/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--simgrid.png b/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--simgrid.png index 6b6121204d..d6d8c58620 100644 Binary files a/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--simgrid.png and b/typescript/packages/subsurface-viewer/src/storybook/layers/__image_snapshots__/subsurfaceviewer-grid3d-layer--simgrid.png differ diff --git a/typescript/packages/well-completions-plot/project.json b/typescript/packages/well-completions-plot/project.json index b882678bea..61856b43ab 100644 --- a/typescript/packages/well-completions-plot/project.json +++ b/typescript/packages/well-completions-plot/project.json @@ -1,4 +1,5 @@ { + "name": "well-completions-plot", "targets": { "semantic-release": { "executor": "@theunderscorer/nx-semantic-release:semantic-release" diff --git a/typescript/packages/well-log-viewer/project.json b/typescript/packages/well-log-viewer/project.json index b882678bea..0bbc66e615 100644 --- a/typescript/packages/well-log-viewer/project.json +++ b/typescript/packages/well-log-viewer/project.json @@ -1,4 +1,5 @@ { + "name": "well-log-viewer", "targets": { "semantic-release": { "executor": "@theunderscorer/nx-semantic-release:semantic-release" diff --git a/typescript/packages/wsc-common/project.json b/typescript/packages/wsc-common/project.json index b882678bea..3a33957269 100644 --- a/typescript/packages/wsc-common/project.json +++ b/typescript/packages/wsc-common/project.json @@ -1,4 +1,5 @@ { + "name": "wsc-common", "targets": { "semantic-release": { "executor": "@theunderscorer/nx-semantic-release:semantic-release"