-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Workaround to overcome JPEG 2000 issue #139
Conversation
f764fc0
to
4eba751
Compare
Codecov Report
@@ Coverage Diff @@
## master #139 +/- ##
==========================================
+ Coverage 89.41% 89.43% +0.01%
==========================================
Files 30 30
Lines 4279 4287 +8
==========================================
+ Hits 3826 3834 +8
Misses 453 453
Continue to review full report at Codecov.
|
|
||
# HACK: We have to overcome https://github.com/mapbox/rasterio/issues/1449 here | ||
if self._filename.endswith('.jp2'): | ||
masked = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if mask is false, and in the orginal there existed a mask, we are not supporting this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.jp2 doesn't support internal mask, so one of the possible way to mask all pixels that extend beyond the dataset's extent is overwriting masked
to False: in this case crop
returns np.core.ndarray
and GeoRaster constructor converts it to masked array here. The drawback of this approach is that we masks legitimate 0 value pixels as well. The same issue you can observe while cropping GeoTIFF which doesn't contain any mask (internal, alpha or nodata).
This looks good to me: short and isolates the upstream issue. However, there's also the problem of the |
However, if I understand correctly your comment in rasterio/rasterio#1449 (comment), this isn't a JPEG2000-specific issue, is it? |
Yes, this isn't a JPEG2000-specific issue. Close this PR in favour of #141. |
Fix cropping for JPEG 2000 images.