Skip to content

resampling typo silently becomes "near" in dft_stac_cube / dft_stac_composite / dft_stac_fetch #96

Description

@NewGraphEnvironment

Problem

resampling goes straight into gdalcubes::cube_view(). The mechanism is the same one that #92 hit for aggregation: gdalcubes 0.7.5 reads a value it does not know as a default and raises no error. For resampling that default is "near".

Measured by round-tripping values through cube_view(...)$resampling:

bilinear -> bilinear
bilinaer -> near
foo      -> near
Bilinear -> bilinear     # case-insensitive
cubic    -> cubic

So dft_stac_cube(aoi, resampling = "bilinaer") returns a nearest-neighbour cube and caches it under the misspelt key, with no warning. The three callers are stac_cube_assemble() (R/dft_stac_cube.R, used by the cube and the composite) and fetch_extent_to() (R/dft_stac_fetch.R).

Ask

Validate resampling the same way #92 validates aggregation:

  • Build the allowed set by measuring the cube_view() round trip, not from ?cube_view.
  • Match case-insensitively.
  • Run the check before any network call.
  • Pin the set with a behaviour test.

Found by the /code-check round-3 review on #92.

Landed (#98, v0.21.0)

The full round trip on gdalcubes 0.7.5 found more than the five values above:

  • Twelve come back unchanged and form the allowed set: near bilinear cubic cubicspline lanczos average mode max min med q1 q3.
  • Two are honoured under another name: mean -> average and median -> med. These are refused, and the error names the spelling to use, so each method has one spelling. Refusing them breaks calls that used to give correct output, hence a minor release.
  • Everything else becomes near, including GDAL's sum, rms and gauss, plus nearest.

The check runs at all three entry points and again at both cube_view() call sites. fetch_extent_to() also gained the #92 aggregation_check() it lacked.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions