Skip to content

Commit

Permalink
Merge pull request #1827 from asfadmin/DS-5122-insar-burst-on-demand
Browse files Browse the repository at this point in the history
INSAR BURST on demand
  • Loading branch information
SpicyGarlicAlbacoreRoll authored Nov 28, 2023
2 parents 43825cd + a847057 commit 090ab71
Show file tree
Hide file tree
Showing 20 changed files with 355 additions and 183 deletions.
1 change: 1 addition & 0 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ export const routes = [
services.PairService,
services.SceneSelectService,
services.OnDemandService,
services.PossibleHyp3JobsService,
{provide: SAVER, useFactory: getSaver},
{
provide: DateAdapter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
</div>
</div>

<div *ngIf="searchType !== SearchTypes.CUSTOM_PRODUCTS || hyp3able.total > 0"
<div *ngIf="searchType !== SearchTypes.CUSTOM_PRODUCTS && hyp3able?.total > 0"
class="fx-empty list-button-group">
<div class="fx-row-center button-group-label">
<label>{{ 'ON_DEMAND' | translate }}</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as queueStore from '@store/queue';

import {
ScreenSizeService, MapService, ScenesService, PairService,
Hyp3Service
Hyp3Service, PossibleHyp3JobsService,
} from '@services';

import { SubSink } from 'subsink';
Expand Down Expand Up @@ -64,6 +64,7 @@ export class BaselineResultsMenuComponent implements OnInit, OnDestroy {
private scenesService: ScenesService,
private pairService: PairService,
private hyp3: Hyp3Service,
private possibleHyp3JobsService: PossibleHyp3JobsService,
) { }

ngOnInit(): void {
Expand All @@ -76,20 +77,19 @@ export class BaselineResultsMenuComponent implements OnInit, OnDestroy {
this.products = products;
this.downloadableProds = this.hyp3.downloadable(products);
this.pairs = [ ...pairs, ...custom ];

this.hyp3able = this.hyp3.getHyp3ableProducts([
...this.products.map(prod => [prod]),
...this.pairs?.sort((a, b) => {
if (a.metadata.date < b.metadata.date) {
return -1;
}
return 1;
})
]);
}
)
);

this.subs.add(
this.possibleHyp3JobsService.possibleJobs$
.subscribe(
possibleJobs => {
this.hyp3able = this.hyp3.getHyp3ableProducts(possibleJobs);
}
)
);

this.subs.add(
this.screenSize.breakpoint$.subscribe(
point => this.breakpoint = point
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
<div class="resize-controls">
<div mwlResizeHandle [resizeEdges]="{ top: !(imageViewerOpen$ | async) }" class="resize-handle-filler">
<mat-icon svgIcon="hgrip" class="hgrip-icon"></mat-icon>

</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,13 @@
<div
class="tool-menu"
*ngIf="(scene || sarviewEvent) && breakpoint$ | async as breakpoint"
[ngStyle]="{ bottom: searchType === searchTypes.BASELINE
&& breakpoint <= breakpoints.MEDIUM
? '20px' : breakpoint < breakpoints.SMALL ? '17px' : '0' }"
[ngStyle]="{
bottom:
searchType === searchTypes.BASELINE && breakpoint <= breakpoints.MEDIUM ?
'20px' : breakpoint < breakpoints.SMALL ? '17px' : '0'
}"
[ngClass]="{
'menu-override': (searchType === searchTypes.BASELINE
&& breakpoint === breakpoints.FULL)
'menu-override': (searchType === searchTypes.BASELINE && breakpoint === breakpoints.FULL)
}
">
<div class="search-button-label">{{ 'SEARCH' | translate | uppercase }}:</div>
Expand Down Expand Up @@ -322,7 +323,7 @@

<div
[matTooltip]="
searchType === searchTypes.SARVIEWS_EVENTS ? ( 'GEOGRAPHIC_SEARCH_BASED_ON_EVENT_POLYGON' | translate ) :
searchType === searchTypes.SARVIEWS_EVENTS ? ( 'GEOGRAPHIC_SEARCH_BASED_ON_EVENT_POLYGON' | translate ) :
(
dataset?.id === 'OPERA-S1' ? ('OPERA_S1_SOURCE_DATA' | translate) :
(dataset?.id === 'SENTINEL-1 BURSTS' ? ('GEOGRAPHIC_SEARCH_BASED_ON_BURST' | translate) :
Expand Down Expand Up @@ -350,16 +351,6 @@
<span *ngIf="breakpoint != breakpoints.MOBILE">{{searchType !== searchTypes.SARVIEWS_EVENTS ? dataset?.id === 'OPERA-S1' ? ('SOURCE_DATA' | translate) : ('MORE_LIKE_THIS' | translate ) : ('GEOGRAPHIC' | translate )}}</span>
</button>

<!-- <button *ngIf="dataset?.id === 'OPERA-S1'"
mat-stroked-button
color="primary"
[disabled]="!(dataset?.id === 'OPERA-S1' && (scene.metadata.productType === 'RTC' || scene.metadata.productType === 'CSLC'))"
(click)="staticLayer()"
class="mini-toggle-button search-button">
<span *ngIf="breakpoint === breakpoints.MOBILE">{{ 'Static' }}</span>
<span *ngIf="breakpoint != breakpoints.MOBILE">{{'STATIC_LAYER' | translate}}</span>
</button> -->
</div>
<div *ngIf="searchType === searchTypes.SARVIEWS_EVENTS"
matTooltip="{{ 'USE_THIS_EVENT_S_PRODUCT_SCENES_IN_LIST_SEARCH' | translate }}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,11 @@ export class SceneDetailComponent implements OnInit, OnDestroy {
}

public sceneCanInSAR(): boolean {
return this.dataset.id === models.sentinel_1.id ? true : this.selectedProducts
.map(product => product.metadata.canInSAR)
.some(canInSAR => !!canInSAR);
return this.dataset.id === models.sentinel_1.id ||
this.selectedProducts
.map(product => product.metadata.canInSAR)
.some(canInSAR => !!canInSAR);
;
}

public baselineSceneName(): string {
Expand All @@ -223,7 +225,7 @@ export class SceneDetailComponent implements OnInit, OnDestroy {

if (this.dataset.id === models.sentinel_1.id) {
return this.selectedProducts.filter(
product => product.metadata.productType === 'SLC' || product.metadata.productType === 'BURST'
product => product.metadata.productType === 'SLC' || product.metadata.productType === 'BURST'
)[0].name;
} else {
return this.scene.name;
Expand All @@ -233,8 +235,8 @@ export class SceneDetailComponent implements OnInit, OnDestroy {
public sceneHasBrowse() {
return (
!!this.scene.browses &&
this.scene.browses.length > 0 &&
!this.scene?.browses[0].includes('no-browse')
this.scene.browses.length > 0 &&
!this.scene?.browses[0].includes('no-browse')
);
}

Expand Down Expand Up @@ -313,14 +315,14 @@ export class SceneDetailComponent implements OnInit, OnDestroy {

this.browseIndex = newIndex;
let [url, wkt] = this.searchType === this.searchTypes.SARVIEWS_EVENTS
? [this.selectedEventProducts[this.browseIndex].files.browse_url, this.selectedEventProducts[this.browseIndex]?.granules[0].wkt]
: [this.scene.browses[this.browseIndex], this.scene.metadata.polygon];
? [this.selectedEventProducts[this.browseIndex].files.browse_url, this.selectedEventProducts[this.browseIndex]?.granules[0].wkt]
: [this.scene.browses[this.browseIndex], this.scene.metadata.polygon];

// for OPERA-S1 geotiffs
// if(this.scene?.id.startsWith('OPERA')) {
// url = this.scene.downloadUrl;
// }

this.mapService.setSelectedBrowse(url, wkt);
}

Expand Down Expand Up @@ -496,7 +498,7 @@ export class SceneDetailComponent implements OnInit, OnDestroy {

private getBrowseCount() {
return this.searchType === this.searchTypes.SARVIEWS_EVENTS
? this.selectedEventProducts.length : this.scene.browses.length;
? this.selectedEventProducts.length : this.scene.browses.length;
}

ngOnDestroy() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component, OnDestroy, OnInit } from '@angular/core';
import { saveAs } from 'file-saver';

import { combineLatest, } from 'rxjs';
import { combineLatest } from 'rxjs';
import { debounceTime, filter, map, tap } from 'rxjs/operators';
import { Store } from '@ngrx/store';

Expand All @@ -14,7 +14,7 @@ import * as filtersStore from '@store/filters';
import { faCopy } from '@fortawesome/free-solid-svg-icons';

import {
MapService, ScenesService, ScreenSizeService,
MapService, ScenesService, ScreenSizeService, PossibleHyp3JobsService,
PairService, Hyp3Service, SarviewsEventsService, NotificationService
} from '@services';

Expand All @@ -35,7 +35,6 @@ export class ScenesListHeaderComponent implements OnInit, OnDestroy {
public pairs$ = this.pairService.pairs$;
private pairProducts$ = this.pairService.productsFromPairs$;


public totalResultCount$ = combineLatest([
this.store$.select(searchStore.getSearchAmount),
this.scenesService.scenes$]
Expand All @@ -56,7 +55,7 @@ export class ScenesListHeaderComponent implements OnInit, OnDestroy {
public downloadableProds = [];
public sarviewsEventProducts: SarviewsProduct[] = [];
public pinnedEventIDs: string[];

public productsByType$: Observable<{[key:string]: models.CMRProduct[]}> = this.store$.select(scenesStore.getAllProducts).pipe(
map((scenes: []) =>
scenes.reduce((prev, curr: models.CMRProduct) => {
Expand Down Expand Up @@ -85,8 +84,7 @@ export class ScenesListHeaderComponent implements OnInit, OnDestroy {
private products$ = this.scenesService.products$();
private operaProductsByType: {[key:string]: models.CMRProduct[]} = {}

public isBurstStack$ =
combineLatest([
public isBurstStack$ = combineLatest([
this.products$,
this.pairService.pairs$,
this.store$.select(searchStore.getSearchType),
Expand All @@ -97,11 +95,12 @@ export class ScenesListHeaderComponent implements OnInit, OnDestroy {
|| (currentSearchType === this.SearchTypes.SBAS &&
(
(pairs.pairs?.length > 0 ? pairs.pairs[0][0].metadata.productType === 'BURST' : false)
|| (pairs.custom?.length > 0 ? pairs.custom[0][0].metadata.productType === 'BURST' : false)
|| (pairs.custom?.length > 0 ? pairs.custom[0][0].metadata.productType === 'BURST' : false)
)
)
)
)
)

public numPairs$ = this.pairService.pairs$.pipe(
filter(pairs => !!pairs),
map(pairs => pairs.pairs.length + pairs.custom.length)
Expand Down Expand Up @@ -195,6 +194,7 @@ export class ScenesListHeaderComponent implements OnInit, OnDestroy {
private hyp3: Hyp3Service,
private clipboard: ClipboardService,
private notificationService: NotificationService,
private possibleHyp3JobsService: PossibleHyp3JobsService,
) { }

ngOnInit() {
Expand All @@ -205,39 +205,40 @@ export class ScenesListHeaderComponent implements OnInit, OnDestroy {
);

this.subs.add(
combineLatest([
this.products$,
this.pairs$
]
).subscribe(
([products, { pairs, custom }]) => {
this.products = products;
this.downloadableProds = this.hyp3.downloadable(products);
this.pairs = [...pairs, ...custom];

this.hyp3able = this.hyp3.getHyp3ableProducts([
...this.products.map(prod => [prod]),
...this.pairs
]);
}
)
this.possibleHyp3JobsService.possibleJobs$
.subscribe(
possibleJobs => {
this.hyp3able = this.hyp3.getHyp3ableProducts(possibleJobs);
}
)
);

this.subs.add(
this.products$.subscribe(products => {
this.products = products;
this.downloadableProds = this.hyp3.downloadable(products);
})
);

this.subs.add(
this.pairs$.subscribe(({pairs, custom}) => this.pairs = [...pairs, ...custom])
);

this.subs.add(
combineLatest([
this.scenesService.scenes$,
this.store$.select(filtersStore.getProductTypes),
this.store$.select(searchStore.getSearchType),
this.store$.select(filtersStore.getSelectedDataset)]
this.store$.select(filtersStore.getSelectedDataset)]
).pipe(
debounceTime(250)
).subscribe(([scenes, productTypes, searchType, selectedDataset]) => {
this.canHideRawData =
searchType === models.SearchType.DATASET &&
scenes.every(scene => scene.dataset === 'Sentinel-1B' || scene.dataset === 'Sentinel-1A') &&
productTypes.length <= 0
&& selectedDataset.id !== models.opera_s1.id;
})
debounceTime(250)
).subscribe(([scenes, productTypes, searchType, selectedDataset]) => {
this.canHideRawData =
searchType === models.SearchType.DATASET &&
scenes.every(scene => scene.dataset === 'Sentinel-1B' || scene.dataset === 'Sentinel-1A') &&
productTypes.length <= 0
&& selectedDataset.id !== models.opera_s1.id;
})
);

this.subs.add(
Expand Down Expand Up @@ -374,22 +375,22 @@ export class ScenesListHeaderComponent implements OnInit, OnDestroy {

public onDownloadPairCSV() {
const pairRows = this.pairs
.map(([reference, secondary]) => {
.map(([reference, secondary]) => {

const temporalBaseline = Math.abs(reference.metadata.temporal - secondary.metadata.temporal);
const perpendicularBaseline = Math.abs(reference.metadata.perpendicular - secondary.metadata.perpendicular);
const temporalBaseline = Math.abs(reference.metadata.temporal - secondary.metadata.temporal);
const perpendicularBaseline = Math.abs(reference.metadata.perpendicular - secondary.metadata.perpendicular);

return (
`${reference.name},${reference.downloadUrl},` +
return (
`${reference.name},${reference.downloadUrl},` +
`${secondary.name},${secondary.downloadUrl},` +
`${perpendicularBaseline},${temporalBaseline}`
);
})
.join('\n');
);
})
.join('\n');

const pairsHeader =
`Reference, Reference URL, Secondary, Secondary URL, ` +
`Pair Perpendicular Baseline (meters), Pair Temporal Baseline (days)`;
`Pair Perpendicular Baseline (meters), Pair Temporal Baseline (days)`;

const pairsCSV = `${pairsHeader}\n${pairRows}`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
[offsets]="offsets"
[searchType]="searchType"
[isQueued]="allQueued[getGroupCriteria(scene)]"
[hyp3ableByJobType]="hyp3ableByScene[scene.groupId]"
[hyp3ableByJobType]="hyp3ableByScene[scene.groupId] || hyp3ableByScene[scene.name]"
[jobQueued]="allJobNames.includes(scene.name)"
[numQueued]="numberOfQueue[scene.groupId]"
[isSelected]="scene.id === selected">
Expand Down
Loading

0 comments on commit 090ab71

Please sign in to comment.