Skip to content
Prev 383957 / 398502 Next

Classification of wind events

While I can understand that such techniques might not seem obvious at first, they are building blocks that you should be able to use to solve similar problems in the future. Don't give up because it surprised you this time, and do play with modifying it to better understand this time.

Replace code starting with calculation of foehn1d:

# calculate mean values by candidate group
mydf$foehn1c2 <- ave( mydf$max_speed
                   , mydf$foehn1b
                   , FUN=mean
                   )
# find starts of foehns
mydf$foehn1d <- with( mydf
                    , 0 < diff( c( 0, foehn1c & 8<foehn1c2 ) )
                    )
# identify foehns distinctly (multiple days)
mydf$foehn1e <- with( mydf
                    , ifelse( foehn1c
                            , cumsum( foehn1d )
                            , 0
                            )
                    )
mydf[ , c( "data_POSIX" , "main_dir", "max_speed" , "foehn1e" ) ]
On May 18, 2020 3:14:06 AM PDT, Stefano Sofia <stefano.sofia at regione.marche.it> wrote: