vapour icon indicating copy to clipboard operation
vapour copied to clipboard

chunked proc and write

Open mdsumner opened this issue 5 years ago • 4 comments

From Grant Williamson, how would this look from a vapour/gdalheaders perspective:

It’s occurred to me that what I would like is to be able to compile some C code into a little library, and then for there to be a GDAL function to “apply this C code over every cell in this multi-layer raster”.

https://twitter.com/ozjimbob/status/1269771043486306304?s=20

mdsumner avatar Jun 07 '20 23:06 mdsumner

also see new write_block internal function

mdsumner avatar Sep 09 '21 01:09 mdsumner

Now need this for the warper, and since /gdalwarpmem/ would be a bad name for it to live, we might

  • [ ] rewrite gdalwarp code to be in applib/, and just return the datasource - filename can be input or not
  • [ ] clean up the source_ args, assume we would pass in VRT now
  • [ ] rewrite gdalwarpmem to call this applib/warp and simply read the values as it does now.

mdsumner avatar Jun 22 '22 06:06 mdsumner

also see #152

mdsumner avatar Jun 22 '22 22:06 mdsumner

begin in https://github.com/hypertidy/vapour/commit/70d7e9dc1bd0dddd57af11543154dd03411e07d3




warp_to_file <- function(x, 
                         target_crs = "OGC:CRS84", 
                         target_extent = c(-180, 180, -90, 90), 
                         target_dim = c(360, 180), 
                         target_filename, 
                         bands = 1, 
                         resample = "near", 
                         silent = TRUE, 
                         band_output_type = "FLOAT32", 
                         warp_options = "", 
                         transformation_options = "" ) {
  
  if (file.exists(target_filename)) stop("file exists")
vapour:::raster_warp_file_cpp(source_filename = x, 
                     target_crs = target_crs, 
                     target_extent = target_extent, 
                     target_dim = target_dim, 
                     target_filename = target_filename, 
                     bands = bands, 
                     resample = resample, 
                     silent = silent, 
                     band_output_type = band_output_type, 
                     warp_options = warp_options, 
                     transformation_options = transformation_options)
}



f <- "/vsicurl/https://public.services.aad.gov.au/datasets/science/GEBCO_2019_GEOTIFF/GEBCO_2019.tif"


warp_to_file(c(f[1]), target_extent = c(34.99986, 36.00014, 45.99986, 47.00014 ), target_dim = c(512, 512), resample = "bilinear", target_filename = tfile <- tempfile(fileext = ".tif"))



mdsumner avatar Jun 24 '22 10:06 mdsumner