Skip to content

Commit

Permalink
Merge pull request #219 from wearepal/load-datasets-NaN-values
Browse files Browse the repository at this point in the history
Error handling for no coverage in load dataset component
  • Loading branch information
paulthatjazz authored Nov 30, 2023
2 parents e768c49 + d469d17 commit 275eac6
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,18 @@ export class PrecompiledModelComponent extends BaseComponent {
out.set(x, y, val)
})
} else if (model instanceof NumericTileGrid) {
const out = outputs['out'] = editorNode.meta.output = new NumericTileGrid(this.projectZoom, outputTileRange.minX, outputTileRange.minY, outputTileRange.getWidth(), outputTileRange.getHeight(), NaN)
const out = new NumericTileGrid(this.projectZoom, outputTileRange.minX, outputTileRange.minY, outputTileRange.getWidth(), outputTileRange.getHeight(), NaN)
out.iterate((x, y, v) => {
let val = model.get(x, y, this.projectZoom) ? model.get(x, y, this.projectZoom) as number : NaN
out.set(x, y, val)
})

if(out.getMinMax()[1] === -Infinity) {
editorNode.meta.errorMessage = "No valid data found in dataset. Possible cause: no coverage for selected area."
outputs['out'] = editorNode.meta.output = undefined
}else{
outputs['out'] = editorNode.meta.output = out
}
}

}
Expand Down

0 comments on commit 275eac6

Please sign in to comment.