Classification of wind events

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Classification of wind events

Stefano Sofia
Dear R list users,
I am aware that this question is not strictly related, at the present moment, to R code and it is more general. Please forgive me, but I need to share my thoughts with you.

Foehn conditions on the southern slope of Alps happen with strong northerly flows that impact perpendicularly over the Apls. This situation triggers strong northerly leeward winds.
Given a single automatic weather station, I would like to identify these periods starting from wind direction and wind intensity data. Frequency of data is quarter of hour.
I would really find difficult to detect the moving windows of these events:
- I can't analyse data day by day;
- at the beginning and at the end of each event, when the process is not at full speed yet, the rotation is not always perfectly identifiable;
- I cannot claim in principle that the direction of each consecutive observation is costantly and strictly from the chosen direction.

Does anybody have a clue on how to start to build this process in the right way?

Thank you for your attention and your help
Stefano

         (oo)
--oOO--( )--OOo----------------
Stefano Sofia PhD
Civil Protection - Marche Region
Meteo Section
Snow Section
Via del Colle Ameno 5
60126 Torrette di Ancona, Ancona
Uff: 071 806 7743
E-mail: [hidden email]
---Oo---------oO----------------

________________________________

AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere informazioni confidenziali, pertanto è destinato solo a persone autorizzate alla ricezione. I messaggi di posta elettronica per i client di Regione Marche possono contenere informazioni confidenziali e con privilegi legali. Se non si è il destinatario specificato, non leggere, copiare, inoltrare o archiviare questo messaggio. Se si è ricevuto questo messaggio per errore, inoltrarlo al mittente ed eliminarlo completamente dal sistema del proprio computer. Ai sensi dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità ed urgenza, la risposta al presente messaggio di posta elettronica può essere visionata da persone estranee al destinatario.
IMPORTANT NOTICE: This e-mail message is intended to be received only by persons entitled to receive the confidential information it may contain. E-mail messages to clients of Regione Marche may contain information that is confidential and legally privileged. Please do not read, copy, forward, or store this message unless you are an intended recipient of it. If you have received this message in error, please forward it to the sender and delete it completely from your computer system.

--
Questo messaggio  stato analizzato da Libra ESVA ed  risultato non infetto.
This message was scanned by Libra ESVA and is believed to be clean.


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Classification of wind events

Jeff Newmiller
Please make a reproducible R example of input and output.

On May 12, 2020 1:11:41 AM PDT, Stefano Sofia <[hidden email]> wrote:

>Dear R list users,
>I am aware that this question is not strictly related, at the present
>moment, to R code and it is more general. Please forgive me, but I need
>to share my thoughts with you.
>
>Foehn conditions on the southern slope of Alps happen with strong
>northerly flows that impact perpendicularly over the Apls. This
>situation triggers strong northerly leeward winds.
>Given a single automatic weather station, I would like to identify
>these periods starting from wind direction and wind intensity data.
>Frequency of data is quarter of hour.
>I would really find difficult to detect the moving windows of these
>events:
>- I can't analyse data day by day;
>- at the beginning and at the end of each event, when the process is
>not at full speed yet, the rotation is not always perfectly
>identifiable;
>- I cannot claim in principle that the direction of each consecutive
>observation is costantly and strictly from the chosen direction.
>
>Does anybody have a clue on how to start to build this process in the
>right way?
>
>Thank you for your attention and your help
>Stefano
>
>         (oo)
>--oOO--( )--OOo----------------
>Stefano Sofia PhD
>Civil Protection - Marche Region
>Meteo Section
>Snow Section
>Via del Colle Ameno 5
>60126 Torrette di Ancona, Ancona
>Uff: 071 806 7743
>E-mail: [hidden email]
>---Oo---------oO----------------
>
>________________________________
>
>AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere
>informazioni confidenziali, pertanto è destinato solo a persone
>autorizzate alla ricezione. I messaggi di posta elettronica per i
>client di Regione Marche possono contenere informazioni confidenziali e
>con privilegi legali. Se non si è il destinatario specificato, non
>leggere, copiare, inoltrare o archiviare questo messaggio. Se si è
>ricevuto questo messaggio per errore, inoltrarlo al mittente ed
>eliminarlo completamente dal sistema del proprio computer. Ai sensi
>dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità
>ed urgenza, la risposta al presente messaggio di posta elettronica può
>essere visionata da persone estranee al destinatario.
>IMPORTANT NOTICE: This e-mail message is intended to be received only
>by persons entitled to receive the confidential information it may
>contain. E-mail messages to clients of Regione Marche may contain
>information that is confidential and legally privileged. Please do not
>read, copy, forward, or store this message unless you are an intended
>recipient of it. If you have received this message in error, please
>forward it to the sender and delete it completely from your computer
>system.
>
>--
>Questo messaggio  stato analizzato da Libra ESVA ed  risultato non
>infetto.
>This message was scanned by Libra ESVA and is believed to be clean.
>
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>[hidden email] mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

--
Sent from my phone. Please excuse my brevity.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Classification of wind events

Jim Lemon-4
In reply to this post by Stefano Sofia
Hi Stefano,
Given only one observation point you will find it difficult. If your
automatic weather station is in the low area where the foehn wind is
felt, it can only be distinguished from a dry katabatic wind if the
upwind conditions are known. There is a similar but milder version of
this in eastern Australia, but it is usually of the latter sort. There
may be a way to measure turbulence above the peak of the high ground
with radar or something, but I'm not familiar with that.

Jim

On Tue, May 12, 2020 at 6:13 PM Stefano Sofia
<[hidden email]> wrote:

>
> Dear R list users,
> I am aware that this question is not strictly related, at the present moment, to R code and it is more general. Please forgive me, but I need to share my thoughts with you.
>
> Foehn conditions on the southern slope of Alps happen with strong northerly flows that impact perpendicularly over the Apls. This situation triggers strong northerly leeward winds.
> Given a single automatic weather station, I would like to identify these periods starting from wind direction and wind intensity data. Frequency of data is quarter of hour.
> I would really find difficult to detect the moving windows of these events:
> - I can't analyse data day by day;
> - at the beginning and at the end of each event, when the process is not at full speed yet, the rotation is not always perfectly identifiable;
> - I cannot claim in principle that the direction of each consecutive observation is costantly and strictly from the chosen direction.
>
> Does anybody have a clue on how to start to build this process in the right way?
>
> Thank you for your attention and your help
> Stefano
>
>          (oo)
> --oOO--( )--OOo----------------
> Stefano Sofia PhD
> Civil Protection - Marche Region
> Meteo Section
> Snow Section
> Via del Colle Ameno 5
> 60126 Torrette di Ancona, Ancona
> Uff: 071 806 7743
> E-mail: [hidden email]
> ---Oo---------oO----------------
>
> ________________________________
>
> AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere informazioni confidenziali, pertanto è destinato solo a persone autorizzate alla ricezione. I messaggi di posta elettronica per i client di Regione Marche possono contenere informazioni confidenziali e con privilegi legali. Se non si è il destinatario specificato, non leggere, copiare, inoltrare o archiviare questo messaggio. Se si è ricevuto questo messaggio per errore, inoltrarlo al mittente ed eliminarlo completamente dal sistema del proprio computer. Ai sensi dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità ed urgenza, la risposta al presente messaggio di posta elettronica può essere visionata da persone estranee al destinatario.
> IMPORTANT NOTICE: This e-mail message is intended to be received only by persons entitled to receive the confidential information it may contain. E-mail messages to clients of Regione Marche may contain information that is confidential and legally privileged. Please do not read, copy, forward, or store this message unless you are an intended recipient of it. If you have received this message in error, please forward it to the sender and delete it completely from your computer system.
>
> --
> Questo messaggio  stato analizzato da Libra ESVA ed  risultato non infetto.
> This message was scanned by Libra ESVA and is believed to be clean.
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Classification of wind events

Stefano Sofia
Dear Jim and Jeff,
thank you for your comments. You are right, it is quite difficult to detect this process through a single observation point, I am awre of it.
I need to set up an automatic algorithm to filter 20 years of data, and I have to find an easy way to do it.
I know quite well my automatic stations, the wind direction is very stable during these situations, and therefore I would like to start from it. (I should use also wind speed, relative humidity and temperature, but I will introduce them only once I will be able to manage the direction).
In the case of the example below reported, I know that the directions of this particular automatic station must be only SW or WSW.

My biggest problem, obviously, is to find the beginning and the end of each event, when there is a change in the main direction.
Thinking about categorical data in general, is there a way to detect periods when one particular category is more frequent?

Here I reproduce a real example 24 hours long, where these Foehn condition start between 09 and 10 and finish after 19:

first_day_POSIX <- as.POSIXct("2020-02-19-00-00", format="%Y-%m-%d-%H-%M")
last_day_POSIX <- as.POSIXct("2020-02-20-00-00", format="%Y-%m-%d-%H-%M")
mydf <- data.frame(data_POSIX=seq(first_day_POSIX, last_day_POSIX, by="10 min"))

mydf$main_dir <- c(WSW, WSW, SW, SW, W, WSW, WSW, WSW, W, W, SW, WSW, SSW, S, SW, SW, WSW, WNW, W, WSW, WSW, SE, SE, SE, NW, NNE, ENE, SE, NNW, NW, NW, NW, NW, NW, NW, NE, NW, NW, NW, NW, NW, N, WNW, NW, NNW, NNW, NW, NW, NW, WNW, ESE, W, WSW, SW, SW, SW, WSW, SW, S, S, SSW, SW, WSW, WSW, WSW, WSW, WSW, WSW, WSW, SW, WSW, WSW, WSW, WSW, SW, SW, WSW, WSW, WSW, WSW, WSW, SW, SW, SW, SW, SW, SW, SW, SW, SW, WSW, WSW, WSW, WSW, SW, SW, SW, SW, WSW, SW, SW, SW, SW, SW, WSW, SW, SW, W, WSW, WSW, SSW, S, WNW, SW, W, WSW, WSW, SE, SE, SE, NW, NNE, ENE, SE, NNW, NW, NW, NW, NW, NW, NW, NE, NW, NW, NW, NW, NW, N, WNW, NW, NNW, NNW, NW, NW, NW)

mydf$max_speed <- c(4.60, 4.60, 3.40, 3.10, 4.80, 4.20, 4.10, 4.50, 4.70, 4.30, 2.40, 2.30, 2.20, 2.10, 2.90, 2.80, 1.80, 2.70, 4.30, 3.30, 2.30, 2.30, 3.20, 3.20, 2.90, 2.30, 1.50, 1.80, 2.90, 2.40, 1.80, 2.40, 2.30, 2.60, 1.80, 2.30, 1.90, 2.20, 2.80, 2.40, 1.00, 1.10, 1.60, 2.30, 2.50, 3.30, 3.40, 3.20, 4.50, 3.90, 3.10, 2.40, 6.00, 7.80, 6.30, 7.80, 8.10, 6.10, 7.40, 9.50, 8.90, 9.10, 10.10, 10.50, 11.10, 10.10, 10.90, 11.30, 13.40, 13.50, 12.80, 11.50, 13.10, 13.50, 11.10, 10.50, 8.50, 10.10, 10.70, 13.60, 11.90, 14.90, 10.90, 10.90, 12.80, 12.10, 9.10, 8.30, 8.80, 7.40, 8.40, 10.30, 10.00, 7.00, 8.50, 8.40, 8.60, 6.70, 7.30, 6.20, 5.90, 5.90, 5.10, 5.80, 5.60, 6.50, 6.60, 11.70, 11.30, 8.70, 7.10, 6.90, 4.30, 3.80, 4.30, 3.30, 2.30, 2.30, 3.20, 3.20, 2.90, 2.30, 1.50, 1.80, 2.90, 2.40, 1.80, 2.40, 2.30, 2.60, 1.80, 2.30, 1.90, 2.20, 2.80, 2.40, 1.00, 1.10, 1.60, 2.30, 2.50, 3.30, 3.40, 3.20, 4.50)


Thank you for your attention
Stefano


         (oo)
--oOO--( )--OOo----------------
Stefano Sofia PhD
Civil Protection - Marche Region
Meteo Section
Snow Section
Via del Colle Ameno 5
60126 Torrette di Ancona, Ancona
Uff: 071 806 7743
E-mail: [hidden email]
---Oo---------oO----------------

________________________________________
Da: Jim Lemon [[hidden email]]
Inviato: mercoledì 13 maggio 2020 11.01
A: Stefano Sofia; r-help mailing list
Oggetto: Re: [R] Classification of wind events

Hi Stefano,
Given only one observation point you will find it difficult. If your
automatic weather station is in the low area where the foehn wind is
felt, it can only be distinguished from a dry katabatic wind if the
upwind conditions are known. There is a similar but milder version of
this in eastern Australia, but it is usually of the latter sort. There
may be a way to measure turbulence above the peak of the high ground
with radar or something, but I'm not familiar with that.

Jim

On Tue, May 12, 2020 at 6:13 PM Stefano Sofia
<[hidden email]> wrote:

>
> Dear R list users,
> I am aware that this question is not strictly related, at the present moment, to R code and it is more general. Please forgive me, but I need to share my thoughts with you.
>
> Foehn conditions on the southern slope of Alps happen with strong northerly flows that impact perpendicularly over the Apls. This situation triggers strong northerly leeward winds.
> Given a single automatic weather station, I would like to identify these periods starting from wind direction and wind intensity data. Frequency of data is quarter of hour.
> I would really find difficult to detect the moving windows of these events:
> - I can't analyse data day by day;
> - at the beginning and at the end of each event, when the process is not at full speed yet, the rotation is not always perfectly identifiable;
> - I cannot claim in principle that the direction of each consecutive observation is costantly and strictly from the chosen direction.
>
> Does anybody have a clue on how to start to build this process in the right way?
>
> Thank you for your attention and your help
> Stefano
>
>          (oo)
> --oOO--( )--OOo----------------
> Stefano Sofia PhD
> Civil Protection - Marche Region
> Meteo Section
> Snow Section
> Via del Colle Ameno 5
> 60126 Torrette di Ancona, Ancona
> Uff: 071 806 7743
> E-mail: [hidden email]
> ---Oo---------oO----------------
>
> ________________________________
>
> AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere informazioni confidenziali, pertanto è destinato solo a persone autorizzate alla ricezione. I messaggi di posta elettronica per i client di Regione Marche possono contenere informazioni confidenziali e con privilegi legali. Se non si è il destinatario specificato, non leggere, copiare, inoltrare o archiviare questo messaggio. Se si è ricevuto questo messaggio per errore, inoltrarlo al mittente ed eliminarlo completamente dal sistema del proprio computer. Ai sensi dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità ed urgenza, la risposta al presente messaggio di posta elettronica può essere visionata da persone estranee al destinatario.
> IMPORTANT NOTICE: This e-mail message is intended to be received only by persons entitled to receive the confidential information it may contain. E-mail messages to clients of Regione Marche may contain information that is confidential and legally privileged. Please do not read, copy, forward, or store this message unless you are an intended recipient of it. If you have received this message in error, please forward it to the sender and delete it completely from your computer system.
>
> --
> Questo messaggio  stato analizzato da Libra ESVA ed  risultato non infetto.
> This message was scanned by Libra ESVA and is believed to be clean.
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

--

Questo messaggio  stato analizzato con Libra ESVA ed  risultato non infetto.


________________________________

AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere informazioni confidenziali, pertanto è destinato solo a persone autorizzate alla ricezione. I messaggi di posta elettronica per i client di Regione Marche possono contenere informazioni confidenziali e con privilegi legali. Se non si è il destinatario specificato, non leggere, copiare, inoltrare o archiviare questo messaggio. Se si è ricevuto questo messaggio per errore, inoltrarlo al mittente ed eliminarlo completamente dal sistema del proprio computer. Ai sensi dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità ed urgenza, la risposta al presente messaggio di posta elettronica può essere visionata da persone estranee al destinatario.
IMPORTANT NOTICE: This e-mail message is intended to be received only by persons entitled to receive the confidential information it may contain. E-mail messages to clients of Regione Marche may contain information that is confidential and legally privileged. Please do not read, copy, forward, or store this message unless you are an intended recipient of it. If you have received this message in error, please forward it to the sender and delete it completely from your computer system.

--
Questo messaggio  stato analizzato da Libra ESVA ed  risultato non infetto.
This message was scanned by Libra ESVA and is believed to be clean.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Classification of wind events

Jeff Newmiller
Please run your code before posting it... you forgot the quotes in your main_dir column.

first_day_POSIX <- as.POSIXct("2020-02-19-00-00", format="%Y-%m-%d-%H-%M")
last_day_POSIX <- as.POSIXct("2020-02-20-00-00", format="%Y-%m-%d-%H-%M")
mydf <- data.frame(data_POSIX=seq(first_day_POSIX, last_day_POSIX, by="10 min"))

mydf$main_dir <- c("WSW", "WSW", "SW", "SW", "W", "WSW", "WSW", "WSW", "W", "W", "SW", "WSW", "SSW", "S", "SW", "SW", "WSW", "WNW", "W", "WSW", "WSW", "SE", "SE", "SE", "NW", "NNE", "ENE", "SE", "NNW", "NW", "NW", "NW", "NW", "NW", "NW", "NE", "NW", "NW", "NW", "NW", "NW", "N", "WNW", "NW", "NNW", "NNW", "NW", "NW", "NW", "WNW", "ESE", "W", "WSW", "SW", "SW", "SW", "WSW", "SW", "S", "S", "SSW", "SW", "WSW", "WSW", "WSW", "WSW", "WSW", "WSW", "WSW", "SW", "WSW", "WSW", "WSW", "WSW", "SW", "SW", "WSW", "WSW", "WSW", "WSW", "WSW", "SW", "SW", "SW", "SW", "SW", "SW", "SW", "SW", "SW", "WSW", "WSW", "WSW", "WSW", "SW", "SW", "SW", "SW", "WSW", "SW", "SW", "SW", "SW", "SW", "WSW", "SW", "SW", "W", "WSW", "WSW", "SSW", "S", "WNW", "SW", "W", "WSW", "WSW", "SE", "SE", "SE", "NW", "NNE", "ENE", "SE", "NNW", "NW", "NW", "NW", "NW", "NW", "NW", "NE", "NW", "NW", "NW", "NW", "NW", "N", "WNW", "NW", "NNW", "NNW", "NW", "NW", "NW")

mydf$max_speed <- c(4.60, 4.60, 3.40, 3.10, 4.80, 4.20, 4.10, 4.50, 4.70, 4.30, 2.40, 2.30, 2.20, 2.10, 2.90, 2.80, 1.80, 2.70, 4.30, 3.30, 2.30, 2.30, 3.20, 3.20, 2.90, 2.30, 1.50, 1.80, 2.90, 2.40, 1.80, 2.40, 2.30, 2.60, 1.80, 2.30, 1.90, 2.20, 2.80, 2.40, 1.00, 1.10, 1.60, 2.30, 2.50, 3.30, 3.40, 3.20, 4.50, 3.90, 3.10, 2.40, 6.00, 7.80, 6.30, 7.80, 8.10, 6.10, 7.40, 9.50, 8.90, 9.10, 10.10, 10.50, 11.10, 10.10, 10.90, 11.30, 13.40, 13.50, 12.80, 11.50, 13.10, 13.50, 11.10, 10.50, 8.50, 10.10, 10.70, 13.60, 11.90, 14.90, 10.90, 10.90, 12.80, 12.10, 9.10, 8.30, 8.80, 7.40, 8.40, 10.30, 10.00, 7.00, 8.50, 8.40, 8.60, 6.70, 7.30, 6.20, 5.90, 5.90, 5.10, 5.80, 5.60, 6.50, 6.60, 11.70, 11.30, 8.70, 7.10, 6.90, 4.30, 3.80, 4.30, 3.30, 2.30, 2.30, 3.20, 3.20, 2.90, 2.30, 1.50, 1.80, 2.90, 2.40, 1.80, 2.40, 2.30, 2.60, 1.80, 2.30, 1.90, 2.20, 2.80, 2.40, 1.00, 1.10, 1.60, 2.30, 2.50, 3.30, 3.40, 3.20, 4.50)
# mark candidate rows
mydf$foehn1a <- mydf$main_dir %in% c( "WSW", "SW" )
# mark unstable conditions
mydf$foehn1b <- with( mydf
                    , cumsum( !foehn1a )
                    )
# find minimum length of foehn conditions
mydf$foehn1c <- ave( rep( 1, nrow( mydf ) )
                   , mydf$foehn1b
                   , FUN=function(v) 10 < length( v )
                   )
# find starts of foehns
mydf$foehn1d <- with( mydf
                    , 0 < diff( c( 0, foehn1c ) )
                    )
# identify foehns distinctly (multiple days)
mydf$foehn1e <- with( mydf
                    , ifelse( foehn1c
                            , cumsum( foehn1d )
                            , 0
                            )
                    )
mydf[ , c( 1, 2, 8 ) ]

On May 16, 2020 3:21:24 AM PDT, Stefano Sofia <[hidden email]> wrote:

>Dear Jim and Jeff,
>thank you for your comments. You are right, it is quite difficult to
>detect this process through a single observation point, I am awre of
>it.
>I need to set up an automatic algorithm to filter 20 years of data, and
>I have to find an easy way to do it.
>I know quite well my automatic stations, the wind direction is very
>stable during these situations, and therefore I would like to start
>from it. (I should use also wind speed, relative humidity and
>temperature, but I will introduce them only once I will be able to
>manage the direction).
>In the case of the example below reported, I know that the directions
>of this particular automatic station must be only SW or WSW.
>
>My biggest problem, obviously, is to find the beginning and the end of
>each event, when there is a change in the main direction.
>Thinking about categorical data in general, is there a way to detect
>periods when one particular category is more frequent?
>
>Here I reproduce a real example 24 hours long, where these Foehn
>condition start between 09 and 10 and finish after 19:
>
>first_day_POSIX <- as.POSIXct("2020-02-19-00-00",
>format="%Y-%m-%d-%H-%M")
>last_day_POSIX <- as.POSIXct("2020-02-20-00-00",
>format="%Y-%m-%d-%H-%M")
>mydf <- data.frame(data_POSIX=seq(first_day_POSIX, last_day_POSIX,
>by="10 min"))
>
>mydf$main_dir <- c(WSW, WSW, SW, SW, W, WSW, WSW, WSW, W, W, SW, WSW,
>SSW, S, SW, SW, WSW, WNW, W, WSW, WSW, SE, SE, SE, NW, NNE, ENE, SE,
>NNW, NW, NW, NW, NW, NW, NW, NE, NW, NW, NW, NW, NW, N, WNW, NW, NNW,
>NNW, NW, NW, NW, WNW, ESE, W, WSW, SW, SW, SW, WSW, SW, S, S, SSW, SW,
>WSW, WSW, WSW, WSW, WSW, WSW, WSW, SW, WSW, WSW, WSW, WSW, SW, SW, WSW,
>WSW, WSW, WSW, WSW, SW, SW, SW, SW, SW, SW, SW, SW, SW, WSW, WSW, WSW,
>WSW, SW, SW, SW, SW, WSW, SW, SW, SW, SW, SW, WSW, SW, SW, W, WSW, WSW,
>SSW, S, WNW, SW, W, WSW, WSW, SE, SE, SE, NW, NNE, ENE, SE, NNW, NW,
>NW, NW, NW, NW, NW, NE, NW, NW, NW, NW, NW, N, WNW, NW, NNW, NNW, NW,
>NW, NW)
>
>mydf$max_speed <- c(4.60, 4.60, 3.40, 3.10, 4.80, 4.20, 4.10, 4.50,
>4.70, 4.30, 2.40, 2.30, 2.20, 2.10, 2.90, 2.80, 1.80, 2.70, 4.30, 3.30,
>2.30, 2.30, 3.20, 3.20, 2.90, 2.30, 1.50, 1.80, 2.90, 2.40, 1.80, 2.40,
>2.30, 2.60, 1.80, 2.30, 1.90, 2.20, 2.80, 2.40, 1.00, 1.10, 1.60, 2.30,
>2.50, 3.30, 3.40, 3.20, 4.50, 3.90, 3.10, 2.40, 6.00, 7.80, 6.30, 7.80,
>8.10, 6.10, 7.40, 9.50, 8.90, 9.10, 10.10, 10.50, 11.10, 10.10, 10.90,
>11.30, 13.40, 13.50, 12.80, 11.50, 13.10, 13.50, 11.10, 10.50, 8.50,
>10.10, 10.70, 13.60, 11.90, 14.90, 10.90, 10.90, 12.80, 12.10, 9.10,
>8.30, 8.80, 7.40, 8.40, 10.30, 10.00, 7.00, 8.50, 8.40, 8.60, 6.70,
>7.30, 6.20, 5.90, 5.90, 5.10, 5.80, 5.60, 6.50, 6.60, 11.70, 11.30,
>8.70, 7.10, 6.90, 4.30, 3.80, 4.30, 3.30, 2.30, 2.30, 3.20, 3.20, 2.90,
>2.30, 1.50, 1.80, 2.90, 2.40, 1.80, 2.40, 2.30, 2.60, 1.80, 2.30, 1.90,
>2.20, 2.80, 2.40, 1.00, 1.10, 1.60, 2.30, 2.50, 3.30, 3.40, 3.20, 4.50)
>
>
>Thank you for your attention
>Stefano
>
>
>         (oo)
>--oOO--( )--OOo----------------
>Stefano Sofia PhD
>Civil Protection - Marche Region
>Meteo Section
>Snow Section
>Via del Colle Ameno 5
>60126 Torrette di Ancona, Ancona
>Uff: 071 806 7743
>E-mail: [hidden email]
>---Oo---------oO----------------
>
>________________________________________
>Da: Jim Lemon [[hidden email]]
>Inviato: mercoledì 13 maggio 2020 11.01
>A: Stefano Sofia; r-help mailing list
>Oggetto: Re: [R] Classification of wind events
>
>Hi Stefano,
>Given only one observation point you will find it difficult. If your
>automatic weather station is in the low area where the foehn wind is
>felt, it can only be distinguished from a dry katabatic wind if the
>upwind conditions are known. There is a similar but milder version of
>this in eastern Australia, but it is usually of the latter sort. There
>may be a way to measure turbulence above the peak of the high ground
>with radar or something, but I'm not familiar with that.
>
>Jim
>
>On Tue, May 12, 2020 at 6:13 PM Stefano Sofia
><[hidden email]> wrote:
>>
>> Dear R list users,
>> I am aware that this question is not strictly related, at the present
>moment, to R code and it is more general. Please forgive me, but I need
>to share my thoughts with you.
>>
>> Foehn conditions on the southern slope of Alps happen with strong
>northerly flows that impact perpendicularly over the Apls. This
>situation triggers strong northerly leeward winds.
>> Given a single automatic weather station, I would like to identify
>these periods starting from wind direction and wind intensity data.
>Frequency of data is quarter of hour.
>> I would really find difficult to detect the moving windows of these
>events:
>> - I can't analyse data day by day;
>> - at the beginning and at the end of each event, when the process is
>not at full speed yet, the rotation is not always perfectly
>identifiable;
>> - I cannot claim in principle that the direction of each consecutive
>observation is costantly and strictly from the chosen direction.
>>
>> Does anybody have a clue on how to start to build this process in the
>right way?
>>
>> Thank you for your attention and your help
>> Stefano
>>
>>          (oo)
>> --oOO--( )--OOo----------------
>> Stefano Sofia PhD
>> Civil Protection - Marche Region
>> Meteo Section
>> Snow Section
>> Via del Colle Ameno 5
>> 60126 Torrette di Ancona, Ancona
>> Uff: 071 806 7743
>> E-mail: [hidden email]
>> ---Oo---------oO----------------
>>
>> ________________________________
>>
>> AVVISO IMPORTANTE: Questo messaggio di posta elettronica può
>contenere informazioni confidenziali, pertanto è destinato solo a
>persone autorizzate alla ricezione. I messaggi di posta elettronica per
>i client di Regione Marche possono contenere informazioni confidenziali
>e con privilegi legali. Se non si è il destinatario specificato, non
>leggere, copiare, inoltrare o archiviare questo messaggio. Se si è
>ricevuto questo messaggio per errore, inoltrarlo al mittente ed
>eliminarlo completamente dal sistema del proprio computer. Ai sensi
>dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità
>ed urgenza, la risposta al presente messaggio di posta elettronica può
>essere visionata da persone estranee al destinatario.
>> IMPORTANT NOTICE: This e-mail message is intended to be received only
>by persons entitled to receive the confidential information it may
>contain. E-mail messages to clients of Regione Marche may contain
>information that is confidential and legally privileged. Please do not
>read, copy, forward, or store this message unless you are an intended
>recipient of it. If you have received this message in error, please
>forward it to the sender and delete it completely from your computer
>system.
>>
>> --
>> Questo messaggio  stato analizzato da Libra ESVA ed  risultato non
>infetto.
>> This message was scanned by Libra ESVA and is believed to be clean.
>>
>>
>>         [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>--
>
>Questo messaggio  stato analizzato con Libra ESVA ed  risultato non
>infetto.
>
>
>________________________________
>
>AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere
>informazioni confidenziali, pertanto è destinato solo a persone
>autorizzate alla ricezione. I messaggi di posta elettronica per i
>client di Regione Marche possono contenere informazioni confidenziali e
>con privilegi legali. Se non si è il destinatario specificato, non
>leggere, copiare, inoltrare o archiviare questo messaggio. Se si è
>ricevuto questo messaggio per errore, inoltrarlo al mittente ed
>eliminarlo completamente dal sistema del proprio computer. Ai sensi
>dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità
>ed urgenza, la risposta al presente messaggio di posta elettronica può
>essere visionata da persone estranee al destinatario.
>IMPORTANT NOTICE: This e-mail message is intended to be received only
>by persons entitled to receive the confidential information it may
>contain. E-mail messages to clients of Regione Marche may contain
>information that is confidential and legally privileged. Please do not
>read, copy, forward, or store this message unless you are an intended
>recipient of it. If you have received this message in error, please
>forward it to the sender and delete it completely from your computer
>system.
>
>-->
>Questo messaggio  stato analizzato da Libra ESVA ed  risultato non
>infetto.>
>This message was scanned by Libra ESVA and is believed to be clean.

--
Sent from my phone. Please excuse my brevity.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Classification of wind events

Abby Spurdle
In reply to this post by Stefano Sofia
Hi Stefano,

I don't have any specific suggestions, but...

If you could convert your (character) direction vector into a
(numeric) time-ordered direction vector giving radians or degrees, and
provide the corresponding speed vector...
(i.e. North -> 90 degrees).

I'd be happy to try and plot the data in a variety of ways...
...and see if there's any obvious relationships, or anything else useful.


On Sat, May 16, 2020 at 10:23 PM Stefano Sofia
<[hidden email]> wrote:

>
> Dear Jim and Jeff,
> thank you for your comments. You are right, it is quite difficult to detect this process through a single observation point, I am awre of it.
> I need to set up an automatic algorithm to filter 20 years of data, and I have to find an easy way to do it.
> I know quite well my automatic stations, the wind direction is very stable during these situations, and therefore I would like to start from it. (I should use also wind speed, relative humidity and temperature, but I will introduce them only once I will be able to manage the direction).
> In the case of the example below reported, I know that the directions of this particular automatic station must be only SW or WSW.
>
> My biggest problem, obviously, is to find the beginning and the end of each event, when there is a change in the main direction.
> Thinking about categorical data in general, is there a way to detect periods when one particular category is more frequent?
>
> Here I reproduce a real example 24 hours long, where these Foehn condition start between 09 and 10 and finish after 19:
>
> first_day_POSIX <- as.POSIXct("2020-02-19-00-00", format="%Y-%m-%d-%H-%M")
> last_day_POSIX <- as.POSIXct("2020-02-20-00-00", format="%Y-%m-%d-%H-%M")
> mydf <- data.frame(data_POSIX=seq(first_day_POSIX, last_day_POSIX, by="10 min"))
>
> mydf$main_dir <- c(WSW, WSW, SW, SW, W, WSW, WSW, WSW, W, W, SW, WSW, SSW, S, SW, SW, WSW, WNW, W, WSW, WSW, SE, SE, SE, NW, NNE, ENE, SE, NNW, NW, NW, NW, NW, NW, NW, NE, NW, NW, NW, NW, NW, N, WNW, NW, NNW, NNW, NW, NW, NW, WNW, ESE, W, WSW, SW, SW, SW, WSW, SW, S, S, SSW, SW, WSW, WSW, WSW, WSW, WSW, WSW, WSW, SW, WSW, WSW, WSW, WSW, SW, SW, WSW, WSW, WSW, WSW, WSW, SW, SW, SW, SW, SW, SW, SW, SW, SW, WSW, WSW, WSW, WSW, SW, SW, SW, SW, WSW, SW, SW, SW, SW, SW, WSW, SW, SW, W, WSW, WSW, SSW, S, WNW, SW, W, WSW, WSW, SE, SE, SE, NW, NNE, ENE, SE, NNW, NW, NW, NW, NW, NW, NW, NE, NW, NW, NW, NW, NW, N, WNW, NW, NNW, NNW, NW, NW, NW)
>
> mydf$max_speed <- c(4.60, 4.60, 3.40, 3.10, 4.80, 4.20, 4.10, 4.50, 4.70, 4.30, 2.40, 2.30, 2.20, 2.10, 2.90, 2.80, 1.80, 2.70, 4.30, 3.30, 2.30, 2.30, 3.20, 3.20, 2.90, 2.30, 1.50, 1.80, 2.90, 2.40, 1.80, 2.40, 2.30, 2.60, 1.80, 2.30, 1.90, 2.20, 2.80, 2.40, 1.00, 1.10, 1.60, 2.30, 2.50, 3.30, 3.40, 3.20, 4.50, 3.90, 3.10, 2.40, 6.00, 7.80, 6.30, 7.80, 8.10, 6.10, 7.40, 9.50, 8.90, 9.10, 10.10, 10.50, 11.10, 10.10, 10.90, 11.30, 13.40, 13.50, 12.80, 11.50, 13.10, 13.50, 11.10, 10.50, 8.50, 10.10, 10.70, 13.60, 11.90, 14.90, 10.90, 10.90, 12.80, 12.10, 9.10, 8.30, 8.80, 7.40, 8.40, 10.30, 10.00, 7.00, 8.50, 8.40, 8.60, 6.70, 7.30, 6.20, 5.90, 5.90, 5.10, 5.80, 5.60, 6.50, 6.60, 11.70, 11.30, 8.70, 7.10, 6.90, 4.30, 3.80, 4.30, 3.30, 2.30, 2.30, 3.20, 3.20, 2.90, 2.30, 1.50, 1.80, 2.90, 2.40, 1.80, 2.40, 2.30, 2.60, 1.80, 2.30, 1.90, 2.20, 2.80, 2.40, 1.00, 1.10, 1.60, 2.30, 2.50, 3.30, 3.40, 3.20, 4.50)
>
>
> Thank you for your attention
> Stefano
>
>
>          (oo)
> --oOO--( )--OOo----------------
> Stefano Sofia PhD
> Civil Protection - Marche Region
> Meteo Section
> Snow Section
> Via del Colle Ameno 5
> 60126 Torrette di Ancona, Ancona
> Uff: 071 806 7743
> E-mail: [hidden email]
> ---Oo---------oO----------------
>
> ________________________________________
> Da: Jim Lemon [[hidden email]]
> Inviato: mercoledì 13 maggio 2020 11.01
> A: Stefano Sofia; r-help mailing list
> Oggetto: Re: [R] Classification of wind events
>
> Hi Stefano,
> Given only one observation point you will find it difficult. If your
> automatic weather station is in the low area where the foehn wind is
> felt, it can only be distinguished from a dry katabatic wind if the
> upwind conditions are known. There is a similar but milder version of
> this in eastern Australia, but it is usually of the latter sort. There
> may be a way to measure turbulence above the peak of the high ground
> with radar or something, but I'm not familiar with that.
>
> Jim
>
> On Tue, May 12, 2020 at 6:13 PM Stefano Sofia
> <[hidden email]> wrote:
> >
> > Dear R list users,
> > I am aware that this question is not strictly related, at the present moment, to R code and it is more general. Please forgive me, but I need to share my thoughts with you.
> >
> > Foehn conditions on the southern slope of Alps happen with strong northerly flows that impact perpendicularly over the Apls. This situation triggers strong northerly leeward winds.
> > Given a single automatic weather station, I would like to identify these periods starting from wind direction and wind intensity data. Frequency of data is quarter of hour.
> > I would really find difficult to detect the moving windows of these events:
> > - I can't analyse data day by day;
> > - at the beginning and at the end of each event, when the process is not at full speed yet, the rotation is not always perfectly identifiable;
> > - I cannot claim in principle that the direction of each consecutive observation is costantly and strictly from the chosen direction.
> >
> > Does anybody have a clue on how to start to build this process in the right way?
> >
> > Thank you for your attention and your help
> > Stefano
> >
> >          (oo)
> > --oOO--( )--OOo----------------
> > Stefano Sofia PhD
> > Civil Protection - Marche Region
> > Meteo Section
> > Snow Section
> > Via del Colle Ameno 5
> > 60126 Torrette di Ancona, Ancona
> > Uff: 071 806 7743
> > E-mail: [hidden email]
> > ---Oo---------oO----------------
> >
> > ________________________________
> >
> > AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere informazioni confidenziali, pertanto è destinato solo a persone autorizzate alla ricezione. I messaggi di posta elettronica per i client di Regione Marche possono contenere informazioni confidenziali e con privilegi legali. Se non si è il destinatario specificato, non leggere, copiare, inoltrare o archiviare questo messaggio. Se si è ricevuto questo messaggio per errore, inoltrarlo al mittente ed eliminarlo completamente dal sistema del proprio computer. Ai sensi dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità ed urgenza, la risposta al presente messaggio di posta elettronica può essere visionata da persone estranee al destinatario.
> > IMPORTANT NOTICE: This e-mail message is intended to be received only by persons entitled to receive the confidential information it may contain. E-mail messages to clients of Regione Marche may contain information that is confidential and legally privileged. Please do not read, copy, forward, or store this message unless you are an intended recipient of it. If you have received this message in error, please forward it to the sender and delete it completely from your computer system.
> >
> > --
> > Questo messaggio  stato analizzato da Libra ESVA ed  risultato non infetto.
> > This message was scanned by Libra ESVA and is believed to be clean.
> >
> >
> >         [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
> --
>
> Questo messaggio  stato analizzato con Libra ESVA ed  risultato non infetto.
>
>
> ________________________________
>
> AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere informazioni confidenziali, pertanto è destinato solo a persone autorizzate alla ricezione. I messaggi di posta elettronica per i client di Regione Marche possono contenere informazioni confidenziali e con privilegi legali. Se non si è il destinatario specificato, non leggere, copiare, inoltrare o archiviare questo messaggio. Se si è ricevuto questo messaggio per errore, inoltrarlo al mittente ed eliminarlo completamente dal sistema del proprio computer. Ai sensi dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità ed urgenza, la risposta al presente messaggio di posta elettronica può essere visionata da persone estranee al destinatario.
> IMPORTANT NOTICE: This e-mail message is intended to be received only by persons entitled to receive the confidential information it may contain. E-mail messages to clients of Regione Marche may contain information that is confidential and legally privileged. Please do not read, copy, forward, or store this message unless you are an intended recipient of it. If you have received this message in error, please forward it to the sender and delete it completely from your computer system.
>
> --
> Questo messaggio  stato analizzato da Libra ESVA ed  risultato non infetto.
> This message was scanned by Libra ESVA and is believed to be clean.
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Classification of wind events

Abby Spurdle
Sorry, please put my last post aside.
I mis-read your question.

I agree with Jim's comments.









On Sun, May 17, 2020 at 9:52 PM Abby Spurdle <[hidden email]> wrote:

>
> Hi Stefano,
>
> I don't have any specific suggestions, but...
>
> If you could convert your (character) direction vector into a
> (numeric) time-ordered direction vector giving radians or degrees, and
> provide the corresponding speed vector...
> (i.e. North -> 90 degrees).
>
> I'd be happy to try and plot the data in a variety of ways...
> ...and see if there's any obvious relationships, or anything else useful.
>
>
> On Sat, May 16, 2020 at 10:23 PM Stefano Sofia
> <[hidden email]> wrote:
> >
> > Dear Jim and Jeff,
> > thank you for your comments. You are right, it is quite difficult to detect this process through a single observation point, I am awre of it.
> > I need to set up an automatic algorithm to filter 20 years of data, and I have to find an easy way to do it.
> > I know quite well my automatic stations, the wind direction is very stable during these situations, and therefore I would like to start from it. (I should use also wind speed, relative humidity and temperature, but I will introduce them only once I will be able to manage the direction).
> > In the case of the example below reported, I know that the directions of this particular automatic station must be only SW or WSW.
> >
> > My biggest problem, obviously, is to find the beginning and the end of each event, when there is a change in the main direction.
> > Thinking about categorical data in general, is there a way to detect periods when one particular category is more frequent?
> >
> > Here I reproduce a real example 24 hours long, where these Foehn condition start between 09 and 10 and finish after 19:
> >
> > first_day_POSIX <- as.POSIXct("2020-02-19-00-00", format="%Y-%m-%d-%H-%M")
> > last_day_POSIX <- as.POSIXct("2020-02-20-00-00", format="%Y-%m-%d-%H-%M")
> > mydf <- data.frame(data_POSIX=seq(first_day_POSIX, last_day_POSIX, by="10 min"))
> >
> > mydf$main_dir <- c(WSW, WSW, SW, SW, W, WSW, WSW, WSW, W, W, SW, WSW, SSW, S, SW, SW, WSW, WNW, W, WSW, WSW, SE, SE, SE, NW, NNE, ENE, SE, NNW, NW, NW, NW, NW, NW, NW, NE, NW, NW, NW, NW, NW, N, WNW, NW, NNW, NNW, NW, NW, NW, WNW, ESE, W, WSW, SW, SW, SW, WSW, SW, S, S, SSW, SW, WSW, WSW, WSW, WSW, WSW, WSW, WSW, SW, WSW, WSW, WSW, WSW, SW, SW, WSW, WSW, WSW, WSW, WSW, SW, SW, SW, SW, SW, SW, SW, SW, SW, WSW, WSW, WSW, WSW, SW, SW, SW, SW, WSW, SW, SW, SW, SW, SW, WSW, SW, SW, W, WSW, WSW, SSW, S, WNW, SW, W, WSW, WSW, SE, SE, SE, NW, NNE, ENE, SE, NNW, NW, NW, NW, NW, NW, NW, NE, NW, NW, NW, NW, NW, N, WNW, NW, NNW, NNW, NW, NW, NW)
> >
> > mydf$max_speed <- c(4.60, 4.60, 3.40, 3.10, 4.80, 4.20, 4.10, 4.50, 4.70, 4.30, 2.40, 2.30, 2.20, 2.10, 2.90, 2.80, 1.80, 2.70, 4.30, 3.30, 2.30, 2.30, 3.20, 3.20, 2.90, 2.30, 1.50, 1.80, 2.90, 2.40, 1.80, 2.40, 2.30, 2.60, 1.80, 2.30, 1.90, 2.20, 2.80, 2.40, 1.00, 1.10, 1.60, 2.30, 2.50, 3.30, 3.40, 3.20, 4.50, 3.90, 3.10, 2.40, 6.00, 7.80, 6.30, 7.80, 8.10, 6.10, 7.40, 9.50, 8.90, 9.10, 10.10, 10.50, 11.10, 10.10, 10.90, 11.30, 13.40, 13.50, 12.80, 11.50, 13.10, 13.50, 11.10, 10.50, 8.50, 10.10, 10.70, 13.60, 11.90, 14.90, 10.90, 10.90, 12.80, 12.10, 9.10, 8.30, 8.80, 7.40, 8.40, 10.30, 10.00, 7.00, 8.50, 8.40, 8.60, 6.70, 7.30, 6.20, 5.90, 5.90, 5.10, 5.80, 5.60, 6.50, 6.60, 11.70, 11.30, 8.70, 7.10, 6.90, 4.30, 3.80, 4.30, 3.30, 2.30, 2.30, 3.20, 3.20, 2.90, 2.30, 1.50, 1.80, 2.90, 2.40, 1.80, 2.40, 2.30, 2.60, 1.80, 2.30, 1.90, 2.20, 2.80, 2.40, 1.00, 1.10, 1.60, 2.30, 2.50, 3.30, 3.40, 3.20, 4.50)
> >
> >
> > Thank you for your attention
> > Stefano
> >
> >
> >          (oo)
> > --oOO--( )--OOo----------------
> > Stefano Sofia PhD
> > Civil Protection - Marche Region
> > Meteo Section
> > Snow Section
> > Via del Colle Ameno 5
> > 60126 Torrette di Ancona, Ancona
> > Uff: 071 806 7743
> > E-mail: [hidden email]
> > ---Oo---------oO----------------
> >
> > ________________________________________
> > Da: Jim Lemon [[hidden email]]
> > Inviato: mercoledì 13 maggio 2020 11.01
> > A: Stefano Sofia; r-help mailing list
> > Oggetto: Re: [R] Classification of wind events
> >
> > Hi Stefano,
> > Given only one observation point you will find it difficult. If your
> > automatic weather station is in the low area where the foehn wind is
> > felt, it can only be distinguished from a dry katabatic wind if the
> > upwind conditions are known. There is a similar but milder version of
> > this in eastern Australia, but it is usually of the latter sort. There
> > may be a way to measure turbulence above the peak of the high ground
> > with radar or something, but I'm not familiar with that.
> >
> > Jim
> >
> > On Tue, May 12, 2020 at 6:13 PM Stefano Sofia
> > <[hidden email]> wrote:
> > >
> > > Dear R list users,
> > > I am aware that this question is not strictly related, at the present moment, to R code and it is more general. Please forgive me, but I need to share my thoughts with you.
> > >
> > > Foehn conditions on the southern slope of Alps happen with strong northerly flows that impact perpendicularly over the Apls. This situation triggers strong northerly leeward winds.
> > > Given a single automatic weather station, I would like to identify these periods starting from wind direction and wind intensity data. Frequency of data is quarter of hour.
> > > I would really find difficult to detect the moving windows of these events:
> > > - I can't analyse data day by day;
> > > - at the beginning and at the end of each event, when the process is not at full speed yet, the rotation is not always perfectly identifiable;
> > > - I cannot claim in principle that the direction of each consecutive observation is costantly and strictly from the chosen direction.
> > >
> > > Does anybody have a clue on how to start to build this process in the right way?
> > >
> > > Thank you for your attention and your help
> > > Stefano
> > >
> > >          (oo)
> > > --oOO--( )--OOo----------------
> > > Stefano Sofia PhD
> > > Civil Protection - Marche Region
> > > Meteo Section
> > > Snow Section
> > > Via del Colle Ameno 5
> > > 60126 Torrette di Ancona, Ancona
> > > Uff: 071 806 7743
> > > E-mail: [hidden email]
> > > ---Oo---------oO----------------
> > >
> > > ________________________________
> > >
> > > AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere informazioni confidenziali, pertanto è destinato solo a persone autorizzate alla ricezione. I messaggi di posta elettronica per i client di Regione Marche possono contenere informazioni confidenziali e con privilegi legali. Se non si è il destinatario specificato, non leggere, copiare, inoltrare o archiviare questo messaggio. Se si è ricevuto questo messaggio per errore, inoltrarlo al mittente ed eliminarlo completamente dal sistema del proprio computer. Ai sensi dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità ed urgenza, la risposta al presente messaggio di posta elettronica può essere visionata da persone estranee al destinatario.
> > > IMPORTANT NOTICE: This e-mail message is intended to be received only by persons entitled to receive the confidential information it may contain. E-mail messages to clients of Regione Marche may contain information that is confidential and legally privileged. Please do not read, copy, forward, or store this message unless you are an intended recipient of it. If you have received this message in error, please forward it to the sender and delete it completely from your computer system.
> > >
> > > --
> > > Questo messaggio  stato analizzato da Libra ESVA ed  risultato non infetto.
> > > This message was scanned by Libra ESVA and is believed to be clean.
> > >
> > >
> > >         [[alternative HTML version deleted]]
> > >
> > > ______________________________________________
> > > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > > and provide commented, minimal, self-contained, reproducible code.
> >
> > --
> >
> > Questo messaggio  stato analizzato con Libra ESVA ed  risultato non infetto.
> >
> >
> > ________________________________
> >
> > AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere informazioni confidenziali, pertanto è destinato solo a persone autorizzate alla ricezione. I messaggi di posta elettronica per i client di Regione Marche possono contenere informazioni confidenziali e con privilegi legali. Se non si è il destinatario specificato, non leggere, copiare, inoltrare o archiviare questo messaggio. Se si è ricevuto questo messaggio per errore, inoltrarlo al mittente ed eliminarlo completamente dal sistema del proprio computer. Ai sensi dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità ed urgenza, la risposta al presente messaggio di posta elettronica può essere visionata da persone estranee al destinatario.
> > IMPORTANT NOTICE: This e-mail message is intended to be received only by persons entitled to receive the confidential information it may contain. E-mail messages to clients of Regione Marche may contain information that is confidential and legally privileged. Please do not read, copy, forward, or store this message unless you are an intended recipient of it. If you have received this message in error, please forward it to the sender and delete it completely from your computer system.
> >
> > --
> > Questo messaggio  stato analizzato da Libra ESVA ed  risultato non infetto.
> > This message was scanned by Libra ESVA and is believed to be clean.
> >
> > ______________________________________________
> > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Classification of wind events

Jim Lemon-4
Hi Stefano,
I don't know whether this will help you, but here is a way to
visualize wind speed and direction using clock24.plot:

first_day_POSIX <- as.POSIXct("2020-02-19-00-00", format="%Y-%m-%d-%H-%M")
last_day_POSIX <- as.POSIXct("2020-02-20-00-00", format="%Y-%m-%d-%H-%M")
mydf <- data.frame(data_POSIX=seq(first_day_POSIX, last_day_POSIX, by="10 min"))
mydf$main_dir<-c("WSW","WSW","SW","SW","W","WSW","WSW","WSW","W","W","SW",
 "WSW","SSW","S","SW","SW","WSW","WNW","W","WSW","WSW","SE","SE","SE",
 "NW","NNE","ENE","SE","NNW","NW","NW","NW","NW","NW","NW","NE","NW","NW",
 "NW","NW","NW","N","WNW","NW","NNW","NNW","NW","NW","NW","WNW","ESE","W",
 "WSW","SW","SW","SW","WSW","SW","S","S","SSW","SW","WSW","WSW","WSW","WSW",
 "WSW","WSW","WSW","SW","WSW","WSW","WSW","WSW","SW","SW","WSW","WSW","WSW",
 "WSW","WSW","SW","SW","SW","SW","SW","SW","SW","SW","SW","WSW","WSW","WSW",
 "WSW","SW","SW","SW","SW","WSW","SW","SW","SW","SW","SW","WSW","SW","SW",
 "W","WSW","WSW","SSW","S","WNW","SW","W","WSW","WSW","SE","SE","SE","NW",
 "NNE","ENE","SE","NNW","NW","NW","NW","NW","NW","NW","NE","NW","NW","NW",
 "NW","NW","N","WNW","NW","NNW","NNW","NW","NW","NW")
mydf$max_speed <- c(4.60, 4.60, 3.40, 3.10, 4.80, 4.20, 4.10, 4.50,
4.70, 4.30, 2.40, 2.30, 2.20, 2.10, 2.90, 2.80, 1.80, 2.70, 4.30,
3.30, 2.30, 2.30, 3.20, 3.20, 2.90, 2.30, 1.50, 1.80, 2.90, 2.40,
1.80, 2.40, 2.30, 2.60, 1.80, 2.30, 1.90, 2.20, 2.80, 2.40, 1.00,
1.10, 1.60, 2.30, 2.50, 3.30, 3.40, 3.20, 4.50, 3.90, 3.10, 2.40,
6.00, 7.80, 6.30, 7.80, 8.10, 6.10, 7.40, 9.50, 8.90, 9.10, 10.10,
10.50, 11.10, 10.10, 10.90, 11.30, 13.40, 13.50, 12.80, 11.50, 13.10,
13.50, 11.10, 10.50, 8.50, 10.10, 10.70, 13.60, 11.90, 14.90, 10.90,
10.90, 12.80, 12.10, 9.10, 8.30, 8.80, 7.40, 8.40, 10.30, 10.00, 7.00,
8.50, 8.40, 8.60, 6.70, 7.30, 6.20, 5.90, 5.90, 5.10, 5.80, 5.60,
6.50, 6.60, 11.70, 11.30, 8.70, 7.10, 6.90, 4.30, 3.80, 4.30, 3.30,
2.30, 2.30, 3.20, 3.20, 2.90, 2.30, 1.50, 1.80, 2.90, 2.40, 1.80,
2.40, 2.30, 2.60, 1.80, 2.30, 1.90, 2.20, 2.80, 2.40, 1.00, 1.10,
1.60, 2.30, 2.50, 3.30, 3.40, 3.20, 4.50)
mydf$main_dir<-factor(mydf$main_dir,
 levels=c("N","NNE","NE","ENE","E","ESE","SE","SSE",
 "S","SSW","SW","WSW","W","WNW","NW","NNW"))
dir2degrees<-seq(0,337.5,by=22.5)
mydf$wind_dir<-dir2degrees[as.numeric(mydf$main_dir)]
library(plotrix)
png("SS_spd_dir.png")
clock24.plot(mydf$max_speed,minutes=TRUE,mar=c(4,2,3,2),
 line.col=rainbow(16)[as.numeric(mydf$main_dir)],
 main="Wind speed and direction (color)")
legend(0,-17.5,levels(mydf$main_dir),fill=rainbow(16),
 xjust=0.5,ncol=8,cex=0.8)
dev.off()

Jim

On Sun, May 17, 2020 at 8:07 PM Abby Spurdle <[hidden email]> wrote:

>
> Sorry, please put my last post aside.
> I mis-read your question.
>
> I agree with Jim's comments.
>
>
>
>
>
>
>
>
>
> On Sun, May 17, 2020 at 9:52 PM Abby Spurdle <[hidden email]> wrote:
> >
> > Hi Stefano,
> >
> > I don't have any specific suggestions, but...
> >
> > If you could convert your (character) direction vector into a
> > (numeric) time-ordered direction vector giving radians or degrees, and
> > provide the corresponding speed vector...
> > (i.e. North -> 90 degrees).
> >
> > I'd be happy to try and plot the data in a variety of ways...
> > ...and see if there's any obvious relationships, or anything else useful.
> >
> >
> > On Sat, May 16, 2020 at 10:23 PM Stefano Sofia
> > <[hidden email]> wrote:
> > >
> > > Dear Jim and Jeff,
> > > thank you for your comments. You are right, it is quite difficult to detect this process through a single observation point, I am awre of it.
> > > I need to set up an automatic algorithm to filter 20 years of data, and I have to find an easy way to do it.
> > > I know quite well my automatic stations, the wind direction is very stable during these situations, and therefore I would like to start from it. (I should use also wind speed, relative humidity and temperature, but I will introduce them only once I will be able to manage the direction).
> > > In the case of the example below reported, I know that the directions of this particular automatic station must be only SW or WSW.
> > >
> > > My biggest problem, obviously, is to find the beginning and the end of each event, when there is a change in the main direction.
> > > Thinking about categorical data in general, is there a way to detect periods when one particular category is more frequent?
> > >
> > > Here I reproduce a real example 24 hours long, where these Foehn condition start between 09 and 10 and finish after 19:
> > >
> > > first_day_POSIX <- as.POSIXct("2020-02-19-00-00", format="%Y-%m-%d-%H-%M")
> > > last_day_POSIX <- as.POSIXct("2020-02-20-00-00", format="%Y-%m-%d-%H-%M")
> > > mydf <- data.frame(data_POSIX=seq(first_day_POSIX, last_day_POSIX, by="10 min"))
> > >
> > > mydf$main_dir <- c(WSW, WSW, SW, SW, W, WSW, WSW, WSW, W, W, SW, WSW, SSW, S, SW, SW, WSW, WNW, W, WSW, WSW, SE, SE, SE, NW, NNE, ENE, SE, NNW, NW, NW, NW, NW, NW, NW, NE, NW, NW, NW, NW, NW, N, WNW, NW, NNW, NNW, NW, NW, NW, WNW, ESE, W, WSW, SW, SW, SW, WSW, SW, S, S, SSW, SW, WSW, WSW, WSW, WSW, WSW, WSW, WSW, SW, WSW, WSW, WSW, WSW, SW, SW, WSW, WSW, WSW, WSW, WSW, SW, SW, SW, SW, SW, SW, SW, SW, SW, WSW, WSW, WSW, WSW, SW, SW, SW, SW, WSW, SW, SW, SW, SW, SW, WSW, SW, SW, W, WSW, WSW, SSW, S, WNW, SW, W, WSW, WSW, SE, SE, SE, NW, NNE, ENE, SE, NNW, NW, NW, NW, NW, NW, NW, NE, NW, NW, NW, NW, NW, N, WNW, NW, NNW, NNW, NW, NW, NW)
> > >
> > > mydf$max_speed <- c(4.60, 4.60, 3.40, 3.10, 4.80, 4.20, 4.10, 4.50, 4.70, 4.30, 2.40, 2.30, 2.20, 2.10, 2.90, 2.80, 1.80, 2.70, 4.30, 3.30, 2.30, 2.30, 3.20, 3.20, 2.90, 2.30, 1.50, 1.80, 2.90, 2.40, 1.80, 2.40, 2.30, 2.60, 1.80, 2.30, 1.90, 2.20, 2.80, 2.40, 1.00, 1.10, 1.60, 2.30, 2.50, 3.30, 3.40, 3.20, 4.50, 3.90, 3.10, 2.40, 6.00, 7.80, 6.30, 7.80, 8.10, 6.10, 7.40, 9.50, 8.90, 9.10, 10.10, 10.50, 11.10, 10.10, 10.90, 11.30, 13.40, 13.50, 12.80, 11.50, 13.10, 13.50, 11.10, 10.50, 8.50, 10.10, 10.70, 13.60, 11.90, 14.90, 10.90, 10.90, 12.80, 12.10, 9.10, 8.30, 8.80, 7.40, 8.40, 10.30, 10.00, 7.00, 8.50, 8.40, 8.60, 6.70, 7.30, 6.20, 5.90, 5.90, 5.10, 5.80, 5.60, 6.50, 6.60, 11.70, 11.30, 8.70, 7.10, 6.90, 4.30, 3.80, 4.30, 3.30, 2.30, 2.30, 3.20, 3.20, 2.90, 2.30, 1.50, 1.80, 2.90, 2.40, 1.80, 2.40, 2.30, 2.60, 1.80, 2.30, 1.90, 2.20, 2.80, 2.40, 1.00, 1.10, 1.60, 2.30, 2.50, 3.30, 3.40, 3.20, 4.50)
> > >
> > >
> > > Thank you for your attention
> > > Stefano
> > >
> > >
> > >          (oo)
> > > --oOO--( )--OOo----------------
> > > Stefano Sofia PhD
> > > Civil Protection - Marche Region
> > > Meteo Section
> > > Snow Section
> > > Via del Colle Ameno 5
> > > 60126 Torrette di Ancona, Ancona
> > > Uff: 071 806 7743
> > > E-mail: [hidden email]
> > > ---Oo---------oO----------------
> > >
> > > ________________________________________
> > > Da: Jim Lemon [[hidden email]]
> > > Inviato: mercoledì 13 maggio 2020 11.01
> > > A: Stefano Sofia; r-help mailing list
> > > Oggetto: Re: [R] Classification of wind events
> > >
> > > Hi Stefano,
> > > Given only one observation point you will find it difficult. If your
> > > automatic weather station is in the low area where the foehn wind is
> > > felt, it can only be distinguished from a dry katabatic wind if the
> > > upwind conditions are known. There is a similar but milder version of
> > > this in eastern Australia, but it is usually of the latter sort. There
> > > may be a way to measure turbulence above the peak of the high ground
> > > with radar or something, but I'm not familiar with that.
> > >
> > > Jim
> > >
> > > On Tue, May 12, 2020 at 6:13 PM Stefano Sofia
> > > <[hidden email]> wrote:
> > > >
> > > > Dear R list users,
> > > > I am aware that this question is not strictly related, at the present moment, to R code and it is more general. Please forgive me, but I need to share my thoughts with you.
> > > >
> > > > Foehn conditions on the southern slope of Alps happen with strong northerly flows that impact perpendicularly over the Apls. This situation triggers strong northerly leeward winds.
> > > > Given a single automatic weather station, I would like to identify these periods starting from wind direction and wind intensity data. Frequency of data is quarter of hour.
> > > > I would really find difficult to detect the moving windows of these events:
> > > > - I can't analyse data day by day;
> > > > - at the beginning and at the end of each event, when the process is not at full speed yet, the rotation is not always perfectly identifiable;
> > > > - I cannot claim in principle that the direction of each consecutive observation is costantly and strictly from the chosen direction.
> > > >
> > > > Does anybody have a clue on how to start to build this process in the right way?
> > > >
> > > > Thank you for your attention and your help
> > > > Stefano
> > > >
> > > >          (oo)
> > > > --oOO--( )--OOo----------------
> > > > Stefano Sofia PhD
> > > > Civil Protection - Marche Region
> > > > Meteo Section
> > > > Snow Section
> > > > Via del Colle Ameno 5
> > > > 60126 Torrette di Ancona, Ancona
> > > > Uff: 071 806 7743
> > > > E-mail: [hidden email]
> > > > ---Oo---------oO----------------
> > > >
> > > > ________________________________
> > > >
> > > > AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere informazioni confidenziali, pertanto è destinato solo a persone autorizzate alla ricezione. I messaggi di posta elettronica per i client di Regione Marche possono contenere informazioni confidenziali e con privilegi legali. Se non si è il destinatario specificato, non leggere, copiare, inoltrare o archiviare questo messaggio. Se si è ricevuto questo messaggio per errore, inoltrarlo al mittente ed eliminarlo completamente dal sistema del proprio computer. Ai sensi dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità ed urgenza, la risposta al presente messaggio di posta elettronica può essere visionata da persone estranee al destinatario.
> > > > IMPORTANT NOTICE: This e-mail message is intended to be received only by persons entitled to receive the confidential information it may contain. E-mail messages to clients of Regione Marche may contain information that is confidential and legally privileged. Please do not read, copy, forward, or store this message unless you are an intended recipient of it. If you have received this message in error, please forward it to the sender and delete it completely from your computer system.
> > > >
> > > > --
> > > > Questo messaggio  stato analizzato da Libra ESVA ed  risultato non infetto.
> > > > This message was scanned by Libra ESVA and is believed to be clean.
> > > >
> > > >
> > > >         [[alternative HTML version deleted]]
> > > >
> > > > ______________________________________________
> > > > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > > > and provide commented, minimal, self-contained, reproducible code.
> > >
> > > --
> > >
> > > Questo messaggio  stato analizzato con Libra ESVA ed  risultato non infetto.
> > >
> > >
> > > ________________________________
> > >
> > > AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere informazioni confidenziali, pertanto è destinato solo a persone autorizzate alla ricezione. I messaggi di posta elettronica per i client di Regione Marche possono contenere informazioni confidenziali e con privilegi legali. Se non si è il destinatario specificato, non leggere, copiare, inoltrare o archiviare questo messaggio. Se si è ricevuto questo messaggio per errore, inoltrarlo al mittente ed eliminarlo completamente dal sistema del proprio computer. Ai sensi dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità ed urgenza, la risposta al presente messaggio di posta elettronica può essere visionata da persone estranee al destinatario.
> > > IMPORTANT NOTICE: This e-mail message is intended to be received only by persons entitled to receive the confidential information it may contain. E-mail messages to clients of Regione Marche may contain information that is confidential and legally privileged. Please do not read, copy, forward, or store this message unless you are an intended recipient of it. If you have received this message in error, please forward it to the sender and delete it completely from your computer system.
> > >
> > > --
> > > Questo messaggio  stato analizzato da Libra ESVA ed  risultato non infetto.
> > > This message was scanned by Libra ESVA and is believed to be clean.
> > >
> > > ______________________________________________
> > > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > > and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

SS_spd_dir.png (109K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Classification of wind events

Stefano Sofia
In reply to this post by Jeff Newmiller
Sorry for my fault.
I am very grateful for such code, which is extremely efficient. I would have never been able to reach these results.

In order to preserve the quality of this code, I dare to ask you a final question: once identified each single period in the column foehn1c, this period can be taken into consideration only if within it the mean of max_speed is higher than 8.0 (which is speed in m/s).
Could you please help me in this final step?

Thank you again for all your help
Stefano


         (oo)
--oOO--( )--OOo----------------
Stefano Sofia PhD
Civil Protection - Marche Region
Meteo Section
Snow Section
Via del Colle Ameno 5
60126 Torrette di Ancona, Ancona
Uff: 071 806 7743
E-mail: [hidden email]
---Oo---------oO----------------

________________________________________
Da: Jeff Newmiller [[hidden email]]
Inviato: sabato 16 maggio 2020 21.04
A: Stefano Sofia; Jim Lemon; r-help mailing list
Oggetto: RE: [R] Classification of wind events

Please run your code before posting it... you forgot the quotes in your main_dir column.

first_day_POSIX <- as.POSIXct("2020-02-19-00-00", format="%Y-%m-%d-%H-%M")
last_day_POSIX <- as.POSIXct("2020-02-20-00-00", format="%Y-%m-%d-%H-%M")
mydf <- data.frame(data_POSIX=seq(first_day_POSIX, last_day_POSIX, by="10 min"))

mydf$main_dir <- c("WSW", "WSW", "SW", "SW", "W", "WSW", "WSW", "WSW", "W", "W", "SW", "WSW", "SSW", "S", "SW", "SW", "WSW", "WNW", "W", "WSW", "WSW", "SE", "SE", "SE", "NW", "NNE", "ENE", "SE", "NNW", "NW", "NW", "NW", "NW", "NW", "NW", "NE", "NW", "NW", "NW", "NW", "NW", "N", "WNW", "NW", "NNW", "NNW", "NW", "NW", "NW", "WNW", "ESE", "W", "WSW", "SW", "SW", "SW", "WSW", "SW", "S", "S", "SSW", "SW", "WSW", "WSW", "WSW", "WSW", "WSW", "WSW", "WSW", "SW", "WSW", "WSW", "WSW", "WSW", "SW", "SW", "WSW", "WSW", "WSW", "WSW", "WSW", "SW", "SW", "SW", "SW", "SW", "SW", "SW", "SW", "SW", "WSW", "WSW", "WSW", "WSW", "SW", "SW", "SW", "SW", "WSW", "SW", "SW", "SW", "SW", "SW", "WSW", "SW", "SW", "W", "WSW", "WSW", "SSW", "S", "WNW", "SW", "W", "WSW", "WSW", "SE", "SE", "SE", "NW", "NNE", "ENE", "SE", "NNW", "NW", "NW", "NW", "NW", "NW", "NW", "NE", "NW", "NW", "NW", "NW", "NW", "N", "WNW", "NW", "NNW", "NNW", "NW", "NW", "NW")

mydf$max_speed <- c(4.60, 4.60, 3.40, 3.10, 4.80, 4.20, 4.10, 4.50, 4.70, 4.30, 2.40, 2.30, 2.20, 2.10, 2.90, 2.80, 1.80, 2.70, 4.30, 3.30, 2.30, 2.30, 3.20, 3.20, 2.90, 2.30, 1.50, 1.80, 2.90, 2.40, 1.80, 2.40, 2.30, 2.60, 1.80, 2.30, 1.90, 2.20, 2.80, 2.40, 1.00, 1.10, 1.60, 2.30, 2.50, 3.30, 3.40, 3.20, 4.50, 3.90, 3.10, 2.40, 6.00, 7.80, 6.30, 7.80, 8.10, 6.10, 7.40, 9.50, 8.90, 9.10, 10.10, 10.50, 11.10, 10.10, 10.90, 11.30, 13.40, 13.50, 12.80, 11.50, 13.10, 13.50, 11.10, 10.50, 8.50, 10.10, 10.70, 13.60, 11.90, 14.90, 10.90, 10.90, 12.80, 12.10, 9.10, 8.30, 8.80, 7.40, 8.40, 10.30, 10.00, 7.00, 8.50, 8.40, 8.60, 6.70, 7.30, 6.20, 5.90, 5.90, 5.10, 5.80, 5.60, 6.50, 6.60, 11.70, 11.30, 8.70, 7.10, 6.90, 4.30, 3.80, 4.30, 3.30, 2.30, 2.30, 3.20, 3.20, 2.90, 2.30, 1.50, 1.80, 2.90, 2.40, 1.80, 2.40, 2.30, 2.60, 1.80, 2.30, 1.90, 2.20, 2.80, 2.40, 1.00, 1.10, 1.60, 2.30, 2.50, 3.30, 3.40, 3.20, 4.50)
# mark candidate rows
mydf$foehn1a <- mydf$main_dir %in% c( "WSW", "SW" )
# mark unstable conditions
mydf$foehn1b <- with( mydf
                    , cumsum( !foehn1a )
                    )
# find minimum length of foehn conditions
mydf$foehn1c <- ave( rep( 1, nrow( mydf ) )
                   , mydf$foehn1b
                   , FUN=function(v) 10 < length( v )
                   )
# find starts of foehns
mydf$foehn1d <- with( mydf
                    , 0 < diff( c( 0, foehn1c ) )
                    )
# identify foehns distinctly (multiple days)
mydf$foehn1e <- with( mydf
                    , ifelse( foehn1c
                            , cumsum( foehn1d )
                            , 0
                            )
                    )
mydf[ , c( 1, 2, 8 ) ]

On May 16, 2020 3:21:24 AM PDT, Stefano Sofia <[hidden email]> wrote:

>Dear Jim and Jeff,
>thank you for your comments. You are right, it is quite difficult to
>detect this process through a single observation point, I am awre of
>it.
>I need to set up an automatic algorithm to filter 20 years of data, and
>I have to find an easy way to do it.
>I know quite well my automatic stations, the wind direction is very
>stable during these situations, and therefore I would like to start
>from it. (I should use also wind speed, relative humidity and
>temperature, but I will introduce them only once I will be able to
>manage the direction).
>In the case of the example below reported, I know that the directions
>of this particular automatic station must be only SW or WSW.
>
>My biggest problem, obviously, is to find the beginning and the end of
>each event, when there is a change in the main direction.
>Thinking about categorical data in general, is there a way to detect
>periods when one particular category is more frequent?
>
>Here I reproduce a real example 24 hours long, where these Foehn
>condition start between 09 and 10 and finish after 19:
>
>first_day_POSIX <- as.POSIXct("2020-02-19-00-00",
>format="%Y-%m-%d-%H-%M")
>last_day_POSIX <- as.POSIXct("2020-02-20-00-00",
>format="%Y-%m-%d-%H-%M")
>mydf <- data.frame(data_POSIX=seq(first_day_POSIX, last_day_POSIX,
>by="10 min"))
>
>mydf$main_dir <- c(WSW, WSW, SW, SW, W, WSW, WSW, WSW, W, W, SW, WSW,
>SSW, S, SW, SW, WSW, WNW, W, WSW, WSW, SE, SE, SE, NW, NNE, ENE, SE,
>NNW, NW, NW, NW, NW, NW, NW, NE, NW, NW, NW, NW, NW, N, WNW, NW, NNW,
>NNW, NW, NW, NW, WNW, ESE, W, WSW, SW, SW, SW, WSW, SW, S, S, SSW, SW,
>WSW, WSW, WSW, WSW, WSW, WSW, WSW, SW, WSW, WSW, WSW, WSW, SW, SW, WSW,
>WSW, WSW, WSW, WSW, SW, SW, SW, SW, SW, SW, SW, SW, SW, WSW, WSW, WSW,
>WSW, SW, SW, SW, SW, WSW, SW, SW, SW, SW, SW, WSW, SW, SW, W, WSW, WSW,
>SSW, S, WNW, SW, W, WSW, WSW, SE, SE, SE, NW, NNE, ENE, SE, NNW, NW,
>NW, NW, NW, NW, NW, NE, NW, NW, NW, NW, NW, N, WNW, NW, NNW, NNW, NW,
>NW, NW)
>
>mydf$max_speed <- c(4.60, 4.60, 3.40, 3.10, 4.80, 4.20, 4.10, 4.50,
>4.70, 4.30, 2.40, 2.30, 2.20, 2.10, 2.90, 2.80, 1.80, 2.70, 4.30, 3.30,
>2.30, 2.30, 3.20, 3.20, 2.90, 2.30, 1.50, 1.80, 2.90, 2.40, 1.80, 2.40,
>2.30, 2.60, 1.80, 2.30, 1.90, 2.20, 2.80, 2.40, 1.00, 1.10, 1.60, 2.30,
>2.50, 3.30, 3.40, 3.20, 4.50, 3.90, 3.10, 2.40, 6.00, 7.80, 6.30, 7.80,
>8.10, 6.10, 7.40, 9.50, 8.90, 9.10, 10.10, 10.50, 11.10, 10.10, 10.90,
>11.30, 13.40, 13.50, 12.80, 11.50, 13.10, 13.50, 11.10, 10.50, 8.50,
>10.10, 10.70, 13.60, 11.90, 14.90, 10.90, 10.90, 12.80, 12.10, 9.10,
>8.30, 8.80, 7.40, 8.40, 10.30, 10.00, 7.00, 8.50, 8.40, 8.60, 6.70,
>7.30, 6.20, 5.90, 5.90, 5.10, 5.80, 5.60, 6.50, 6.60, 11.70, 11.30,
>8.70, 7.10, 6.90, 4.30, 3.80, 4.30, 3.30, 2.30, 2.30, 3.20, 3.20, 2.90,
>2.30, 1.50, 1.80, 2.90, 2.40, 1.80, 2.40, 2.30, 2.60, 1.80, 2.30, 1.90,
>2.20, 2.80, 2.40, 1.00, 1.10, 1.60, 2.30, 2.50, 3.30, 3.40, 3.20, 4.50)
>
>
>Thank you for your attention
>Stefano
>
>
>         (oo)
>--oOO--( )--OOo----------------
>Stefano Sofia PhD
>Civil Protection - Marche Region
>Meteo Section
>Snow Section
>Via del Colle Ameno 5
>60126 Torrette di Ancona, Ancona
>Uff: 071 806 7743
>E-mail: [hidden email]
>---Oo---------oO----------------
>
>________________________________________
>Da: Jim Lemon [[hidden email]]
>Inviato: mercoledì 13 maggio 2020 11.01
>A: Stefano Sofia; r-help mailing list
>Oggetto: Re: [R] Classification of wind events
>
>Hi Stefano,
>Given only one observation point you will find it difficult. If your
>automatic weather station is in the low area where the foehn wind is
>felt, it can only be distinguished from a dry katabatic wind if the
>upwind conditions are known. There is a similar but milder version of
>this in eastern Australia, but it is usually of the latter sort. There
>may be a way to measure turbulence above the peak of the high ground
>with radar or something, but I'm not familiar with that.
>
>Jim
>
>On Tue, May 12, 2020 at 6:13 PM Stefano Sofia
><[hidden email]> wrote:
>>
>> Dear R list users,
>> I am aware that this question is not strictly related, at the present
>moment, to R code and it is more general. Please forgive me, but I need
>to share my thoughts with you.
>>
>> Foehn conditions on the southern slope of Alps happen with strong
>northerly flows that impact perpendicularly over the Apls. This
>situation triggers strong northerly leeward winds.
>> Given a single automatic weather station, I would like to identify
>these periods starting from wind direction and wind intensity data.
>Frequency of data is quarter of hour.
>> I would really find difficult to detect the moving windows of these
>events:
>> - I can't analyse data day by day;
>> - at the beginning and at the end of each event, when the process is
>not at full speed yet, the rotation is not always perfectly
>identifiable;
>> - I cannot claim in principle that the direction of each consecutive
>observation is costantly and strictly from the chosen direction.
>>
>> Does anybody have a clue on how to start to build this process in the
>right way?
>>
>> Thank you for your attention and your help
>> Stefano
>>
>>          (oo)
>> --oOO--( )--OOo----------------
>> Stefano Sofia PhD
>> Civil Protection - Marche Region
>> Meteo Section
>> Snow Section
>> Via del Colle Ameno 5
>> 60126 Torrette di Ancona, Ancona
>> Uff: 071 806 7743
>> E-mail: [hidden email]
>> ---Oo---------oO----------------
>>
>> ________________________________
>>
>> AVVISO IMPORTANTE: Questo messaggio di posta elettronica può
>contenere informazioni confidenziali, pertanto è destinato solo a
>persone autorizzate alla ricezione. I messaggi di posta elettronica per
>i client di Regione Marche possono contenere informazioni confidenziali
>e con privilegi legali. Se non si è il destinatario specificato, non
>leggere, copiare, inoltrare o archiviare questo messaggio. Se si è
>ricevuto questo messaggio per errore, inoltrarlo al mittente ed
>eliminarlo completamente dal sistema del proprio computer. Ai sensi
>dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità
>ed urgenza, la risposta al presente messaggio di posta elettronica può
>essere visionata da persone estranee al destinatario.
>> IMPORTANT NOTICE: This e-mail message is intended to be received only
>by persons entitled to receive the confidential information it may
>contain. E-mail messages to clients of Regione Marche may contain
>information that is confidential and legally privileged. Please do not
>read, copy, forward, or store this message unless you are an intended
>recipient of it. If you have received this message in error, please
>forward it to the sender and delete it completely from your computer
>system.
>>
>> --
>> Questo messaggio  stato analizzato da Libra ESVA ed  risultato non
>infetto.
>> This message was scanned by Libra ESVA and is believed to be clean.
>>
>>
>>         [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>--
>
>Questo messaggio  stato analizzato con Libra ESVA ed  risultato non
>infetto.
>
>
>________________________________
>
>AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere
>informazioni confidenziali, pertanto è destinato solo a persone
>autorizzate alla ricezione. I messaggi di posta elettronica per i
>client di Regione Marche possono contenere informazioni confidenziali e
>con privilegi legali. Se non si è il destinatario specificato, non
>leggere, copiare, inoltrare o archiviare questo messaggio. Se si è
>ricevuto questo messaggio per errore, inoltrarlo al mittente ed
>eliminarlo completamente dal sistema del proprio computer. Ai sensi
>dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità
>ed urgenza, la risposta al presente messaggio di posta elettronica può
>essere visionata da persone estranee al destinatario.
>IMPORTANT NOTICE: This e-mail message is intended to be received only
>by persons entitled to receive the confidential information it may
>contain. E-mail messages to clients of Regione Marche may contain
>information that is confidential and legally privileged. Please do not
>read, copy, forward, or store this message unless you are an intended
>recipient of it. If you have received this message in error, please
>forward it to the sender and delete it completely from your computer
>system.
>
>-->
>Questo messaggio  stato analizzato da Libra ESVA ed  risultato non
>infetto.>
>This message was scanned by Libra ESVA and is believed to be clean.

--
Sent from my phone. Please excuse my brevity.

--

Questo messaggio  stato analizzato con Libra ESVA ed  risultato non infetto.


________________________________

AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere informazioni confidenziali, pertanto è destinato solo a persone autorizzate alla ricezione. I messaggi di posta elettronica per i client di Regione Marche possono contenere informazioni confidenziali e con privilegi legali. Se non si è il destinatario specificato, non leggere, copiare, inoltrare o archiviare questo messaggio. Se si è ricevuto questo messaggio per errore, inoltrarlo al mittente ed eliminarlo completamente dal sistema del proprio computer. Ai sensi dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità ed urgenza, la risposta al presente messaggio di posta elettronica può essere visionata da persone estranee al destinatario.
IMPORTANT NOTICE: This e-mail message is intended to be received only by persons entitled to receive the confidential information it may contain. E-mail messages to clients of Regione Marche may contain information that is confidential and legally privileged. Please do not read, copy, forward, or store this message unless you are an intended recipient of it. If you have received this message in error, please forward it to the sender and delete it completely from your computer system.

--
Questo messaggio  stato analizzato da Libra ESVA ed  risultato non infetto.
This message was scanned by Libra ESVA and is believed to be clean.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Classification of wind events

Jim Lemon-4
Hi Stefano,
If I understand your request, this may also help, Uses the same data
transformations as my previous email.

png("SS_foehn.png")
plot(mydf$data_POSIX,
 ifelse(mydf$main_dir %in% c("WSW","SW"),mydf$max_speed,NA),
 type="b",main="Wind speed (WSW or SW) by time",
 xlab="Time of day",ylab="Wind speed km/h",
 col=rainbow(16)[as.numeric(mydf$main_dir)])
abline(h=8,col="orange",lwd=2)
source("../rollmean.R")
rmws<-rollmean(mydf$max_speed,4)
lines(mydf$data_POSIX,rmws,col="orange",lwd=2)
legend("topleft","Rolling mean of 4 for wind speed",
 lty=1,lwd=2,col="orange")
dev.off()

Jim

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

SS_foehn.png (45K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Classification of wind events

Jeff Newmiller
In reply to this post by Stefano Sofia
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 <[hidden email]> wrote:

>Sorry for my fault.
>I am very grateful for such code, which is extremely efficient. I would
>have never been able to reach these results.
>
>In order to preserve the quality of this code, I dare to ask you a
>final question: once identified each single period in the column
>foehn1c, this period can be taken into consideration only if within it
>the mean of max_speed is higher than 8.0 (which is speed in m/s).
>Could you please help me in this final step?
>
>Thank you again for all your help
>Stefano
>
>
>         (oo)
>--oOO--( )--OOo----------------
>Stefano Sofia PhD
>Civil Protection - Marche Region
>Meteo Section
>Snow Section
>Via del Colle Ameno 5
>60126 Torrette di Ancona, Ancona
>Uff: 071 806 7743
>E-mail: [hidden email]
>---Oo---------oO----------------
>
>________________________________________
>Da: Jeff Newmiller [[hidden email]]
>Inviato: sabato 16 maggio 2020 21.04
>A: Stefano Sofia; Jim Lemon; r-help mailing list
>Oggetto: RE: [R] Classification of wind events
>
>Please run your code before posting it... you forgot the quotes in your
>main_dir column.
>
>first_day_POSIX <- as.POSIXct("2020-02-19-00-00",
>format="%Y-%m-%d-%H-%M")
>last_day_POSIX <- as.POSIXct("2020-02-20-00-00",
>format="%Y-%m-%d-%H-%M")
>mydf <- data.frame(data_POSIX=seq(first_day_POSIX, last_day_POSIX,
>by="10 min"))
>
>mydf$main_dir <- c("WSW", "WSW", "SW", "SW", "W", "WSW", "WSW", "WSW",
>"W", "W", "SW", "WSW", "SSW", "S", "SW", "SW", "WSW", "WNW", "W",
>"WSW", "WSW", "SE", "SE", "SE", "NW", "NNE", "ENE", "SE", "NNW", "NW",
>"NW", "NW", "NW", "NW", "NW", "NE", "NW", "NW", "NW", "NW", "NW", "N",
>"WNW", "NW", "NNW", "NNW", "NW", "NW", "NW", "WNW", "ESE", "W", "WSW",
>"SW", "SW", "SW", "WSW", "SW", "S", "S", "SSW", "SW", "WSW", "WSW",
>"WSW", "WSW", "WSW", "WSW", "WSW", "SW", "WSW", "WSW", "WSW", "WSW",
>"SW", "SW", "WSW", "WSW", "WSW", "WSW", "WSW", "SW", "SW", "SW", "SW",
>"SW", "SW", "SW", "SW", "SW", "WSW", "WSW", "WSW", "WSW", "SW", "SW",
>"SW", "SW", "WSW", "SW", "SW", "SW", "SW", "SW", "WSW", "SW", "SW",
>"W", "WSW", "WSW", "SSW", "S", "WNW", "SW", "W", "WSW", "WSW", "SE",
>"SE", "SE", "NW", "NNE", "ENE", "SE", "NNW", "NW", "NW", "NW", "NW",
>"NW", "NW", "NE", "NW", "NW", "NW", "NW", "NW", "N", "WNW", "NW",
>"NNW", "NNW", "NW", "NW", "NW")
>
>mydf$max_speed <- c(4.60, 4.60, 3.40, 3.10, 4.80, 4.20, 4.10, 4.50,
>4.70, 4.30, 2.40, 2.30, 2.20, 2.10, 2.90, 2.80, 1.80, 2.70, 4.30, 3.30,
>2.30, 2.30, 3.20, 3.20, 2.90, 2.30, 1.50, 1.80, 2.90, 2.40, 1.80, 2.40,
>2.30, 2.60, 1.80, 2.30, 1.90, 2.20, 2.80, 2.40, 1.00, 1.10, 1.60, 2.30,
>2.50, 3.30, 3.40, 3.20, 4.50, 3.90, 3.10, 2.40, 6.00, 7.80, 6.30, 7.80,
>8.10, 6.10, 7.40, 9.50, 8.90, 9.10, 10.10, 10.50, 11.10, 10.10, 10.90,
>11.30, 13.40, 13.50, 12.80, 11.50, 13.10, 13.50, 11.10, 10.50, 8.50,
>10.10, 10.70, 13.60, 11.90, 14.90, 10.90, 10.90, 12.80, 12.10, 9.10,
>8.30, 8.80, 7.40, 8.40, 10.30, 10.00, 7.00, 8.50, 8.40, 8.60, 6.70,
>7.30, 6.20, 5.90, 5.90, 5.10, 5.80, 5.60, 6.50, 6.60, 11.70, 11.30,
>8.70, 7.10, 6.90, 4.30, 3.80, 4.30, 3.30, 2.30, 2.30, 3.20, 3.20, 2.90,
>2.30, 1.50, 1.80, 2.90, 2.40, 1.80, 2.40, 2.30, 2.60, 1.80, 2.30, 1.90,
>2.20, 2.80, 2.40, 1.00, 1.10, 1.60, 2.30, 2.50, 3.30, 3.40, 3.20, 4.50)
># mark candidate rows
>mydf$foehn1a <- mydf$main_dir %in% c( "WSW", "SW" )
># mark unstable conditions
>mydf$foehn1b <- with( mydf
>                    , cumsum( !foehn1a )
>                    )
># find minimum length of foehn conditions
>mydf$foehn1c <- ave( rep( 1, nrow( mydf ) )
>                   , mydf$foehn1b
>                   , FUN=function(v) 10 < length( v )
>                   )
># find starts of foehns
>mydf$foehn1d <- with( mydf
>                    , 0 < diff( c( 0, foehn1c ) )
>                    )
># identify foehns distinctly (multiple days)
>mydf$foehn1e <- with( mydf
>                    , ifelse( foehn1c
>                            , cumsum( foehn1d )
>                            , 0
>                            )
>                    )
>mydf[ , c( 1, 2, 8 ) ]
>
>On May 16, 2020 3:21:24 AM PDT, Stefano Sofia
><[hidden email]> wrote:
>>Dear Jim and Jeff,
>>thank you for your comments. You are right, it is quite difficult to
>>detect this process through a single observation point, I am awre of
>>it.
>>I need to set up an automatic algorithm to filter 20 years of data,
>and
>>I have to find an easy way to do it.
>>I know quite well my automatic stations, the wind direction is very
>>stable during these situations, and therefore I would like to start
>>from it. (I should use also wind speed, relative humidity and
>>temperature, but I will introduce them only once I will be able to
>>manage the direction).
>>In the case of the example below reported, I know that the directions
>>of this particular automatic station must be only SW or WSW.
>>
>>My biggest problem, obviously, is to find the beginning and the end of
>>each event, when there is a change in the main direction.
>>Thinking about categorical data in general, is there a way to detect
>>periods when one particular category is more frequent?
>>
>>Here I reproduce a real example 24 hours long, where these Foehn
>>condition start between 09 and 10 and finish after 19:
>>
>>first_day_POSIX <- as.POSIXct("2020-02-19-00-00",
>>format="%Y-%m-%d-%H-%M")
>>last_day_POSIX <- as.POSIXct("2020-02-20-00-00",
>>format="%Y-%m-%d-%H-%M")
>>mydf <- data.frame(data_POSIX=seq(first_day_POSIX, last_day_POSIX,
>>by="10 min"))
>>
>>mydf$main_dir <- c(WSW, WSW, SW, SW, W, WSW, WSW, WSW, W, W, SW, WSW,
>>SSW, S, SW, SW, WSW, WNW, W, WSW, WSW, SE, SE, SE, NW, NNE, ENE, SE,
>>NNW, NW, NW, NW, NW, NW, NW, NE, NW, NW, NW, NW, NW, N, WNW, NW, NNW,
>>NNW, NW, NW, NW, WNW, ESE, W, WSW, SW, SW, SW, WSW, SW, S, S, SSW, SW,
>>WSW, WSW, WSW, WSW, WSW, WSW, WSW, SW, WSW, WSW, WSW, WSW, SW, SW,
>WSW,
>>WSW, WSW, WSW, WSW, SW, SW, SW, SW, SW, SW, SW, SW, SW, WSW, WSW, WSW,
>>WSW, SW, SW, SW, SW, WSW, SW, SW, SW, SW, SW, WSW, SW, SW, W, WSW,
>WSW,
>>SSW, S, WNW, SW, W, WSW, WSW, SE, SE, SE, NW, NNE, ENE, SE, NNW, NW,
>>NW, NW, NW, NW, NW, NE, NW, NW, NW, NW, NW, N, WNW, NW, NNW, NNW, NW,
>>NW, NW)
>>
>>mydf$max_speed <- c(4.60, 4.60, 3.40, 3.10, 4.80, 4.20, 4.10, 4.50,
>>4.70, 4.30, 2.40, 2.30, 2.20, 2.10, 2.90, 2.80, 1.80, 2.70, 4.30,
>3.30,
>>2.30, 2.30, 3.20, 3.20, 2.90, 2.30, 1.50, 1.80, 2.90, 2.40, 1.80,
>2.40,
>>2.30, 2.60, 1.80, 2.30, 1.90, 2.20, 2.80, 2.40, 1.00, 1.10, 1.60,
>2.30,
>>2.50, 3.30, 3.40, 3.20, 4.50, 3.90, 3.10, 2.40, 6.00, 7.80, 6.30,
>7.80,
>>8.10, 6.10, 7.40, 9.50, 8.90, 9.10, 10.10, 10.50, 11.10, 10.10, 10.90,
>>11.30, 13.40, 13.50, 12.80, 11.50, 13.10, 13.50, 11.10, 10.50, 8.50,
>>10.10, 10.70, 13.60, 11.90, 14.90, 10.90, 10.90, 12.80, 12.10, 9.10,
>>8.30, 8.80, 7.40, 8.40, 10.30, 10.00, 7.00, 8.50, 8.40, 8.60, 6.70,
>>7.30, 6.20, 5.90, 5.90, 5.10, 5.80, 5.60, 6.50, 6.60, 11.70, 11.30,
>>8.70, 7.10, 6.90, 4.30, 3.80, 4.30, 3.30, 2.30, 2.30, 3.20, 3.20,
>2.90,
>>2.30, 1.50, 1.80, 2.90, 2.40, 1.80, 2.40, 2.30, 2.60, 1.80, 2.30,
>1.90,
>>2.20, 2.80, 2.40, 1.00, 1.10, 1.60, 2.30, 2.50, 3.30, 3.40, 3.20,
>4.50)
>>
>>
>>Thank you for your attention
>>Stefano
>>
>>
>>         (oo)
>>--oOO--( )--OOo----------------
>>Stefano Sofia PhD
>>Civil Protection - Marche Region
>>Meteo Section
>>Snow Section
>>Via del Colle Ameno 5
>>60126 Torrette di Ancona, Ancona
>>Uff: 071 806 7743
>>E-mail: [hidden email]
>>---Oo---------oO----------------
>>
>>________________________________________
>>Da: Jim Lemon [[hidden email]]
>>Inviato: mercoledì 13 maggio 2020 11.01
>>A: Stefano Sofia; r-help mailing list
>>Oggetto: Re: [R] Classification of wind events
>>
>>Hi Stefano,
>>Given only one observation point you will find it difficult. If your
>>automatic weather station is in the low area where the foehn wind is
>>felt, it can only be distinguished from a dry katabatic wind if the
>>upwind conditions are known. There is a similar but milder version of
>>this in eastern Australia, but it is usually of the latter sort. There
>>may be a way to measure turbulence above the peak of the high ground
>>with radar or something, but I'm not familiar with that.
>>
>>Jim
>>
>>On Tue, May 12, 2020 at 6:13 PM Stefano Sofia
>><[hidden email]> wrote:
>>>
>>> Dear R list users,
>>> I am aware that this question is not strictly related, at the
>present
>>moment, to R code and it is more general. Please forgive me, but I
>need
>>to share my thoughts with you.
>>>
>>> Foehn conditions on the southern slope of Alps happen with strong
>>northerly flows that impact perpendicularly over the Apls. This
>>situation triggers strong northerly leeward winds.
>>> Given a single automatic weather station, I would like to identify
>>these periods starting from wind direction and wind intensity data.
>>Frequency of data is quarter of hour.
>>> I would really find difficult to detect the moving windows of these
>>events:
>>> - I can't analyse data day by day;
>>> - at the beginning and at the end of each event, when the process is
>>not at full speed yet, the rotation is not always perfectly
>>identifiable;
>>> - I cannot claim in principle that the direction of each consecutive
>>observation is costantly and strictly from the chosen direction.
>>>
>>> Does anybody have a clue on how to start to build this process in
>the
>>right way?
>>>
>>> Thank you for your attention and your help
>>> Stefano
>>>
>>>          (oo)
>>> --oOO--( )--OOo----------------
>>> Stefano Sofia PhD
>>> Civil Protection - Marche Region
>>> Meteo Section
>>> Snow Section
>>> Via del Colle Ameno 5
>>> 60126 Torrette di Ancona, Ancona
>>> Uff: 071 806 7743
>>> E-mail: [hidden email]
>>> ---Oo---------oO----------------
>>>
>>> ________________________________
>>>
>>> AVVISO IMPORTANTE: Questo messaggio di posta elettronica può
>>contenere informazioni confidenziali, pertanto è destinato solo a
>>persone autorizzate alla ricezione. I messaggi di posta elettronica
>per
>>i client di Regione Marche possono contenere informazioni
>confidenziali
>>e con privilegi legali. Se non si è il destinatario specificato, non
>>leggere, copiare, inoltrare o archiviare questo messaggio. Se si è
>>ricevuto questo messaggio per errore, inoltrarlo al mittente ed
>>eliminarlo completamente dal sistema del proprio computer. Ai sensi
>>dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di
>necessità
>>ed urgenza, la risposta al presente messaggio di posta elettronica può
>>essere visionata da persone estranee al destinatario.
>>> IMPORTANT NOTICE: This e-mail message is intended to be received
>only
>>by persons entitled to receive the confidential information it may
>>contain. E-mail messages to clients of Regione Marche may contain
>>information that is confidential and legally privileged. Please do not
>>read, copy, forward, or store this message unless you are an intended
>>recipient of it. If you have received this message in error, please
>>forward it to the sender and delete it completely from your computer
>>system.
>>>
>>> --
>>> Questo messaggio  stato analizzato da Libra ESVA ed  risultato non
>>infetto.
>>> This message was scanned by Libra ESVA and is believed to be clean.
>>>
>>>
>>>         [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>
>>--
>>
>>Questo messaggio  stato analizzato con Libra ESVA ed  risultato non
>>infetto.
>>
>>
>>________________________________
>>
>>AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere
>>informazioni confidenziali, pertanto è destinato solo a persone
>>autorizzate alla ricezione. I messaggi di posta elettronica per i
>>client di Regione Marche possono contenere informazioni confidenziali
>e
>>con privilegi legali. Se non si è il destinatario specificato, non
>>leggere, copiare, inoltrare o archiviare questo messaggio. Se si è
>>ricevuto questo messaggio per errore, inoltrarlo al mittente ed
>>eliminarlo completamente dal sistema del proprio computer. Ai sensi
>>dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di
>necessità
>>ed urgenza, la risposta al presente messaggio di posta elettronica può
>>essere visionata da persone estranee al destinatario.
>>IMPORTANT NOTICE: This e-mail message is intended to be received only
>>by persons entitled to receive the confidential information it may
>>contain. E-mail messages to clients of Regione Marche may contain
>>information that is confidential and legally privileged. Please do not
>>read, copy, forward, or store this message unless you are an intended
>>recipient of it. If you have received this message in error, please
>>forward it to the sender and delete it completely from your computer
>>system.
>>
>>-->
>>Questo messaggio  stato analizzato da Libra ESVA ed  risultato non
>>infetto.>
>>This message was scanned by Libra ESVA and is believed to be clean.
>
>--
>Sent from my phone. Please excuse my brevity.
>
>--
>
>Questo messaggio  stato analizzato con Libra ESVA ed  risultato non
>infetto.
>
>
>________________________________
>
>AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere
>informazioni confidenziali, pertanto è destinato solo a persone
>autorizzate alla ricezione. I messaggi di posta elettronica per i
>client di Regione Marche possono contenere informazioni confidenziali e
>con privilegi legali. Se non si è il destinatario specificato, non
>leggere, copiare, inoltrare o archiviare questo messaggio. Se si è
>ricevuto questo messaggio per errore, inoltrarlo al mittente ed
>eliminarlo completamente dal sistema del proprio computer. Ai sensi
>dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità
>ed urgenza, la risposta al presente messaggio di posta elettronica può
>essere visionata da persone estranee al destinatario.
>IMPORTANT NOTICE: This e-mail message is intended to be received only
>by persons entitled to receive the confidential information it may
>contain. E-mail messages to clients of Regione Marche may contain
>information that is confidential and legally privileged. Please do not
>read, copy, forward, or store this message unless you are an intended
>recipient of it. If you have received this message in error, please
>forward it to the sender and delete it completely from your computer
>system.
>
>-->
>Questo messaggio  stato analizzato da Libra ESVA ed  risultato non
>infetto.>
>This message was scanned by Libra ESVA and is believed to be clean.

--
Sent from my phone. Please excuse my brevity.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Classification of wind events

Jeff Newmiller
In reply to this post by Jim Lemon-4
? source("../rollmean.R") ?

On May 18, 2020 4:11:52 AM PDT, Jim Lemon <[hidden email]> wrote:

>Hi Stefano,
>If I understand your request, this may also help, Uses the same data
>transformations as my previous email.
>
>png("SS_foehn.png")
>plot(mydf$data_POSIX,
> ifelse(mydf$main_dir %in% c("WSW","SW"),mydf$max_speed,NA),
> type="b",main="Wind speed (WSW or SW) by time",
> xlab="Time of day",ylab="Wind speed km/h",
> col=rainbow(16)[as.numeric(mydf$main_dir)])
>abline(h=8,col="orange",lwd=2)
>source("../rollmean.R")
>rmws<-rollmean(mydf$max_speed,4)
>lines(mydf$data_POSIX,rmws,col="orange",lwd=2)
>legend("topleft","Rolling mean of 4 for wind speed",
> lty=1,lwd=2,col="orange")
>dev.off()
>
>Jim

--
Sent from my phone. Please excuse my brevity.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Classification of wind events

Jim Lemon-4
Sorry, I should know better:

rollmean<-function(x,width=2) {
 lenx<-length(x)
 result<-rep(NA,lenx)
 for(i in 1:lenx) {
  chunk<-i:(i+width-1)
  if(i<width) chunk<-c(rep(1,width-i),1:i)
  if(i>(lenx-width)) chunk<-c(i:lenx,rep(lenx,i-(width-1)))
  result[i]<-mean(x[chunk])
 }
 return(result)
}

I forgot to replace this with:

library(zoo)
rollmean...

Jim

On Tue, May 19, 2020 at 1:26 AM Jeff Newmiller <[hidden email]> wrote:

>
> ? source("../rollmean.R") ?
>
> On May 18, 2020 4:11:52 AM PDT, Jim Lemon <[hidden email]> wrote:
> >Hi Stefano,
> >If I understand your request, this may also help, Uses the same data
> >transformations as my previous email.
> >
> >png("SS_foehn.png")
> >plot(mydf$data_POSIX,
> > ifelse(mydf$main_dir %in% c("WSW","SW"),mydf$max_speed,NA),
> > type="b",main="Wind speed (WSW or SW) by time",
> > xlab="Time of day",ylab="Wind speed km/h",
> > col=rainbow(16)[as.numeric(mydf$main_dir)])
> >abline(h=8,col="orange",lwd=2)
> >source("../rollmean.R")
> >rmws<-rollmean(mydf$max_speed,4)
> >lines(mydf$data_POSIX,rmws,col="orange",lwd=2)
> >legend("topleft","Rolling mean of 4 for wind speed",
> > lty=1,lwd=2,col="orange")
> >dev.off()
> >
> >Jim
>
> --
> Sent from my phone. Please excuse my brevity.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Classification of wind events

Abby Spurdle
I was impressed by Jim's effort.
So, I thought I'd try to produce an exploratory plot.

I've adapted some of his code.
The following script produces a heatmap for a cylindrical density estimate.
Bright areas are (mathematical) regions of high density.
However, the interpretation is complicated by the fact that the data
uses max wind speed rather than wind speed, per se.

I note your subject line, "Classification of wind events".
I'm not sure what sort of classification is possible.

Could there be some sort of lagged effect...?
(i.e. Could wind direction or speed at time t, be related to wind
direction or speed at time t-1, t-2, etc ...?).

------------------------------------------------------
library (barsurf)
library (probhat)
set.bs.theme ("blue")

g <- c ("WSW", "WSW", "SW", "SW", "W", "WSW", "WSW", "WSW", "W", "W",
    "SW", "WSW", "SSW", "S", "SW", "SW", "WSW", "WNW", "W", "WSW",
    "WSW", "SE", "SE", "SE", "NW", "NNE", "ENE", "SE", "NNW", "NW",
    "NW", "NW", "NW", "NW", "NW", "NE", "NW", "NW", "NW", "NW", "NW",
    "N", "WNW", "NW", "NNW", "NNW", "NW", "NW", "NW", "WNW", "ESE",
    "W", "WSW", "SW", "SW", "SW", "WSW", "SW", "S", "S", "SSW", "SW",
    "WSW", "WSW", "WSW", "WSW", "WSW", "WSW", "WSW", "SW", "WSW",
    "WSW", "WSW", "WSW", "SW", "SW", "WSW", "WSW", "WSW", "WSW",
    "WSW", "SW", "SW", "SW", "SW", "SW", "SW", "SW", "SW", "SW",
    "WSW", "WSW", "WSW", "WSW", "SW", "SW", "SW", "SW", "WSW", "SW",
    "SW", "SW", "SW", "SW", "WSW", "SW", "SW", "W", "WSW", "WSW",
    "SSW", "S", "WNW", "SW", "W", "WSW", "WSW", "SE", "SE", "SE",
    "NW", "NNE", "ENE", "SE", "NNW", "NW", "NW", "NW", "NW", "NW",
    "NW", "NE", "NW", "NW", "NW", "NW", "NW", "N", "WNW", "NW", "NNW",
    "NNW", "NW", "NW", "NW")
levels <- c("E", "ENE", "NE", "NNE", "N", "NNW", "NW", "WNW",
    "W", "WSW", "SW", "SSW", "S", "SSE", "SE", "ESE")
g <- factor (g, levels=levels)

r <- seq (0, 337.5, by=22.5)
x <- r [as.integer (g)]

y <- c (4.6, 4.6, 3.4, 3.1, 4.8, 4.2, 4.1, 4.5, 4.7, 4.3, 2.4, 2.3,
    2.2, 2.1, 2.9, 2.8, 1.8, 2.7, 4.3, 3.3, 2.3, 2.3, 3.2, 3.2, 2.9,
    2.3, 1.5, 1.8, 2.9, 2.4, 1.8, 2.4, 2.3, 2.6, 1.8, 2.3, 1.9, 2.2,
    2.8, 2.4, 1, 1.1, 1.6, 2.3, 2.5, 3.3, 3.4, 3.2, 4.5, 3.9, 3.1,
    2.4, 6, 7.8, 6.3, 7.8, 8.1, 6.1, 7.4, 9.5, 8.9, 9.1, 10.1, 10.5,
    11.1, 10.1, 10.9, 11.3, 13.4, 13.5, 12.8, 11.5, 13.1, 13.5, 11.1,
    10.5, 8.5, 10.1, 10.7, 13.6, 11.9, 14.9, 10.9, 10.9, 12.8, 12.1,
    9.1, 8.3, 8.8, 7.4, 8.4, 10.3, 10, 7, 8.5, 8.4, 8.6, 6.7, 7.3,
    6.2, 5.9, 5.9, 5.1, 5.8, 5.6, 6.5, 6.6, 11.7, 11.3, 8.7, 7.1,
    6.9, 4.3, 3.8, 4.3, 3.3, 2.3, 2.3, 3.2, 3.2, 2.9, 2.3, 1.5, 1.8,
    2.9, 2.4, 1.8, 2.4, 2.3, 2.6, 1.8, 2.3, 1.9, 2.2, 2.8, 2.4, 1,
    1.1, 1.6, 2.3, 2.5, 3.3, 3.4, 3.2, 4.5)

data.frame (g, x, y)

x2 <- c (x - 360, x, x + 360)
y2 <- rep (y, times=3)

fh <- pdfmv.cks (cbind (x2, y2), bw = c (240, 9.5) )

N <- 64
u <- seq (270, -90, length.out=N)
v <- seq (0, 15, length.out=N)
fv <- outer (u, v, function (x, y) fh (cbind (x, y) ) )

#not necessary for exploratory purposes
Fh <- cdfmv.cks (cbind (x2, y2), bw = c (240, 9.5) )
scaling.factor <- probmv (Fh, c (0, 0), c (360, max (y) ) )
fv <- fv / scaling.factor

#currently problems with descending x/y coords
#(to fix in near future)
#so set x-axis to [0, 1]
u2 <- seq (0, 1, length.out=N)

plot_cfield (u2, v, fv,
    axes = c (FALSE, TRUE),
    main="Wind Speed\n(Cylindrical Density Estimate)",
    xlab="direction", ylab="max wind speed",
    hcv=TRUE)
axis (1, c (0.05, 0.275, 0.5, 0.725, 0.95), c ("South", "West",
"North", "East", "South"), FALSE)
abline (v=0.5, lty=2, col="white")

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

wind_speed.png (32K) Download Attachment