Resample to Integer Values

Hi,

when resampling a data-cube to a specific resolution, e.g. 25 m using resample_spatial the results
do not have integer cell sizes. The process works without a problem, see code below, but the resulting
resolution is 25.18 x 25.18 m.

collections = "SENTINEL2_L2A_SENTINELHUB"
bands = c("B02", "B03", "B04", "B08", "SCL")
period = c("2021-04-01", "2021-06-30")
ext = list(11.14079 , 49.75891, 11.1432, 49.76039)
names(ext) = c("west", "south", "east", "north")
dir = tempdir()

# change to login with your credentials
# con = openeo::connect("https://openeo.cloud")
# login(
#     login_type = "oidc"
#     , provider = "egi"
#     , config = list(
#         client_id = "<client_id>"
#         , secret = "<secret>"
#     )
# )

procs = processes()

cube = procs$load_collection(
    id = collections
    , spatial_extent = ext
    , temporal_extent = period
    , bands = bands
)

cube_proj = procs$resample_spatial(
    cube
    , projection = 3035
    , method = "near"
)

cube_res = procs$resample_spatial(
    data = cube_proj
    , resolution = 25L
)

## create and start job
job = openeo::create_job(cube_res)
openeo::start_job(job)

id = as.character(job$id)
jobs = openeo::list_jobs()
jobs[[id]]


## download files
openeo::download_results(
    job = jobs[[id]]$id
    , folder = dir
)

## create stars object
fls = list.files(dir, pattern = "^openEO_", full.names = TRUE)
stars = stars::read_stars(fls, along = "time")
stars = stats::setNames(stars, nm = "value")

This is not an urgent issue as it is easily fixable client-side. However, having the option to resample backend-side it would be preferable to be able to do so.

Best regards!

Thanks for reporting, we’ll need to investigate why the resolution is not respected more strictly.