Last active
April 28, 2023 13:21
-
-
Save JimShady/30c101c8db681c6fce2b8e967e32b452 to your computer and use it in GitHub Desktop.
Confusion around gdal options in terra
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This works | |
test_extent <- ext(rast("lk_run_2023-04-27-15-05-37_30m_aal.tif")) | |
rast_input <- rast("global_commercial_base_annual_average_damage_ratio.tif", win = test_extent) | |
lapp(rast_input, | |
fun = function(x) {x/10000}, | |
filename = "global_commercial_base_annual_average_damage_ratio_floating_point.tif", | |
wopt = list(datatype = "FLT4S"), | |
overwrite = TRUE) | |
# This does not | |
test_extent <- ext(rast("lk_run_2023-04-27-15-05-37_30m_aal.tif")) | |
rast_input <- rast("global_commercial_base_annual_average_damage_ratio.tif", win = test_extent) | |
lapp(rast_input, | |
fun = function(x) {x/10000}, | |
filename = "global_commercial_base_annual_average_damage_ratio_floating_point.tif", | |
wopt = list(datatype = "FLT4S"), | |
overwrite = TRUE, | |
gdal = c("TILED = YES", "BLOCKXSIZE = 128", "BLOCKYSIZE = 128")) | |
Error in (function (x) : | |
unused argument (gdal = c("TILED = YES", "BLOCKXSIZE = 128", "BLOCKYSIZE = 128")) | |
Error: [lapp] cannot use 'fun'. The number of values returned is less than the number of input cells. | |
(returning: 1, expecting: 9000) | |
Perhaps the function is not properly vectorize |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
fwiw, here's what I'm messing around with - my tif is 86400x43200 I expect yours is much bigger if its compressed
https://gist.github.com/mdsumner/abc467acfb747af3c5d20fe6447cdef8
interested to flesh these out, and help build a resource, maybe at https://github.com/gdal4al/
good night :)