Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import {
Component,
OnInit,
// OnInit,
Output,
EventEmitter,
OnDestroy,
inject,
// inject,
} from '@angular/core';
import * as models from '@models';
import * as filtersStore from '@store/filters';
import { Store } from '@ngrx/store';
import { AppState } from '@store';
// import * as filtersStore from '@store/filters';
// import { Store } from '@ngrx/store';
// import { AppState } from '@store';
import { SubSink } from 'subsink';
import {
MatSelectChange,
Expand All @@ -35,34 +35,34 @@ import { TranslateModule } from '@ngx-translate/core';
TranslateModule,
],
})
export class ShortNameSelectorComponent implements OnInit, OnDestroy {
private store$ = inject<Store<AppState>>(Store);
export class ShortNameSelectorComponent implements OnDestroy {
// private store$ = inject<Store<AppState>>(Store);

@Output() shortNamesChange = new EventEmitter<models.DatasetShortName>();
public dataset: models.Dataset;
public shortNamesList: string[] = [];
public selectableShortNames: models.ShortName[] = [];

private dataset$ = this.store$.select(filtersStore.getSelectedDataset);
// private dataset$ = this.store$.select(filtersStore.getSelectedDataset);

private subs = new SubSink();

ngOnInit(): void {
this.subs.add(
this.dataset$.subscribe((dataset) => {
this.dataset = dataset;
this.selectableShortNames = dataset?.shortNames ?? [];
}),
);
this.subs.add(
this.store$
.select(filtersStore.getShortNames)
.subscribe(
(shortNamesList) =>
(this.shortNamesList = shortNamesList.map((val) => val.apiValue)),
),
);
}
// ngOnInit(): void {
// this.subs.add(
// this.dataset$.subscribe((dataset) => {
// this.dataset = dataset;
// this.selectableShortNames = dataset?.shortNames ?? [];
// }),
// );
// this.subs.add(
// this.store$
// .select(filtersStore.getShortNames)
// .subscribe(
// (shortNamesList) =>
// (this.shortNamesList = shortNamesList.map((val) => val.apiValue)),
// ),
// );
// }

ngOnDestroy(): void {
this.subs.unsubscribe();
Expand All @@ -73,11 +73,11 @@ export class ShortNameSelectorComponent implements OnInit, OnDestroy {
this.emitShortNames(shortNameAPIValues);
}

public emitShortNames(shortNameAPIValues: string[]): void {
const shortNames = this.dataset?.shortNames ?? [];
const output = shortNameAPIValues.map((shortName) =>
shortNames.find((datasetType) => datasetType.apiValue === shortName),
);
this.shortNamesChange.emit(output);
public emitShortNames(_shortNameAPIValues: string[]): void {
// const shortNames = this.dataset?.shortNames ?? [];
// const output = shortNameAPIValues.map((shortName) =>
// shortNames.find((datasetType) => datasetType.apiValue === shortName),
// );
// this.shortNamesChange.emit(output);
}
}
2 changes: 1 addition & 1 deletion src/app/models/dataset.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export interface Dataset {

calibrationDatasets?: string[];
calibrationProductTypes?: ProductType[];
shortNames?: ShortName[]; // For NISAR shortnames
shortNames?: string[]; // For NISAR shortnames
instruments?: { displayName: string; apiValue: string }[];
bandwidth?: Record<string, string[]>;
frameMap?: {
Expand Down
40 changes: 40 additions & 0 deletions src/app/models/datasets/nisar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,46 @@ export const nisar = {
// apiValue: 'SB',
// }
],
shortNames: [
'NISAR_L0B_RRSD_BETA_V1',
'NISAR_L0B_RRSD_PROVISIONAL_V1',
'NISAR_L0B_RRSD_V1',
'NISAR_L1_RSLC_BETA_V1',
'NISAR_L1_RSLC_PROVISIONAL_V1',
'NISAR_L1_RSLC_V1',
'NISAR_L1_RIFG_BETA_V1',
'NISAR_L1_RIFG_PROVISIONAL_V1',
'NISAR_L1_RIFG_V1',
'NISAR_L1_RUNW_BETA_V1',
'NISAR_L1_RUNW_PROVISIONAL_V1',
'NISAR_L1_RUNW_V1',
'NISAR_L1_ROFF_BETA_V1',
'NISAR_L1_ROFF_PROVISIONAL_V1',
'NISAR_L1_ROFF_V1',
'NISAR_L2_GSLC_BETA_V1',
'NISAR_L2_GSLC_PROVISIONAL_V1',
'NISAR_L2_GSLC_V1',
'NISAR_L2_GCOV_BETA_V1',
'NISAR_L2_GCOV_PROVISIONAL_V1',
'NISAR_L2_GCOV_V1',
'NISAR_L2_GUNW_BETA_V1',
'NISAR_L2_GUNW_PROVISIONAL_V1',
'NISAR_L2_GUNW_V1',
'NISAR_L2_GOFF_BETA_V1',
'NISAR_L2_GOFF_PROVISIONAL_V1',
'NISAR_L2_GOFF_V1',
'NISAR_L3_SME2_BETA_V1',
'NISAR_L3_SME2_PROVISIONAL_V1',
'NISAR_L3_SME2_V1',

// urgent and custom response
'NISAR_CUSTOM_PROVISIONAL_V1',
'NISAR_UR_L0B_RRSD',
'NISAR_UR_L1',
'NISAR_UR_L2',
// 'NISAR_OE',
// 'NISAR_RP',
],
// shortNames: [
// {
// displayName: "NISAR Beta NEN Science Telemetry Data (Version 1)",
Expand Down
11 changes: 11 additions & 0 deletions src/app/services/search-params.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ export class SearchParamsService {
// ({dataset: models.opera_s1.calibrationDatasets}) : ({}))
// )

private useNisarShortnames$ = this.store$
.select(filterStore.getSelectedDatasetId)
.pipe(
map((dataset) =>
dataset === models.nisar.id
? { shortName: models.nisar.shortNames }
: {},
),
);

private groupID$ = this.store$.select(filterStore.getGroupID).pipe(
map((groupid) => ({
groupid,
Expand Down Expand Up @@ -305,6 +315,7 @@ export class SearchParamsService {
this.burstParams$,
this.operaBurstParams$,
// this.operaCalibrationParam$,
this.useNisarShortnames$,
this.sciProducts$,
this.groupID$,
]).pipe(
Expand Down