Skip to content

Instantly share code, notes, and snippets.

@alfcrisci
Created May 26, 2017 13:48
Show Gist options
  • Select an option

  • Save alfcrisci/079bc644ff17fb5fefa67fa5f30847b2 to your computer and use it in GitHub Desktop.

Select an option

Save alfcrisci/079bc644ff17fb5fefa67fa5f30847b2 to your computer and use it in GitHub Desktop.
calc_climatology_stack=function(temp) {
require(raster)
res=list()
res$mean_WT=calc(temp,mean,na.rm=T);
res$sd_WT=calc(temp,sd,na.rm=T);
res$q33=calc(temp,fun=function(x) quantile(x,probs=c(0.33),na.rm=T));
res$median=calc(temp,fun=function(x) quantile(x,probs=c(0.5),na.rm=T));
res$q66=calc(temp,fun=function(x) quantile(x,probs=c(0.66),na.rm=T));
return(res)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment