Skip to content

Commit 2ea51a5

Browse files
committed
feat: file size for nisar products
1 parent dee04b9 commit 2ea51a5

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

src/app/models/cmr-product.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ export interface NISARMetadata {
104104
sideBandPolarization: string,
105105
mainBandPolarization: string,
106106
rangeBandwidth: string,
107+
sizeMB?: {[key: string]: {bytes: number, format: string}}
107108
}
108109

109110
export enum FlightDirection {

src/app/services/product.service.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ export class ProductService {
4040
if ( !filename.includes(g.gn)) {
4141
filename = `${g.gn}-${filename}`;
4242
}
43+
if(g.d === 'NISAR' && g.nsr.sizeMB) {
44+
// NISAR uses SizeInBytes instead of Size so doesn't populate the right field in the API.
45+
// the new property also auto converts to the right scale already
46+
g.s = (g.nsr.sizeMB[filename]?.bytes ?? 0) / 1000000;
47+
}
4348
let product = {
4449
name: g.gn,
4550
productTypeDisplay: g.ptd ?? g.gn,
@@ -311,7 +316,7 @@ export class ProductService {
311316
productTypeDisplay: productTypeDisplay || p,
312317
file: fileID,
313318
id: product.id + '-' + file_extension,
314-
bytes: 0,
319+
bytes: product.metadata.nisar?.sizeMB?.[fileID]?.bytes ?? 0,
315320
browses,
316321
thumbnail: null,
317322
metadata: {
@@ -323,7 +328,6 @@ export class ProductService {
323328
},
324329
virtual: true,
325330
} as models.CMRProduct;
326-
327331
products.push(subproduct)
328332
}
329333

0 commit comments

Comments
 (0)