Skip to content

Commit

Permalink
fix: Handle resolution multiple of 10 TDE-968
Browse files Browse the repository at this point in the history
  • Loading branch information
l0b0 committed Nov 29, 2023
1 parent c86cfd4 commit 8cffe3a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/commands/lint/__test__/lint.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@ describe('lintImageryPaths', () => {
it('Should Fail - Trailing 0', () => {
assert.throws(() => {
lintImageryPath('/auckland/auckland_2020_0.20m/rgb/2193/');
}, Error('Trailing 0 in resolution of dataset name: auckland_2020_0.20m'));
}, Error('Trailing 0 in resolution fraction of dataset name: auckland_2020_0.20m'));
});
it('Should Pass', () => {
it('Should pass with fractional resolution', () => {
lintImageryPath('/auckland/auckland_2020_0.2m/rgb/2193/');
});
it('should pass with resolution multiple of 10', () => {
lintImageryPath('/auckland/auckland_2020_20m/rgb/2193/');
});
});
5 changes: 3 additions & 2 deletions src/commands/lint/lint.s3.paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ export function lintImageryPath(pathName: string): void {
throw new Error(`crs not in crs list: ${crs}`);
}
const resolution = dataset.split('_').pop()?.replace('m', '');
if (resolution?.endsWith('0')) {
throw new Error(`Trailing 0 in resolution of dataset name: ${dataset}`);
const [_resolutionInteger, resolutionFraction] = resolution.split('.', 2);
if (resolutionFraction?.endsWith('0')) {
throw new Error(`Trailing 0 in resolution fraction of dataset name: ${dataset}`);
}
}

0 comments on commit 8cffe3a

Please sign in to comment.