danddr / use Goto Github PK
View Code? Open in Web Editor NEWA R package to perform uniform sampling in the environmental space
Home Page: https://danddr.github.io/USE/
A R package to perform uniform sampling in the environmental space
Home Page: https://danddr.github.io/USE/
Fitting a PCA on large rasters can take a lot of time, so it could be useful to allow for a subsample of data to be used. This was done in RSToolbox
via the nsamples
argument. I believe this feature would only require a minor change to the code here, by allowing for a user specified value in rastPCA
to be passed to the maxcell
argument of terra::layerCor
.
I noticed a minor mistake and something that could be made more efficient in rastPCA
.
In rastPCA
, an NA mask is created using maskNA <- is.na(env.rast[[1]])
, but the [[1]]
indicates that it is only checking for NA
values in the first layer rather than all layers. RSToolbox
uses totalMask <- !sum(calc(img, is.na))
to check across all layers. RSToolbox
uses the raster
package, but the equivalent terra
code would be totalMask <- !sum(app(img, is.na))
.
I also noticed that the entire raster is coerced to a dataframe to get the sample size in eigenDecomp$n.obs <- nrow(as.data.frame(env.rast[[1]]))
. Converting the dataset to a dataframe slows things down and isn't memory safe. It'd be better to count up the valid cells (i.e. cells that don't have NA values in any layer). In RSToolbox
this is done with model$n.obs <- cellStats(!any(is.na(img)), sum)
. The equivalent terra
code would be model$n.obs <- global(!any(is.na(img)), sum)$sum
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.