njtierney / geotargets

Targets extensions for geospatial data
https://njtierney.github.io/geotargets/
Other
54 stars 4 forks source link

Changing GDAL driver (`filetype`) doesn't invalidate target #103

Open Aariq opened 2 weeks ago

Aariq commented 2 weeks ago

I think updating the GDAL driver supplied via filetype should invalidate a target the same way changing format for tar_target() does.

targets::tar_dir({
    targets::tar_script({
        library(geotargets)
        list(
            tar_terra_rast(
                rast,
                terra::rast(system.file("ex/elev.tif", package = "terra")),
                filetype = "GTiff"
            )
        )
    })
    targets::tar_make()
    print("End of initial run")

    targets::tar_script({
        library(geotargets)
        list(
            tar_terra_rast(
                rast,
                terra::rast(system.file("ex/elev.tif", package = "terra")),
                filetype = "COG"
            )
        )
    })
    targets::tar_make()
    print("End of second run")
})
#> ▶ dispatched target rast
#> ● completed target rast [0.017 seconds, 7.992 kilobytes]
#> ▶ ended pipeline [0.156 seconds]
#> [1] "End of initial run"
#> ✔ skipped target rast
#> ✔ skipped pipeline [0.095 seconds]
#> [1] "End of second run"

Created on 2024-10-02 with reprex v2.1.1

njtierney commented 1 week ago

I agree with you, this feels similar to changing a file format from say .csv to .rds. I'd be curious what @mdsumner's thoughts are on this?