예제 #1
0
    def _read(gbox, resampling='nearest',
              fallback_nodata=-999,
              dst_nodata=-999,
              check_paste=False):
        with RasterFileDataSource(mm.path, 1, nodata=fallback_nodata).open() as rdr:
            if check_paste:
                # check that we are using paste
                paste_ok, reason = can_paste(compute_reproject_roi(rdr_geobox(rdr), gbox))
                assert paste_ok is True, reason

            yy = np.full(gbox.shape, dst_nodata, dtype=rdr.dtype)
            roi = read_time_slice(rdr, yy, gbox, resampling, dst_nodata)
            return yy, roi
예제 #2
0
    def _read(gbox,
              resampling='nearest',
              fallback_nodata=-999,
              dst_nodata=-999,
              check_paste=False):

        rdr = open_reader(mm.path, nodata=fallback_nodata)
        if check_paste:
            # check that we are using paste
            paste_ok, reason = can_paste(
                compute_reproject_roi(rdr_geobox(rdr), gbox))
            assert paste_ok is True, reason

        yy = np.full(gbox.shape, dst_nodata, dtype=rdr.dtype)
        yy_, roi = read_time_slice_v2(rdr, gbox, resampling, dst_nodata)
        yy[roi] = yy_
        return yy, roi
예제 #3
0
 def check_false(dst, **kwargs):
     ok, reason = can_paste(compute_reproject_roi(src, dst), **kwargs)
     if ok:
         assert ok is False, "Expected can_paste to return False, but got True"
예제 #4
0
 def check_true(dst, **kwargs):
     ok, reason = can_paste(compute_reproject_roi(src, dst), **kwargs)
     if not ok:
         assert ok is True, reason