hypertidy / vapour

GDAL API package for R
https://hypertidy.github.io/vapour/
83 stars 9 forks source link

read problem: for both read and warp #181

Closed mdsumner closed 1 year ago

mdsumner commented 1 year ago

terra ok (with the NSIDCbin driver)

terra::rast("../autotest/gdrivers/data/nsidcbin/nt_20220409_f18_nrt_s.bin")
class       : SpatRaster
dimensions  : 332, 316, 1  (nrow, ncol, nlyr)
resolution  : 25000, 25000  (x, y)
extent      : -3950000, 3950000, -3950000, 4350000  (xmin, xmax, ymin, ymax)
coord. ref. : WGS 84 / NSIDC Sea Ice Polar Stereographic South (EPSG:3976)
source      : nt_20220409_f18_nrt_s.bin
name        : nt_20220409_f18_nrt_s

but not vapour

 vapour::vapour_raster_info("../autotest/gdrivers/data/nsidcbin/nt_20220409_f18_nrt_s.bin")$dimension
[1] 316 332
> str(vapour::vapour_read_raster("../autotest/gdrivers/data/nsidcbin/nt_20220409_f18_nrt_s.bin", window = c(0,0, 316, 332)))
we have a problem at RasterIO
List of 1
 $ Band1: num [1:104912] 0 0 0 0 0 0 0 0 0 0 ...
Warning messages:
1: Failed to read scanline 331. (GDAL error 3)
2: /perm_storage/home/gdalbuilder/gdal/autotest/gdrivers/data/nsidcbin/nt_20220409_f18_nrt_s.bin, band 1: IReadBlock failed at X offset 0, Y offset 331: Failed to read scanline 331. (GDAL error 1)
> str(vapour::vapour_read_raster("../autotest/gdrivers/data/nsidcbin/nt_20220409_f18_nrt_s.bin", native = TRUE))
we have a problem at RasterIO
List of 1
 $ Band1: num [1:104912] 0 0 0 0 0 0 0 0 0 0 ...
Warning messages:
1: Failed to read scanline 331. (GDAL error 3)
2: /perm_storage/home/gdalbuilder/gdal/autotest/gdrivers/data/nsidcbin/nt_20220409_f18_nrt_s.bin, band 1: IReadBlock failed at X offset 0, Y offset 331: Failed to read scanline 331. (GDAL error 1)
> str(vapour::vapour_warp_raster("../autotest/gdrivers/data/nsidcbin/nt_20220409_f18_nrt_s.bin", extent = c(-3950000, 3950000, -3950000, 4350000 ), dimension = c(332, 316), projection = "EPSG:3031"))
Error in warp_in_memory_gdal_cpp(x, source_WKT = source_projection, target_WKT = projection,  :
  something went wrong!
In addition: Warning messages:
1: Failed to read scanline 331. (GDAL error 3)
2: ../autotest/gdrivers/data/nsidcbin/nt_20220409_f18_nrt_s.bin, band 1: IReadBlock failed at X offset 0, Y offset 331: Failed to read scanline 331. (GDAL error 1)

why was this not showing up before? Specific to Raw drivers?

image

mdsumner commented 1 year ago

this is the matrix plotted from vapour_read_raster, compared to polygons generated by terra (from raadtools) it has an extra row

image

mdsumner commented 1 year ago

this was a bug in someone's GDAL driver PR ... not a vapour problem

mdsumner commented 1 year ago

was fixed in this commit https://github.com/mdsumner/gdal/commit/32a00e228259d3912e61296daea382e48962b2f3