Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • s2dv s2dv
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 17
    • Issues 17
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 2
    • Merge requests 2
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Terraform modules
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Earth SciencesEarth Sciences
  • s2dvs2dv
  • Merge requests
  • !174

Avoid Inf values when defining var_limits for ColorBar()

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged aho requested to merge develop-PlotEquiMap_inf into master Nov 15, 2023
  • Overview 0
  • Commits 1
  • Pipelines 1
  • Changes 2

Hi @nperez

This is the fix for PlotEquiMap() and PlotLayout() when data has infinite values that cause errors in ColorBar() because var_limits is not well-defined. It may solve the problem mentioned here sunset#81 (comment 241390). Here is an example.

# Under s2dv/R directory
invisible(lapply(list("PlotEquiMap.R", "PlotLayout.R", "Reorder.R", "Utils.R", "clim.palette.R", "ColorBar.R"), source))

data <- array(rnorm(20), dim = c(lat = 4, lon = 5))
data[1] <- NA
data[2] <- Inf
data[3] <- -Inf
lon <- seq(10, 50, 10)
lat <- seq(10, 40, 10)
PlotEquiMap(data, lon = lon, lat = lat)

data2 <- aperm(array(data, dim = c(dim(data), time = 2)), c(3, 1, 2))
PlotLayout(fun = PlotEquiMap, plot_dims = c('lat', 'lon'), var = data2, lon = lon, lat = lat)

Cheers,
An-Chi

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