Skip to content

filenames are duplicated when composite_function=NULL #90

Closed
@h-a-graham

Description

@h-a-graham

Please briefly describe your problem and what output you expect:

When composite = NULL filenames are duplicated. I would expect unique filenames.

I think what's happening here is duplication rather than overwriting any data...

I'll take a closer look asap. 👍

aoi <- sf::st_point(c(-74.912131, 44.080410))
aoi <- sf::st_set_crs(sf::st_sfc(aoi), 4326)
aoi <- sf::st_buffer(sf::st_transform(aoi, 3857), 100)

out <- rsi::get_sentinel2_imagery(
  aoi,
  "2022-06-01",
  "2022-06-30",
  output_filename = tempfile(fileext = ".tif"),
  mask_function = rsi::sentinel2_mask_function,
  composite_function = NULL
)

print(out)
#>  [1] "/tmp/RtmpjBc47p/fileb4cb845f6d1c1_2022-06-29T154821.024000Z.tif"
#>  [2] "/tmp/RtmpjBc47p/fileb4cb845f6d1c1_2022-06-29T154821.024000Z.tif"
#>  [3] "/tmp/RtmpjBc47p/fileb4cb845f6d1c1_2022-06-24T154819.024000Z.tif"
#>  [4] "/tmp/RtmpjBc47p/fileb4cb845f6d1c1_2022-06-24T154819.024000Z.tif"
#>  [5] "/tmp/RtmpjBc47p/fileb4cb845f6d1c1_2022-06-19T154821.024000Z.tif"
#>  [6] "/tmp/RtmpjBc47p/fileb4cb845f6d1c1_2022-06-19T154821.024000Z.tif"
#>  [7] "/tmp/RtmpjBc47p/fileb4cb845f6d1c1_2022-06-14T154819.024000Z.tif"
#>  [8] "/tmp/RtmpjBc47p/fileb4cb845f6d1c1_2022-06-14T154819.024000Z.tif"
#>  [9] "/tmp/RtmpjBc47p/fileb4cb845f6d1c1_2022-06-09T154821.024000Z.tif"
#> [10] "/tmp/RtmpjBc47p/fileb4cb845f6d1c1_2022-06-09T154821.024000Z.tif"
#> [11] "/tmp/RtmpjBc47p/fileb4cb845f6d1c1_2022-06-04T154809.024000Z.tif"
#> [12] "/tmp/RtmpjBc47p/fileb4cb845f6d1c1_2022-06-04T154809.024000Z.tif"
duplicated(out)
#>  [1] FALSE  TRUE FALSE  TRUE FALSE  TRUE FALSE  TRUE FALSE  TRUE FALSE  TRUE

Created on 2025-01-21 with reprex v2.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions