Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • CSTools CSTools
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 28
    • Issues 28
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 2
    • Merge requests 2
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • External
  • CSToolsCSTools
  • Merge requests
  • !79

CST_RFWeights working on s2dv_cube objects

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged Nuria Pérez-Zanón requested to merge develop-CST_Weights into master Sep 22, 2020
  • Overview 13
  • Commits 12
  • Pipelines 8
  • Changes 5

Hi @jhardenberg and @silvia,

Allowing CST_RFWeights work on s2dv_cube objects, the users will be able to download WorldClim in R and compute the weighs:

library(CSTools); library(raster); library(s2dv)
worldclim <- getData("worldclim", var = "prec", res = 0.5, lon = 5, lat = 45)
wc_month1 <- crop(worldclim[[1]], extent(3.5, 11.5, 41.5, 49.5))
xy <- xyFromCell(wc_month1, 1:length(wc_month1))
lons <- unique(xy[,1])
lats <- unique(xy[,2])
wc_data <- as.array(wc_month1)
dim(wc_data) <- c(lat = length(lats), lon = length(lons))
worldclim <- s2dv_cube(data = wc_data, lon = lons, lat = lats, Datasets = 'WorldClim')
PlotEquiMap(wc_data, lon = lons, lat = lats, filled.continents = FALSE)
 
source("/esarchive/scratch/nperez/git/cstools/R/CST_RFWeights.R")
weight1 <- CST_RFWeights(worldclim, nf = 4)

In the current fix, I don't understand the difference between 'latin' vs 'lat' and 'lonin' vs 'lon'. This may be very easy to solve by @jhardenberg.

This fix could be also improved by returning the final longitudes and latitudes.

Please, take a look and fix it or let me know if something is wrong.

Cheers,

Núria

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: develop-CST_Weights