Skip to content

rasterToMatch with no values produces warning in prepInputs and friends #423

@achubaty

Description

@achubaty

I don't think there is a reason that RTM needs values in order to get the crs, origin, res etc. from the raster.

From PredictiveEcology/LandR#118

  cPath <- withr::local_tempdir("cache")
  dPath <- withr::local_tempdir("inputs")

  withr::local_options(reproducible.cachePath = cPath)

  withr::local_seed(123)

  SA <- randomStudyArea(size = 10000000)
  RTM <- rast(SA, resolution = 250)
  sppEquiv <- sppEquivalencies_CA
  sppEquivCol <- "KNN"

  sppEquiv <- sppEquiv[KNN %in% c("Pinu_Spp", "Popu_Tre", "Pice_Mar")]

  ## get all available species for 2001
  httr::with_config(config = httr::config(ssl_verifypeer = 0L), {
    speciesLayers <- LandR::loadkNNSpeciesLayers(
      dPath = dPath,
      rasterToMatch = RTM,
      studyArea = SA,
      year = 2001,
      url = paste0(
        "https://ftp.maps.canada.ca/pub/nrcan_rncan/Forests_Foret/",
        "canada-forests-attributes_attributs-forests-canada/",
        "2001-attributes_attributs-2001/"
      ),
      sppEquiv = sppEquiv,
      sppEquivCol = sppEquivCol,
      thresh = 0
    )
  })
  ## WARNING: [readValues] raster has no values

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions