Thanks to visit codestin.com
Credit goes to github.com

Skip to content

tar_terra_rast() doesn't save metadata #58

@Aariq

Description

@Aariq

I suspect this is because those metadata are stored in a "sidecar file" when filetype = "GeoTIFF", but I haven't investigated further.

library(targets)
tar_script({
    make_rast <- function() {
        x <- terra::rast(system.file("ex/elev.tif", package = "terra"))
        terra::units(x) <- "m"
        terra::varnames(x) <- "elev"
        x
    }
    list(
        geotargets::tar_terra_rast(
            rast,
            make_rast()
        )
    )
})
tar_make()
#> ▶ dispatched target rast
#> ● completed target rast [0.017 seconds]
#> ▶ ended pipeline [0.148 seconds]
tar_load(rast)
terra::units(rast)
#> [1] ""
terra::varnames(rast)
#> [1] "rast"
terra::names(rast)
#> [1] "elevation"

Created on 2024-04-25 with reprex v2.1.0

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpriority: highterrarelated to compatibility with `terra`

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions