Skip to content

Commit

Permalink
Merge pull request #88 from umr-amap/86-bug-stormrgetdatainterpolate-…
Browse files Browse the repository at this point in the history
…fails-with-fractional-time-difference-between-initial-storm-readings

86 bug stormrgetdatainterpolate fails with fractional time difference between initial storm readings
  • Loading branch information
thomasarsouze authored May 7, 2024
2 parents 5d633da + 7823cab commit 68fa15e
Show file tree
Hide file tree
Showing 7 changed files with 337 additions and 325 deletions.
12 changes: 6 additions & 6 deletions R/plotTemporal.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ checkInputsPlotTemporal <- function(data, storm, var) {

# Checking data input
stopifnot("no data found" = !missing(data))
stopifnot("data must be temporal series. Be sure to use data generated from temporalBehaviour()
stopifnot("data must be temporal series. Be sure to use data generated from temporalBehaviour()
function run with product input set to 'TS'" = identical(class(data[[1]]), "list"))

# Checking storm input
Expand Down Expand Up @@ -148,22 +148,22 @@ plotTemporal <- function(data, storm, var = "speed") {
col = cols,
legend = paste(names(subData), names(subData[[1]])),
bty = "n")


# Handle x axis labels
labels <- subData[[1]][[1]]$isoTimes[notNaIndices]
t1 <- labels[1]
t2 <- labels[2]
diffTime <- as.numeric(difftime(t2, t1, "hours"))
diffTime <- as.numeric(difftime(t2, t1, units = "hours"))

if(diffTime == 30){
notNullLabels <- seq(1,length(labels)) %% 2 == 0
labels[notNullLabels] <- ""
}else if(diffTime == 15){
notNullLabels <- seq(1,length(labels)) %% 4 == 0
labels[notNullLabels] <- ""
}

graphics::axis(1,
at = seq(1, length(subData[[1]][[1]]$speed[notNaIndices])),
labels = labels,
Expand Down
Loading

0 comments on commit 68fa15e

Please sign in to comment.