Skip to content

Commit

Permalink
updates to support discussion in nearshore testign paper
Browse files Browse the repository at this point in the history
  • Loading branch information
gareth authored and gareth committed Aug 19, 2020
1 parent 4ceab70 commit 7f03513
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
Expand Up @@ -1022,3 +1022,26 @@ model_vs_model_maxima_change<-function(){
dev.off()
}
model_vs_model_maxima_change()

#
# A few checks to support the discussion.
#

# For the linear-with-delayed-linear-friction model, only 2 of the 68 model-vs-observed series
# do not have BOTH modelled-max < 14hours AND modelled-max > 3hours-post-arrival
late_model_maxima = (model_stats_nearshore$LinearDelayedFriction$model_time_of_max > 14*3600) &
# Modelled maxima occurs well after 12 hours
(model_stats_nearshore$LinearDelayedFriction$model_time_of_max -
model_stats_nearshore$LinearDelayedFriction$model_time_to_arrive > 3*3600)
# Modelled maxima is well after arrival time.

summary(late_model_maxima)
#> summary(late_model_maxima)
# Mode FALSE TRUE
#logical 2 66
late_observed_maxima = model_stats_nearshore$LinearDelayedFriction$obs_max_time_to_arrive/3600 < 18
model_stats_nearshore$LinearDelayedFriction$site_and_event[which(late_observed_maxima)]
#> model_stats_nearshore$LinearDelayedFriction$site_and_event[which(late_observed_maxima)]
#[1] "Sumatra-2004_Hillarys_BOM_1min_2004" "Sumatra-2004_Hillarys_BOM_1min_2004"
#[3] "Sumatra-2004_Hillarys_BOM_1min_2004"

Expand Up @@ -84,6 +84,7 @@ get_statistics_at_site<-function(site_data){
model_time_to_arrive = NA
obs_max_time_to_arrive = NA

model_time_of_max = NA
}else{

wave_threshold = WAVE_ARRIVAL_TIME_RELATIVE_THRESHOLD *max(abs(model$resid))
Expand Down Expand Up @@ -155,6 +156,10 @@ get_statistics_at_site<-function(site_data){
model_keep = which( (model$juliant >= model$juliant[n]-1.5) & (model$juliant <= (model$juliant[n]-1)) )
model_range_24to36 = range(model$resid[model_keep])
data_range_24to36 = range(obs$resid[obs_keep], na.rm=TRUE)

# Time of modelled maxima
k = which.max(model$resid)
model_time_of_max = site_data$model_time[k]
}

# For the output, make sensible names
Expand Down Expand Up @@ -218,7 +223,10 @@ get_statistics_at_site<-function(site_data){
#
model_arrival_time = model_arrival_time,
model_time_to_arrive = model_time_to_arrive,
obs_max_time_to_arrive = obs_max_time_to_arrive
obs_max_time_to_arrive = obs_max_time_to_arrive,
#
model_time_of_max = model_time_of_max

)

# We could have "Inf" or "-Inf" values above if the data didn't cover the
Expand Down

0 comments on commit 7f03513

Please sign in to comment.