@opengeoweb/soundings 12.1.2 → 12.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/index.esm.js +1136 -6
  2. package/package.json +13 -2
  3. package/src/index.d.ts +3 -1
  4. package/src/lib/api/edr-api/api.d.ts +6 -0
  5. package/src/lib/api/edr-api/crss-types.d.ts +26 -0
  6. package/src/lib/api/edr-api/hooks.d.ts +4 -0
  7. package/src/lib/api/edr-api/types.d.ts +118 -0
  8. package/src/lib/components/DrawUtils.d.ts +40 -0
  9. package/src/lib/components/EDRFetchAndParse.stories.d.ts +7 -0
  10. package/src/lib/components/Soundings.d.ts +14 -0
  11. package/src/lib/components/Soundings.spec.d.ts +1 -0
  12. package/src/lib/components/Soundings.stories.d.ts +7 -0
  13. package/src/lib/components/SoundingsConnect.d.ts +5 -0
  14. package/src/lib/components/SoundingsMenuBar/LocationsMenu.d.ts +11 -0
  15. package/src/lib/components/SoundingsMenuBar/LocationsMenuConnect.d.ts +6 -0
  16. package/src/lib/components/SoundingsMenuBar/MenuBar.d.ts +11 -0
  17. package/src/lib/components/SoundingsMenuBar/MenuBar.stories.d.ts +26 -0
  18. package/src/lib/components/SoundingsMenuBar/MenuBarConnect.d.ts +8 -0
  19. package/src/lib/components/SoundingsMenuBar/MenuBarConnect.spec.d.ts +1 -0
  20. package/src/lib/components/SoundingsSourceDialogConnect.d.ts +7 -0
  21. package/src/lib/components/SoundingsSourceMenu.d.ts +9 -0
  22. package/src/lib/components/StaticLines/drawDryAdiabats.d.ts +11 -0
  23. package/src/lib/components/StaticLines/drawIsobars.d.ts +10 -0
  24. package/src/lib/components/StaticLines/drawIsohumes.d.ts +10 -0
  25. package/src/lib/components/StaticLines/drawIsotherms.d.ts +10 -0
  26. package/src/lib/components/StaticLines/drawMoistAdiabats.d.ts +16 -0
  27. package/src/lib/components/StaticLines/utils.d.ts +15 -0
  28. package/src/lib/components/index.d.ts +3 -0
  29. package/src/lib/components/types.d.ts +5 -0
  30. package/src/lib/i18n.d.ts +6 -0
  31. package/src/lib/parser/coverages.d.ts +2 -0
  32. package/src/lib/utils/conversions.d.ts +11 -0
  33. package/src/lib/utils/soundingsLookUp.d.ts +8 -0
  34. package/src/lib/utils/testHandlers.d.ts +1 -0
  35. package/src/lib/components/Sounding.d.ts +0 -2
  36. package/src/lib/components/Sounding.spec.d.ts +0 -0
  37. package/src/lib/components/soundings.stories.d.ts +0 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/soundings",
3
- "version": "12.1.2",
3
+ "version": "12.2.0",
4
4
  "description": "GeoWeb soundings library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -8,7 +8,18 @@
8
8
  "url": "git@gitlab.com:opengeoweb/opengeoweb.git"
9
9
  },
10
10
  "dependencies": {
11
- "react": "^18.3.1"
11
+ "@opengeoweb/api": "12.2.0",
12
+ "@tanstack/react-query": "^5.69.2",
13
+ "react": "^18.3.1",
14
+ "d3": "^7.9.0",
15
+ "react-i18next": "^15.1.1",
16
+ "i18next": "^23.11.5",
17
+ "@opengeoweb/shared": "12.2.0",
18
+ "@mui/material": "^6.4.1",
19
+ "@opengeoweb/store": "12.2.0",
20
+ "react-redux": "^8.1.3",
21
+ "@opengeoweb/theme": "12.2.0",
22
+ "msw": "^2.7.3"
12
23
  },
13
24
  "module": "./index.esm.js",
14
25
  "type": "module",
package/src/index.d.ts CHANGED
@@ -1 +1,3 @@
1
- export * from './lib/components/Sounding';
1
+ export * from './lib/components';
2
+ export * from './lib/utils/soundingsLookUp';
3
+ export * from './lib/api/edr-api/types';
@@ -0,0 +1,6 @@
1
+ import { CollectionsResponseFromBE, LocationsResponseFromBE, SoundingsInstances, CoverageCollection } from './types';
2
+ export declare const getCollections: () => Promise<CollectionsResponseFromBE>;
3
+ export declare const getCollectionLocations: (collectionId: string) => Promise<LocationsResponseFromBE>;
4
+ export declare const getCollectionInstance: (baseURL: string, collectionId: string) => Promise<SoundingsInstances>;
5
+ export declare const getEdrCollectionForLocation: (collectionId: string, locationId: string, parameters: string[], datetime: string) => Promise<CoverageCollection>;
6
+ export declare const getEdrCollectionForPosition: (collectionId: string, coordinates: [number, number], parameters: string[], datetime: string) => Promise<CoverageCollection>;
@@ -0,0 +1,26 @@
1
+ export interface Referencing {
2
+ coordinates: string[];
3
+ system: CRSSystem;
4
+ }
5
+ interface GeographicCRS {
6
+ type: 'GeographicCRS';
7
+ id: string;
8
+ }
9
+ interface ProjectedCRS {
10
+ type: 'ProjectedCRS';
11
+ id: string;
12
+ }
13
+ interface VerticalCRS {
14
+ type: 'VerticalCRS';
15
+ id: string;
16
+ }
17
+ interface EngineeringCRS {
18
+ type: 'EngineeringCRS';
19
+ id?: string;
20
+ }
21
+ interface TemporalRS {
22
+ type: 'TemporalRS';
23
+ calendar: string;
24
+ }
25
+ type CRSSystem = GeographicCRS | ProjectedCRS | VerticalCRS | EngineeringCRS | TemporalRS;
26
+ export {};
@@ -0,0 +1,4 @@
1
+ import { UseQueryResult } from '@tanstack/react-query';
2
+ import { SoundingFeature } from './types';
3
+ export declare const useEdrCollectionForLocation: (collectionId: string, locationId: string, parameters: string[], datetime: string) => UseQueryResult<SoundingFeature[]>;
4
+ export declare const useEdrCollectionForPosition: (collectionId: string, coordinates: [number, number], parameters: string[], datetime: string) => UseQueryResult<SoundingFeature[]>;
@@ -0,0 +1,118 @@
1
+ import { Geometry } from 'geojson';
2
+ import { Referencing } from './crss-types';
3
+ interface LinksFromBE {
4
+ title: string;
5
+ href: string;
6
+ rel: string;
7
+ type: string;
8
+ }
9
+ export interface CollectionsFromBE {
10
+ id: string;
11
+ title: string;
12
+ description: string;
13
+ links: LinksFromBE[];
14
+ output_formats: string[];
15
+ keywords: string[];
16
+ crs: string[];
17
+ data_queries: object;
18
+ extent: object;
19
+ parameter_names: object;
20
+ }
21
+ /** These types can be expanded as needed */
22
+ export interface CollectionsResponseFromBE {
23
+ links: LinksFromBE[];
24
+ collections: CollectionsFromBE[];
25
+ }
26
+ export interface FeaturesFromBE {
27
+ id: string;
28
+ type: string;
29
+ geometry: Geometry;
30
+ properties: {
31
+ datetime: string;
32
+ detail: string;
33
+ name: string;
34
+ };
35
+ }
36
+ export interface LocationsResponseFromBE {
37
+ features: FeaturesFromBE[];
38
+ type: string;
39
+ }
40
+ interface AxisValues {
41
+ values: number[] | string[];
42
+ }
43
+ interface SingleValueAxis {
44
+ values: [number];
45
+ }
46
+ interface SingleTimeValueAxis {
47
+ values: [string];
48
+ }
49
+ interface VerticalProfileAxes {
50
+ x: SingleValueAxis;
51
+ y: SingleValueAxis;
52
+ z: AxisValues;
53
+ t?: SingleTimeValueAxis;
54
+ }
55
+ export interface VerticalProfileDomain {
56
+ type: 'Domain';
57
+ domainType: 'VerticalProfile';
58
+ axes: VerticalProfileAxes;
59
+ referencing?: Referencing[];
60
+ }
61
+ interface NdArray {
62
+ type: 'NdArray';
63
+ dataType: 'float' | 'integer' | 'string';
64
+ axisNames?: string[];
65
+ shape?: number[];
66
+ values: number[] | string[];
67
+ }
68
+ type Ranges = Record<string, NdArray>;
69
+ type Description = Record<string, string>;
70
+ type Label = Record<string, string>;
71
+ interface Parameter {
72
+ type: 'Parameter';
73
+ id?: string;
74
+ label?: Label;
75
+ description?: Description;
76
+ unit?: {
77
+ label?: Label;
78
+ symbol?: Record<string, string>;
79
+ };
80
+ observedProperty: {
81
+ id?: string;
82
+ label: Label;
83
+ description?: Description;
84
+ };
85
+ }
86
+ export interface Coverage {
87
+ type: 'Coverage';
88
+ domain: VerticalProfileDomain;
89
+ ranges: Ranges;
90
+ }
91
+ export interface CoverageCollection {
92
+ type: 'CoverageCollection';
93
+ domainType: VerticalProfileDomain;
94
+ parameters: Record<string, Parameter>;
95
+ ranges: Record<string, NdArray>;
96
+ coverages: Coverage[];
97
+ referencing: Referencing[];
98
+ }
99
+ export interface SoundingFeatureProperties {
100
+ time: string;
101
+ temp: number;
102
+ dewpoint: number;
103
+ pressure: number;
104
+ windSpeed: number;
105
+ windDirection: number;
106
+ }
107
+ export interface SoundingFeature {
108
+ type: 'Feature';
109
+ geometry: Geometry;
110
+ properties: SoundingFeatureProperties;
111
+ }
112
+ export interface SoundingsInstance {
113
+ id: string;
114
+ }
115
+ export interface SoundingsInstances {
116
+ instances: SoundingsInstance[];
117
+ }
118
+ export {};
@@ -0,0 +1,40 @@
1
+ /// <reference types="react" />
2
+ import * as d3 from 'd3';
3
+ export declare const SOUNDING_COLORS: string[];
4
+ export interface Margin {
5
+ top: number;
6
+ right: number;
7
+ bottom: number;
8
+ left: number;
9
+ }
10
+ export interface InitializeSvg {
11
+ svgRef: React.MutableRefObject<SVGSVGElement | null>;
12
+ width: number;
13
+ height: number;
14
+ margin: Margin;
15
+ }
16
+ export interface AddLegends {
17
+ width: number;
18
+ svg: d3.Selection<SVGElement, unknown, HTMLElement, undefined>;
19
+ }
20
+ export interface DrawAxis {
21
+ svg: d3.Selection<SVGElement, unknown, HTMLElement, undefined>;
22
+ xScale: d3.ScaleLinear<number, number>;
23
+ yScale: d3.ScaleLogarithmic<number, number>;
24
+ height: number;
25
+ width: number;
26
+ }
27
+ export interface PlotSounding {
28
+ temperatureValues: number[];
29
+ pressureValues: number[];
30
+ color: string;
31
+ lineStyle: string;
32
+ xScale: d3.ScaleLinear<number, number>;
33
+ yScale: d3.ScaleLogarithmic<number, number>;
34
+ height: number;
35
+ svg: d3.Selection<SVGElement, unknown, HTMLElement, undefined>;
36
+ }
37
+ export declare const initializeSvg: ({ svgRef, width, height, margin, }: InitializeSvg) => d3.Selection<SVGGElement, unknown, null, undefined>;
38
+ export declare const drawAxes: ({ svg, xScale, yScale, height, width, }: DrawAxis) => void;
39
+ export declare const addLegends: ({ svg, width }: AddLegends) => void;
40
+ export declare const plotSounding: ({ temperatureValues, pressureValues, color, lineStyle, xScale, yScale, height, svg, }: PlotSounding) => void;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { Meta } from '@storybook/react/*';
3
+ import { Soundings } from './Soundings';
4
+ declare const meta: Meta<typeof Soundings>;
5
+ export default meta;
6
+ export declare const VerticalProfileFetchingByLocExample: React.FC;
7
+ export declare const VerticalProfileFetchingByPosExample: React.FC;
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { Margin } from './DrawUtils';
3
+ import { SoundingFeature } from '../api/edr-api/types';
4
+ export interface SoundingProps {
5
+ data: {
6
+ features: SoundingFeature[];
7
+ };
8
+ svgDimensions: {
9
+ width: number;
10
+ height: number;
11
+ margin: Margin;
12
+ };
13
+ }
14
+ export declare const Soundings: React.FC<SoundingProps>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { Soundings } from './Soundings';
3
+ declare const meta: Meta<typeof Soundings>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Soundings>;
6
+ export declare const SoundingsExample: Story;
7
+ export declare const SoundingsExampleDark: Story;
@@ -0,0 +1,5 @@
1
+ interface SoundingsConnectProps {
2
+ viewId: string;
3
+ }
4
+ declare const SoundingsConnect: ({ viewId, }: SoundingsConnectProps) => React.ReactElement;
5
+ export default SoundingsConnect;
@@ -0,0 +1,11 @@
1
+ import { LocationsResponseFromBE } from '../../api/edr-api/types';
2
+ export type ServicesWithId = LocationsResponseFromBE & {
3
+ id: string;
4
+ };
5
+ interface Props {
6
+ services: ServicesWithId[];
7
+ isOpen: boolean;
8
+ onClose: () => void;
9
+ }
10
+ export declare const LocationsMenu: ({ services, isOpen, onClose, }: Props) => React.ReactElement;
11
+ export {};
@@ -0,0 +1,6 @@
1
+ import { SoundingsCollection } from '@opengeoweb/shared';
2
+ interface Props {
3
+ soundingsCollections: SoundingsCollection[];
4
+ }
5
+ export declare const LocationsMenuConnect: ({ soundingsCollections, }: Props) => React.ReactElement;
6
+ export {};
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ export declare enum MenuOptions {
3
+ sources = "sources",
4
+ locations = "locations"
5
+ }
6
+ interface SoundingsMenuBarProps {
7
+ handleClick: (menuType: MenuOptions) => void;
8
+ isOpen: Record<MenuOptions, boolean>;
9
+ }
10
+ export declare const SoundingsMenuBar: ({ handleClick, isOpen, }: SoundingsMenuBarProps) => React.ReactElement;
11
+ export {};
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import type { StoryObj } from '@storybook/react';
3
+ import { MenuOptions, SoundingsMenuBar } from './MenuBar';
4
+ interface Props {
5
+ menu?: MenuOptions;
6
+ }
7
+ declare const _default: {
8
+ title: string;
9
+ component: ({ menu }: Props) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
10
+ };
11
+ export default _default;
12
+ type Story = StoryObj<typeof SoundingsMenuBar>;
13
+ export declare const LocationsMenuStory: {
14
+ args: {
15
+ menu: MenuOptions;
16
+ };
17
+ tags: string[];
18
+ parameters: {
19
+ zeplinLink: {
20
+ name: string;
21
+ link: string;
22
+ }[];
23
+ };
24
+ };
25
+ export declare const ComponentLight: Story;
26
+ export declare const ComponentDark: Story;
@@ -0,0 +1,8 @@
1
+ import { uiTypes } from '@opengeoweb/store';
2
+ import React from 'react';
3
+ interface MenuBarConnectProps {
4
+ viewId: string;
5
+ source?: uiTypes.Source;
6
+ }
7
+ export declare const MenuBarConnect: ({ viewId, source, }: MenuBarConnectProps) => React.ReactElement;
8
+ export {};
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { SoundingsCollection } from '@opengeoweb/shared';
3
+ interface SoundingsSourceDialogConnectProps {
4
+ soundingsCollections: SoundingsCollection[] | undefined;
5
+ }
6
+ export declare const SoundingsSourceDialogConnect: ({ soundingsCollections, }: SoundingsSourceDialogConnectProps) => React.ReactElement;
7
+ export {};
@@ -0,0 +1,9 @@
1
+ import React, { ReactElement } from 'react';
2
+ import { SoundingsCollectionsWithInstances } from './types';
3
+ interface SoundingsSourceMenuProps {
4
+ soundingsCollections: SoundingsCollectionsWithInstances[] | undefined;
5
+ isOpen?: boolean;
6
+ handleClose: () => void;
7
+ }
8
+ export declare const SoundingsSourceMenu: ({ soundingsCollections, isOpen, handleClose, }: SoundingsSourceMenuProps) => React.ReactElement;
9
+ export {};
@@ -0,0 +1,11 @@
1
+ import * as d3 from 'd3';
2
+ interface DrawDryAdiabatsProps {
3
+ staticPressureArray: number[];
4
+ height: number;
5
+ xScale: d3.ScaleLinear<number, number>;
6
+ yScale: d3.ScaleLogarithmic<number, number>;
7
+ dp: number;
8
+ svg: d3.Selection<SVGElement, unknown, HTMLElement, unknown>;
9
+ }
10
+ export declare const drawDryAdiabats: ({ staticPressureArray, height, xScale, yScale, svg, dp, }: DrawDryAdiabatsProps) => void;
11
+ export {};
@@ -0,0 +1,10 @@
1
+ import * as d3 from 'd3';
2
+ interface DrawIsobarsProps {
3
+ minTemperature: number;
4
+ maxTemperature: number;
5
+ xScale: d3.ScaleLinear<number, number>;
6
+ yScale: d3.ScaleLogarithmic<number, number>;
7
+ svg: d3.Selection<SVGElement, unknown, HTMLElement, unknown>;
8
+ }
9
+ export declare const drawIsobars: ({ minTemperature, maxTemperature, xScale, yScale, svg, }: DrawIsobarsProps) => void;
10
+ export {};
@@ -0,0 +1,10 @@
1
+ import * as d3 from 'd3';
2
+ interface DrawIsohumesProps {
3
+ staticPressureArray: number[];
4
+ height: number;
5
+ xScale: d3.ScaleLinear<number, number>;
6
+ yScale: d3.ScaleLogarithmic<number, number>;
7
+ svg: d3.Selection<SVGElement, unknown, HTMLElement, unknown>;
8
+ }
9
+ export declare const drawIsohumes: ({ staticPressureArray, height, xScale, yScale, svg, }: DrawIsohumesProps) => void;
10
+ export {};
@@ -0,0 +1,10 @@
1
+ import * as d3 from 'd3';
2
+ interface DrawIsothermsProps {
3
+ staticPressureArray: number[];
4
+ height: number;
5
+ xScale: d3.ScaleLinear<number, number>;
6
+ yScale: d3.ScaleLogarithmic<number, number>;
7
+ svg: d3.Selection<SVGElement, unknown, HTMLElement, unknown>;
8
+ }
9
+ export declare const drawIsotherms: ({ staticPressureArray, height, xScale, yScale, svg, }: DrawIsothermsProps) => void;
10
+ export {};
@@ -0,0 +1,16 @@
1
+ import * as d3 from 'd3';
2
+ interface DrawMoistAdiabatsProps {
3
+ staticPressureArray: number[];
4
+ minTemperature: number;
5
+ maxTemperature: number;
6
+ minPressure: number;
7
+ maxPressure: number;
8
+ width: number;
9
+ height: number;
10
+ dp: number;
11
+ xScale: d3.ScaleLinear<number, number>;
12
+ yScale: d3.ScaleLogarithmic<number, number>;
13
+ svg: d3.Selection<SVGElement, unknown, HTMLElement, unknown>;
14
+ }
15
+ export declare const drawMoistAdiabats: ({ staticPressureArray, minTemperature, maxTemperature, minPressure, maxPressure, width, height, xScale, yScale, svg, dp, }: DrawMoistAdiabatsProps) => void;
16
+ export {};
@@ -0,0 +1,15 @@
1
+ interface DrawStaticLinesProps {
2
+ dp: number;
3
+ staticPressureArray: number[];
4
+ minTemperature: number;
5
+ maxTemperature: number;
6
+ minPressure: number;
7
+ maxPressure: number;
8
+ width: number;
9
+ height: number;
10
+ xScale: d3.ScaleLinear<number, number>;
11
+ yScale: d3.ScaleLogarithmic<number, number>;
12
+ svg: d3.Selection<SVGElement, unknown, HTMLElement, unknown>;
13
+ }
14
+ export declare const drawStaticLines: ({ dp, staticPressureArray, minTemperature, maxTemperature, height, width, xScale, yScale, minPressure, maxPressure, svg, }: DrawStaticLinesProps) => void;
15
+ export {};
@@ -0,0 +1,3 @@
1
+ export * from './Soundings';
2
+ export * from './SoundingsSourceDialogConnect';
3
+ export * from './SoundingsMenuBar/LocationsMenuConnect';
@@ -0,0 +1,5 @@
1
+ import { SoundingsCollection } from '@opengeoweb/shared';
2
+ import { SoundingsInstance } from '../api/edr-api/types';
3
+ export interface SoundingsCollectionsWithInstances extends SoundingsCollection {
4
+ instances: SoundingsInstance[];
5
+ }
@@ -0,0 +1,6 @@
1
+ import i18n from 'i18next';
2
+ import { UseTranslationResponse } from 'react-i18next';
3
+ export declare const SOUNDINGS_NAMESPACE = "soundings";
4
+ export declare const initSoundingsI18n: () => void;
5
+ export declare const translateKeyOutsideComponents: (key: string, params?: Record<string, string | number> | undefined) => string;
6
+ export declare const useSoundingsTranslation: () => UseTranslationResponse<typeof SOUNDINGS_NAMESPACE, typeof i18n>;
@@ -0,0 +1,2 @@
1
+ import { CoverageCollection, SoundingFeature } from '../api/edr-api/types';
2
+ export declare function parseCoverageCollection(response: CoverageCollection): SoundingFeature[];
@@ -0,0 +1,11 @@
1
+ export declare const epsilon = 0.622;
2
+ export declare const e0 = 611.2;
3
+ export declare const aConstant = 17.67;
4
+ export declare const bConstant = 243.5;
5
+ export declare const tKelvinOffset = 273.15;
6
+ export declare const gConstant = 461.5;
7
+ export declare const hConstant = 2500000;
8
+ export declare function dewpointFromSpecificHumidity(specificHumidity: number, // specific humidity [kg/kg]
9
+ pressure: number): number;
10
+ export declare function dewpointFromRelativeHumidity(tCelsius: number, // air temperature [°C]
11
+ relHumidity: number): number;
@@ -0,0 +1,8 @@
1
+ export declare const soundingsComponentType = "Soundings";
2
+ export interface SoundingsLookUpPayload {
3
+ componentType: typeof soundingsComponentType;
4
+ id: string;
5
+ title?: string;
6
+ initialProps: Record<string, unknown>;
7
+ }
8
+ export declare const soundingsLookUp: (payload: SoundingsLookUpPayload) => React.JSX.Element | null;
@@ -0,0 +1 @@
1
+ export declare const fmiEdrCollectionsHandlers: import("msw").HttpHandler[];
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare const Sounding: () => React.ReactElement;
File without changes
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- declare const _default: {
3
- title: string;
4
- };
5
- export default _default;
6
- export declare const SoundingsExample: {
7
- (): React.ReactElement;
8
- tags: string[];
9
- };