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

Correlation chart #224

Merged
merged 38 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
1b70bf0
Updated basic reducer state
davenquinn Jun 12, 2024
abe41d1
Small update to column inspector
davenquinn Jun 4, 2024
50fd739
Fixed client routing in column inspector
davenquinn Jun 10, 2024
98263c0
Adjusted breadcrumbs for column pages
davenquinn Jun 10, 2024
d83606c
Updated breadcrumbs
davenquinn Jun 10, 2024
f93fae9
Slightly better render function
davenquinn Jun 10, 2024
6f29846
Partial update to column rendering
davenquinn Jun 10, 2024
d695993
Added the ability to show in-process columns
davenquinn Jun 10, 2024
5edb9cd
Created starting point for correlation diagram
davenquinn Jun 10, 2024
286da68
Updated compilation somewhat
davenquinn Jun 11, 2024
74e49b6
Started trying to make correlation work
davenquinn Jun 11, 2024
da6a32f
Started some basics for correlation page
davenquinn Jun 11, 2024
94a0c20
Updated correlation chart data
davenquinn Jun 11, 2024
9a7aa31
Correlation chart improvements
davenquinn Jun 11, 2024
a60fffc
Bring more map changes into correlation diagram page
davenquinn Jun 11, 2024
44d0244
Added column data
davenquinn Jun 13, 2024
404e396
Added selected columns
davenquinn Jun 28, 2024
17a99bb
Improve correlation diagram assistant
davenquinn Jun 28, 2024
bb92dde
Inset map
davenquinn Jun 28, 2024
2be6140
Successfully saves correlation state
davenquinn Jun 28, 2024
713821b
Refactor
davenquinn Jun 28, 2024
536e04f
Hoisted some state
davenquinn Jun 28, 2024
ba0f59a
Map expands and contracts
davenquinn Jun 28, 2024
24c55dd
List column names
davenquinn Jun 28, 2024
40d201c
A list of columns
davenquinn Jun 29, 2024
1b1cabb
Updated column colors
davenquinn Jun 29, 2024
2c1e7ed
Made everything more compact
davenquinn Jun 29, 2024
958c264
Brought column module into the system
davenquinn Jun 29, 2024
48b0fc5
Updated column types
davenquinn Jun 29, 2024
2f45b2e
Hoisted some data fetching
davenquinn Jun 29, 2024
bd26678
Starting point to separate scale
davenquinn Jun 29, 2024
544cef2
Duplicated components for scale
davenquinn Jun 29, 2024
665630a
Slightly simplified
davenquinn Jun 29, 2024
91c288d
Removed unused label
davenquinn Jun 29, 2024
3b5443d
Updated correlation diagram
davenquinn Jun 30, 2024
f7a3f44
Added gap-bound packages
davenquinn Jul 1, 2024
9fae964
Major improvements to correlation diagrams
davenquinn Jul 1, 2024
0174619
Merge remote-tracking branch 'origin/main' into correlation-chart
davenquinn Jul 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .idea/.gitignore

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

6 changes: 6 additions & 0 deletions .idea/jsLibraryMappings.xml

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

8 changes: 8 additions & 0 deletions .idea/modules.xml

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

1 change: 1 addition & 0 deletions .idea/prettier.xml

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

15 changes: 15 additions & 0 deletions .idea/runConfigurations/Run_with_Chrome_Debugger.xml

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

1 change: 1 addition & 0 deletions .idea/watcherTasks.xml

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

13 changes: 13 additions & 0 deletions .idea/web.iml

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

8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"@macrostrat/storybook": "workspace:*",
"@mdx-js/rollup": "^2.3.0",
"@types/esprima": "^4",
"@types/underscore": "^1",
"@typescript-eslint/eslint-plugin": "^6.3.0",
"@typescript-eslint/parser": "^6.3.0",
"@yarnpkg/sdks": "^3.1.0",
Expand All @@ -62,6 +63,7 @@
"@macrostrat-web/security": "workspace:*",
"@macrostrat-web/settings": "workspace:*",
"@macrostrat-web/sift": "workspace:*",
"@macrostrat-web/utility-functions": "workspace:*",
"@macrostrat/api-utils": "workspace:*",
"@macrostrat/api-views": "workspace:*",
"@macrostrat/auth-components": "workspace:*",
Expand All @@ -85,7 +87,10 @@
"@turf/bbox": "^6.5.0",
"@turf/boolean-contains": "^6.5.0",
"@turf/buffer": "^6.5.0",
"@turf/centroid": "^6.5.0",
"@turf/centroid": "^7.0.0",
"@turf/distance": "^7.0.0",
"@turf/line-intersect": "^7.0.0",
"@turf/nearest-point-on-line": "^7.0.0",
"@types/compression": "^1.7.2",
"@types/express": "^4.17.17",
"@types/geojson": "^7946.0.10",
Expand Down Expand Up @@ -135,6 +140,7 @@
"topojson-client": "^3.0.0",
"transition-hook": "^1.5.2",
"tsx": "^4.11.2",
"underscore": "^1.13.6",
"use-debounce": "^9.0.4",
"use-react-router-breadcrumbs": "^3.2.1",
"use-resize-observer": "^9.1.0",
Expand Down
5 changes: 5 additions & 0 deletions packages/utility-functions/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "@macrostrat-web/utility-functions",
"version": "1.0.0",
"main": "src/index.ts"
}
68 changes: 68 additions & 0 deletions packages/utility-functions/src/chronostratigraphy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
export type AgeRange = [number, number];

enum MergeMode {
Inner,
Outer,
}

export function mergeAgeRanges(
ranges: AgeRange[],
mergeMode: MergeMode = MergeMode.Outer
): AgeRange {
/** Merge a set of age ranges to get the inner or outer bounds */
let min = Infinity;
let max = 0;
// Negative ages are not handled

if (mergeMode === MergeMode.Inner) {
min = Math.min(...ranges.map((d) => d[0]));
max = Math.max(...ranges.map((d) => d[1]));
} else {
min = Math.max(...ranges.map((d) => d[0]));
max = Math.min(...ranges.map((d) => d[1]));
}

// Age ranges should start with the oldest (largest) age
if (min < max) {
return [max, min];
}
return [min, max];
}

enum AgeRangeRelationship {
Disjoint,
Contains,
Contained,
Identical,
}

function convertToForwardOrdinal(a: AgeRange): AgeRange {
/** Age ranges are naturally expressed as [b_age, t_age] where
* b_age is the older age and t_age is the younger age. This function
* converts the age range to [min, max] where min is the oldest age,
* expressed as negative numbers. This assists with intuitive ordering
* in certain cases.
*/
return [-a[0], -a[1]];
}

export function compareAgeRanges(
a: AgeRange,
b: AgeRange
): AgeRangeRelationship {
const a1 = convertToForwardOrdinal(a);
const b1 = convertToForwardOrdinal(b);
/** Compare two age ranges */
if (a1[0] > b1[1] || a1[1] < b1[0]) {
return AgeRangeRelationship.Disjoint;
}
if (a1[0] === b1[0] && a1[1] === b1[1]) {
return AgeRangeRelationship.Identical;
}
if (a1[0] <= b1[0] && a1[1] >= b1[1]) {
return AgeRangeRelationship.Contains;
}
if (a1[0] >= b1[0] && a1[1] <= b1[1]) {
return AgeRangeRelationship.Contained;
}
}
1 change: 1 addition & 0 deletions packages/utility-functions/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./chronostratigraphy";
62 changes: 62 additions & 0 deletions src/_utils/map-layers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/** Functions to apply specific layers to map UIs */

export function buildCrossSectionLayers(): mapboxgl.Layer[] {
// Get CSS colors from settings
const ruleColor = getComputedStyle(document.body).getPropertyValue(
"--panel-background-color"
);

const centerColor = getComputedStyle(document.body).getPropertyValue(
"--panel-rule-color"
);

const crossSectionPointPaint = {
"circle-radius": {
stops: [
[0, 3],
[12, 5]
]
},
"circle-color": centerColor,
"circle-stroke-width": {
stops: [
[0, 2],
[12, 4]
]
},
"circle-stroke-color": ruleColor
};

return [
{
id: "crossSectionLine",
type: "line",
source: "crossSectionLine",
paint: {
"line-width": {
stops: [
[0, 1],
[12, 3]
]
},
"line-color": ruleColor,
"line-opacity": 1
}
},
{
id: "crossSectionEndpoint",
type: "circle",
source: "crossSectionEndpoints",
paint: crossSectionPointPaint
},
{
id: "elevationMarker",
type: "circle",
source: "elevationMarker",
paint: {
...crossSectionPointPaint,
"circle-color": "#4bc0c0"
}
}
];
}
1 change: 1 addition & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export * from "./tags";
export * from "./map-info";
export * from "./lithology";
export * from "./buttons";
export { buildCrossSectionLayers } from "~/_utils/map-layers";
Loading
Loading