Repository navigation
RasterSource.resolutions becomes List[CellSize] - #3124
Merged
Merged
Conversation
Add Dimensions and use them for intersection check
Other changes not documented because they were changes from 3.0-SNAPSHOT rather than 2.3
Contributor
Author
|
While preparing this PR following issue was discovered: #3123 |
pomadchin
approved these changes
Oct 15, 2019
|
|
||
| // random chip to test agains, to speed up tests | ||
| val gridBounds = RasterExtent(randomExtentWithin(actual.extent), actual.cellSize).gridBounds | ||
| val gridBounds = actual.rasterExtent.gridBoundsFor(randomExtentWithin(actual.extent)) |
Member
There was a problem hiding this comment.
I'm surprised how much better it looks!
| cellType: CellType, | ||
| gridExtent: GridExtent[Long], | ||
| resolutions: List[GridExtent[Long]], | ||
| resolutions: List[CellSize], |
Member
There was a problem hiding this comment.
👍 finally these are resolutions indeed.
| } | ||
|
|
||
| object Dimensions { | ||
| implicit def apply[N: Integral](tup: (N, N)) = new Dimensions(tup._1, tup._2) |
Member
There was a problem hiding this comment.
Just a notion: boxing happens here, but we don't care too much about it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR is intended to address usability issues around resampling RasterSource described in #3100
RasterSource.resolutions is not
List[CellSize]. As discussed in the issue this removes the ability to provideGridBoundsfromRasterSource.resolutionsto theRasterSource.readmethod of the same instance. The judgement call is that if each overview somehow has differing extent this is considered very unusual and can be diagnosed by further digging intoRasterMetadatainterface or through additional specialized API.Grid.gridBounds are removed. This added a very confusing case where
GridBoundscould either be a window in some raster or describe the whole footprint of raster. RemovingGrid.gridBoundsgoes a long way to remove that confusion. This is a recently added member to the class, so impact is judged to be small.GridBounds.intersects(dimensions) - For those cases when we're checking for intersection with a raster we're using the new
Dimensionsclass.Dimensionscan be checked for intersection vsGridBoundsand intersection ofGridBoundsandDimensionsis smallerOption[GridBounds].Grid.dimensions becomes
Dimensions[N]Instead of(N, N)- with addition of specialized API described above. Giving this a class goes a long way to clarify its usage in API. Note that this change results in fix-ups to tests that could be be caught by compiler due to checking for equality with "==". This is likely to happen in client code but should be easily fixed.Checklist
docs/CHANGELOG.rstupdated, if necessarydocsguides update, if necessaryNotes
Closes #3100