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
  • Issues
  • #127
Closed
Open
Issue created Sep 04, 2023 by allabres@allabresDeveloper

CST_MultiEOF development treat spatial NAs

Hi @erifarov

the function CST_MultiEOF doesn't accept spatial NAs and it'd be very useful if it could accept s2dv_cubes with NAs (e.g. tos has no data over land) and ignore the spatial points with NAs in the calculation (e.g. s2dv::EOF can do it provided that the NAs are consistent along time_dim; but s2dv::EOF is not multivariate as CST_MultiEOF, that's why it'd be useful to have the same functionality also in CST_MultiEOF and be able to compute the MultiEOF (not just EOF) in fields with spatial NAs).

Here is an example of how to call CST_MultiEOF using data with spatial NAs (I just modified the example in the documentation by adding 2 lines to introduce NAs):

seq <- 1 : (2 * 3 * 4 * 5 * 6 * 8)
mod1 <- sin( 0.7 + seq )^2 + cos( seq ^ 2 * 1.22  )
dim(mod1) <- c(dataset = 2, member = 3, sdate = 4, ftime = 5, lat = 6, 
               lon = 8)
mod1[,,,,1,3:4] <- NA # introducing some spatial NAs in the data
mod2 <- sin( seq * 2 ) ^ 3 + cos( seq ^ 2 )
dim(mod2) <- c(dataset = 2, member = 3, sdate = 4, ftime = 5, lat = 6, 
               lon = 8)
mod2[,,,,1,3:4] <- NA # introducing some spatial NAs in the data
lon <- seq(0, 35, 5)
lat <- seq(0, 25, 5)
exp1 <- list(data = mod1, coords = list(lat = lat, lon = lon))
exp2 <- list(data = mod2, coords = list(lat = lat, lon = lon))
attr(exp1, 'class') <- 's2dv_cube'
attr(exp2, 'class') <- 's2dv_cube'
d = as.POSIXct(c("2017/01/01", "2017/01/02", "2017/01/03", "2017/01/04", 
                 "2017/01/05", "2018/01/01", "2018/01/02", "2018/01/03",
                 "2018/01/04", "2018/01/05", "2019/01/01", "2019/01/02", 
                 "2019/01/03", "2019/01/04", "2019/01/05", "2020/01/01", 
                 "2020/01/02", "2020/01/03", "2020/01/04", "2020/01/05"))
exp1$attrs$Dates = d
exp2$attrs$Dates = d

result <- CST_MultiEOF(datalist = list(exp1, exp2), neof_composed = 2)

#Error in CST_MultiEOF(datalist = list(exp1, exp2), neof_composed = 2) :
#  Input data contain NA values.

Do you think you could look into this and see if the development is feasible?

Please let me and @nperez know if you have doubts or need help with it. Thanks a lot!

Edited Sep 05, 2023 by allabres
Assignee
Assign to
Time tracking