You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's say we want to compare a large raster and a small raster covering only a subsample of the larger raster. If the large raster is too large to fit in memory, or simply it takes long to load, it would be interesting to load the two rasters only over common area. Currently, doing this would require several lines of code. This is not really implemented if the two rasters have different CRS.
r1 = gu.Raster(file1, load_data=False)
r2 = gu.Raster(file2, load_data=False)
intersection = gu.projtools.merge_bounds([r1.bounds, r2.get_bounds_projected(r1.crs)], "intersection")
r1 = gu.Raster(file1, load_data=intersection)
# Need to convert intersection into r2's CRS, which is not straightforward
r2 = gu.Raster(file2, load_data=intersection_r2)
Another option is to modify the behavior of Raster.reproject to not work on self.data, but on the dataset directly. This may become difficult after PR #265.
The text was updated successfully, but these errors were encountered:
Need to convert intersection into r2's CRS, which is not straightforward
Actually, this can be done in one line as in Raster.get_bounds_projected: rio.warp.transform_bounds(src_crs, dst_crs, left, bottom, right, top, densify_pts)
Let's say we want to compare a large raster and a small raster covering only a subsample of the larger raster. If the large raster is too large to fit in memory, or simply it takes long to load, it would be interesting to load the two rasters only over common area. Currently, doing this would require several lines of code. This is not really implemented if the two rasters have different CRS.
Same CRS:
Different CRS:
Another option is to modify the behavior of Raster.reproject to not work on self.data, but on the dataset directly. This may become difficult after PR #265.
The text was updated successfully, but these errors were encountered: