Skip to content

Commit 0d7bb88

Browse files
authored
Merge pull request #1075 from SlideRuleEarth/issue-1074-scope-advanced-params
Scope advanced parameters to selected endpoint (#1074)
2 parents a04545b + 3ef7669 commit 0d7bb88

4 files changed

Lines changed: 314 additions & 36 deletions

File tree

web-client/src/components/SrAdvOptAccordion.vue

Lines changed: 88 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import Accordion from 'primevue/accordion'
33
import AccordionPanel from 'primevue/accordionpanel'
44
import AccordionHeader from 'primevue/accordionheader'
55
import AccordionContent from 'primevue/accordioncontent'
6-
import { defineAsyncComponent, ref } from 'vue'
6+
import { defineAsyncComponent, ref, computed } from 'vue'
77
import { useReqParamsStore } from '@/stores/reqParamsStore'
8-
import { computed } from 'vue'
8+
import { photonProcessingAPIs } from '@/types/SrStaticOptions'
99
1010
/* eslint-disable @typescript-eslint/promise-function-async */
1111
const SrYAPC = defineAsyncComponent(() => import('@/components/SrYAPC.vue'))
@@ -39,6 +39,33 @@ const reqParamsStore = useReqParamsStore()
3939
const props = defineProps<Props>()
4040
const expandedPanels = ref<number[]>([])
4141
42+
const isPhotonProcessingAPI = computed(() => photonProcessingAPIs.has(props.iceSat2SelectedAPI))
43+
44+
// Fixed segment dimensions baked into pre-computed ATL06/ATL08 data products.
45+
// Source: ICESat-2 ATL06 / ATL08 product specifications.
46+
const fixedExtentsByAPI: Record<string, { len: number; res: number }> = {
47+
atl06x: { len: 40, res: 20 },
48+
atl08x: { len: 100, res: 100 }
49+
}
50+
51+
const fixedExtents = computed(() => fixedExtentsByAPI[props.iceSat2SelectedAPI] ?? null)
52+
53+
const fixedExtentsTooltip = computed(() => {
54+
const api = props.iceSat2SelectedAPI
55+
return `Segment dimensions are fixed in the ${api} data product and cannot be modified.`
56+
})
57+
58+
// Panels that show parameters used at request time are visible when the
59+
// selected endpoint actually consumes them. X-series endpoints read pre-computed
60+
// segments from the source HDF5 product so most photon-processing panels are hidden.
61+
const showExtentsPanel = computed(() => isPhotonProcessingAPI.value || fixedExtents.value !== null)
62+
const showSurfaceElevationPanel = computed(() =>
63+
['atl06p', 'atl06sp', 'atl03x-surface'].includes(props.iceSat2SelectedAPI)
64+
)
65+
const showPhoRealPanel = computed(() =>
66+
['atl08p', 'atl03x-phoreal'].includes(props.iceSat2SelectedAPI)
67+
)
68+
4269
const onPanelOpen = (value: any) => {
4370
//console.log('onPanelOpen', value, "type: ", typeof value);
4471
expandedPanels.value.push(value.index)
@@ -86,41 +113,45 @@ const fieldsHeader = computed(() => {
86113
<SrGranuleSelection />
87114
</AccordionContent>
88115
</AccordionPanel>
89-
<AccordionPanel value="3" v-if="mission === 'ICESat-2'">
116+
<AccordionPanel value="3" v-if="mission === 'ICESat-2' && isPhotonProcessingAPI">
90117
<AccordionHeader>Photon Selection</AccordionHeader>
91118
<AccordionContent v-if="isExpanded(3)">
92119
<SrAtl03Classification />
93120
<SrAtl08Cnf />
94121
<SrYAPC />
95122
</AccordionContent>
96123
</AccordionPanel>
97-
<AccordionPanel value="4" v-if="mission === 'ICESat-2'">
124+
<AccordionPanel value="4" v-if="mission === 'ICESat-2' && showExtentsPanel">
98125
<AccordionHeader>Extents</AccordionHeader>
99126
<AccordionContent v-if="isExpanded(4)">
100-
<SrExtents />
127+
<SrExtents v-if="isPhotonProcessingAPI" />
128+
<div
129+
v-else-if="fixedExtents"
130+
class="sr-fixed-extents"
131+
v-tooltip.top="fixedExtentsTooltip"
132+
>
133+
<div class="sr-fixed-extents-header">
134+
<i class="pi pi-lock"></i>
135+
<span>Fixed in {{ iceSat2SelectedAPI }} data product</span>
136+
</div>
137+
<div class="sr-fixed-extents-row">
138+
<span class="sr-fixed-extents-label">Length</span>
139+
<span class="sr-fixed-extents-value">{{ fixedExtents.len }} m</span>
140+
</div>
141+
<div class="sr-fixed-extents-row">
142+
<span class="sr-fixed-extents-label">Step Size</span>
143+
<span class="sr-fixed-extents-value">{{ fixedExtents.res }} m</span>
144+
</div>
145+
</div>
101146
</AccordionContent>
102147
</AccordionPanel>
103-
<AccordionPanel
104-
value="5"
105-
v-if="
106-
mission === 'ICESat-2' &&
107-
(props.iceSat2SelectedAPI.includes('atl06') ||
108-
props.iceSat2SelectedAPI.includes('atl03x-surface'))
109-
"
110-
>
148+
<AccordionPanel value="5" v-if="mission === 'ICESat-2' && showSurfaceElevationPanel">
111149
<AccordionHeader>Surface Elevation</AccordionHeader>
112150
<AccordionContent v-if="isExpanded(5)">
113151
<SrSurfaceElevation />
114152
</AccordionContent>
115153
</AccordionPanel>
116-
<AccordionPanel
117-
value="6"
118-
v-if="
119-
mission === 'ICESat-2' &&
120-
(props.iceSat2SelectedAPI.includes('atl08') ||
121-
props.iceSat2SelectedAPI.includes('atl03x-phoreal'))
122-
"
123-
>
154+
<AccordionPanel value="6" v-if="mission === 'ICESat-2' && showPhoRealPanel">
124155
<AccordionHeader>PhoREAL Veg Density Alg</AccordionHeader>
125156
<AccordionContent v-if="isExpanded(6)">
126157
<SrVegDensity />
@@ -331,4 +362,40 @@ const fieldsHeader = computed(() => {
331362
justify-content: center;
332363
margin-bottom: 0.5rem;
333364
}
365+
366+
.sr-fixed-extents {
367+
display: flex;
368+
flex-direction: column;
369+
gap: 0.5rem;
370+
padding: 0.75rem;
371+
border: 1px solid var(--p-surface-300);
372+
border-radius: var(--p-border-radius);
373+
cursor: help;
374+
}
375+
376+
.sr-fixed-extents-header {
377+
display: flex;
378+
align-items: center;
379+
gap: 0.5rem;
380+
font-size: small;
381+
color: var(--p-text-muted-color);
382+
margin-bottom: 0.25rem;
383+
}
384+
385+
.sr-fixed-extents-row {
386+
display: flex;
387+
justify-content: space-between;
388+
align-items: center;
389+
padding: 0.25rem 0.5rem;
390+
opacity: 0.7;
391+
}
392+
393+
.sr-fixed-extents-label {
394+
font-size: large;
395+
}
396+
397+
.sr-fixed-extents-value {
398+
font-family: monospace;
399+
font-size: large;
400+
}
334401
</style>

web-client/src/stores/reqParamsStore.ts

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ import {
2929
OnOffOptions,
3030
geoLocationOptions,
3131
signalConfidenceNumberOptions,
32-
qualityPHOptions
32+
qualityPHOptions,
33+
photonProcessingAPIs
3334
} from '@/types/SrStaticOptions'
3435

3536
export function getDefaultReqParamsState(): SrReqParamsState {
@@ -490,6 +491,8 @@ const createReqParamsStore = (id: string) =>
490491
getAtlReqParams(req_id: number): AtlReqParams {
491492
//console.log('getAtlReqParams req_id:', req_id);
492493
const req: AtlReqParams = {}
494+
const isPhotonAPI =
495+
this.missionValue === 'ICESat-2' && photonProcessingAPIs.has(this.iceSat2SelectedAPI)
493496
if (this.missionValue === 'ICESat-2') {
494497
if (!this.iceSat2SelectedAPI.includes('x')) {
495498
// atlnnx does not need asset set
@@ -561,7 +564,7 @@ const createReqParamsStore = (id: string) =>
561564
req.atl24.anc_fields = this.atl24AncillaryFields
562565
}
563566
} else {
564-
if (this.missionValue === 'ICESat-2') {
567+
if (isPhotonAPI) {
565568
if (this.enableAtl03Classification) {
566569
if (
567570
this.surfaceReferenceType.length === 1 &&
@@ -625,7 +628,7 @@ const createReqParamsStore = (id: string) =>
625628
}
626629
}
627630

628-
if (this.missionValue === 'ICESat-2') {
631+
if (isPhotonAPI) {
629632
if (this.getUseSurfaceFitAlgorithm()) {
630633
req.fit = {} as SrSurfaceFit
631634
if (this.getUseMaxIterations()) {
@@ -707,14 +710,16 @@ const createReqParamsStore = (id: string) =>
707710
}
708711
}
709712
}
710-
if (this.passInvalid) {
711-
req.pass_invalid = true
712-
} else {
713-
if (this.getUseAlongTrackSpread()) {
714-
req.ats = this.alongTrackSpread
715-
}
716-
if (this.getUseMinimumPhotonCount()) {
717-
req.cnt = this.minimumPhotonCount
713+
if (isPhotonAPI) {
714+
if (this.passInvalid) {
715+
req.pass_invalid = true
716+
} else {
717+
if (this.getUseAlongTrackSpread()) {
718+
req.ats = this.alongTrackSpread
719+
}
720+
if (this.getUseMinimumPhotonCount()) {
721+
req.cnt = this.minimumPhotonCount
722+
}
718723
}
719724
}
720725

@@ -769,20 +774,20 @@ const createReqParamsStore = (id: string) =>
769774
// ATL03 classification settings would go here
770775
}
771776

772-
if (this.enableAtl08Classification) {
777+
if (isPhotonAPI && this.enableAtl08Classification) {
773778
if (this.atl08LandType.length > 0) {
774779
req.atl08_class = this.atl08LandType
775780
}
776781
}
777782

778-
if (this.enableAtl24Classification) {
783+
if (isPhotonAPI && this.enableAtl24Classification) {
779784
if (!req.atl24) req.atl24 = {}
780785
if (this.atl24_class_ph.length > 0) {
781786
req.atl24.class_ph = this.atl24_class_ph
782787
}
783788
}
784789

785-
if (this.enableYAPC) {
790+
if (isPhotonAPI && this.enableYAPC) {
786791
let yapc = {} as Icesat2ConfigYapc
787792
yapc.version = this.getYAPCVersion()
788793
yapc.score = this.YAPCScore
@@ -798,7 +803,7 @@ const createReqParamsStore = (id: string) =>
798803
req.yapc = yapc
799804
//console.log('using req.yapc:',req.yapc)
800805
}
801-
if (this.distanceIn.value === 'segments') {
806+
if (isPhotonAPI && this.distanceIn.value === 'segments') {
802807
req.dist_in_seg = true
803808
}
804809
if (this.useServerTimeout) {

web-client/src/types/SrStaticOptions.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,19 @@ export const iceSat2APIsItems = [
2626
'atl13x'
2727
]
2828
export const gediAPIsItems = ['gedi01bp', 'gedi02ap', 'gedi04ap']
29+
// ICESat-2 endpoints that compute segments from ATL03 photons and accept
30+
// photon-processing parameters (cnf, srt, yapc, len, res, fit, etc.).
31+
// X-series endpoints (atl06x, atl08x, atl24x, atl13x) read pre-computed
32+
// segments from HDF5 files and ignore these parameters.
33+
export const photonProcessingAPIs: ReadonlySet<string> = new Set([
34+
'atl03x',
35+
'atl03x-surface',
36+
'atl03x-phoreal',
37+
'atl03vp',
38+
'atl06p',
39+
'atl06sp',
40+
'atl08p'
41+
])
2942
export const surfaceReferenceTypeOptions = [
3043
{ name: 'Dynamic', value: -1 },
3144
{ name: 'Land', value: 0 },

0 commit comments

Comments
 (0)