Skip to content

Commit

Permalink
fix: reduce the amount logging for files
Browse files Browse the repository at this point in the history
"files" also conflicts so change to a new key
  • Loading branch information
blacha committed Jun 9, 2022
1 parent cb50bcf commit d2b60d4
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions packages/cli/src/cog/job.factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ function filterTiff(a: string): boolean {
return lowerA.endsWith('.tiff') || lowerA.endsWith('.tif');
}

/** Group a file list by its zoom */
function groupFiles(files: { name: string }[]): Record<string, number> {
const fileCounts: Record<string, number> = {};
for (const f of files) {
const zoom = f.name.split('-')[0];
fileCounts[zoom] = (fileCounts[zoom] ?? 0) + 1;
}
return fileCounts;
}

export const CogJobFactory = {
/**
* Create a COG Job and potentially submit it to AWS Batch for processing
Expand Down Expand Up @@ -81,11 +91,9 @@ export const CogJobFactory = {
...metadata,
tileMatrix: ctx.tileMatrix.identifier,
bounds: undefined,
files: undefined,
fileCount: files.length,
files: metadata.files
.map((r) => r.name)
.sort()
.join(' '),
fileGroups: groupFiles(metadata.files),
},
'CoveringGenerated',
);
Expand Down

0 comments on commit d2b60d4

Please sign in to comment.