Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

short-circuit for sampleRasterStackByMU() when number of pixels is low #8

Open
dylanbeaudette opened this issue Dec 6, 2017 · 0 comments

Comments

@dylanbeaudette
Copy link
Member

There should be a that indicates whether or not to use samples or all of the pixels within a polygon. For example:

  • 10m slope map: n_.samples << n_.pixels → use samples
  • 800m PRISM: n_.samples >> n_.pixels → use all pixels within polygon

Right now, sampling is done in this context:

# extract raster data, sample ID, polygon ID to DF
      l.mu[[mu.i]] <- rapply(raster.list, how = 'replace', f=function(r) {
        res <- data.frame(value=raster::extract(r, s), pID=s$pID, sid=s$sid)
        return(res)
      })

Alternatively, we can make the change earlier in the algorithm before constantDensitySampling() as a way to save some time. The short-circuit would use the pixel centers as the sampling points so that all following code could remain the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant