High Wind Warning

Last night the National Weather Service issued a warning for potentially damaging wind gusts, specifically between 4 am and 9 am. So, how bad was it?

Well, if you look at the graph below, you’ll see it’s a record for the year. At least, when you consider all of Montgomery County, PA.

The following plot shows the total calls (last 24 hours) – all of Montgomery County.

If you’re curious, you can see a live map off all the calls.

alt text

Impact on Cheltenham wasn’t as bad

What was in impact in Cheltenham Township?

As you can see below, it wasn’t as bad. In fact, for Cheltenham, it wasn’t a record.

Looking at all the calls in Cheltenham

Below you can see the details, on all the calls in Cheltenham.

References:

All raw data - http://montcoalert.org/

Source:

# Setup and read

library(ggplot2)
#library(RSQLite)
library(scales)

library(dplyr)
library(tidyr)

require(gridExtra)
require(grid)

library(knitr)
library(DT)


urlLink="https://storage.googleapis.com/montco-stats/tzr.csv"
d=read.csv(url(urlLink),header=TRUE,stringsAsFactors=FALSE)
wd<-function(x) as.POSIXct(strptime(x, '%Y-%m-%d %H:%M:%S',tz='EST'))
d$mdate=wd(d$timeStamp)

# Easier for grouping - hr,day
d$hr=format(d$mdate, format="%Y-%m-%d %H:00:00")
d$day=format(d$mdate, format="%Y-%m-%d 00:00:00")
d$day = as.Date(d$day)


tt=c('Traffic: ROAD OBSTRUCTION -','Fire: ELECTRICAL FIRE OUTSIDE',
     'Traffic: HAZARDOUS ROAD CONDITIONS -')
# Note, also stop after today (So we can run with same results)
dd=d[d$title %in% tt & d$mdate <= '2016-04-04 00:00:00',]


counts <- summarise(group_by(dd,day,title), Counts=length(e))
counts <- counts[order(-counts$Counts),]
colnames(counts) <- c("day","Category","Counts")
counts



g <- ggplot(dat = counts, 
       aes(x=day, y=Counts)) + 
      geom_line(aes(color=Category, group=Category)) + 
      geom_point(aes(color=Category, shape=Category, group=Category), size=1)+
      ylab("Incident /day") +
      xlab("") +
  theme(axis.text = element_text(size = 10),
        axis.text.x = element_text(angle = 45, hjust = 1),
    legend.key = element_rect(fill = "white"),
    legend.background = element_rect(fill = "white"),
    legend.text = element_text(size = 9),
    legend.position = "right",
    panel.grid.major = element_line(colour = "gray89"),
    panel.background = element_rect(fill = "cornsilk"),
    panel.grid.minor = element_line(color = "honeydew2"))+
   scale_y_continuous(labels = comma) +
  scale_x_date(date_breaks = "1 week", labels=date_format("%m-%d")) 
  


g2 <- arrangeGrob(g, 
                 bottom = textGrob("Source:  MontcoAlert.org", x = 0, 
                                   hjust = -0.1, vjust=0.1,
                                   gp = gpar(fontface = "italic", 
                                             fontsize = 7)))

grid.arrange(g2,top = "911 Calls", ncol=1, nrow =1)






# Same thing, but just CHELTENHAM


tt=c('Traffic: ROAD OBSTRUCTION -','Fire: ELECTRICAL FIRE OUTSIDE',
     'Traffic: HAZARDOUS ROAD CONDITIONS -')
# Note, also stop after today (So we can run with same results)
dd=d[d$title %in% tt & d$mdate <= '2016-04-04 00:00:00' & d$twp == 'CHELTENHAM',]


counts <- summarise(group_by(dd,day,title), Counts=length(e))
counts <- counts[order(-counts$Counts),]
colnames(counts) <- c("day","Category","Counts")
counts



g <- ggplot(dat = counts, 
       aes(x=day, y=Counts)) + 
      geom_line(aes(color=Category, group=Category)) + 
      geom_point(aes(color=Category, shape=Category, group=Category), size=1)+
      ylab("Incident /day") +
      xlab("") +
  theme(axis.text = element_text(size = 10),
        axis.text.x = element_text(angle = 45, hjust = 1),
    legend.key = element_rect(fill = "white"),
    legend.background = element_rect(fill = "white"),
    legend.text = element_text(size = 9),
    legend.position = "right",
    panel.grid.major = element_line(colour = "gray89"),
    panel.background = element_rect(fill = "cornsilk"),
    panel.grid.minor = element_line(color = "honeydew2"))+
   scale_y_continuous(labels = comma) +
  scale_x_date(date_breaks = "1 week", labels=date_format("%m-%d")) 
  

g2 <- arrangeGrob(g, 
                 bottom = textGrob("Source:  MontcoAlert.org", x = 0, 
                                   hjust = -0.1, vjust=0.1,
                                   gp = gpar(fontface = "italic", 
                                             fontsize = 7)))

grid.arrange(g2,top = "911 Calls\nCheltenham twp.", ncol=1, nrow =1)









# Display everything since Yesterday
tableDisplay=d[d$title %in% tt & d$mdate <= '2016-04-04 00:00:00' & d$mdate >= '2016-04-02 22:00:00' & d$twp == 'CHELTENHAM',]

tableDisplay <- select(tableDisplay,desc,twp,timeStamp)
datatable(tableDisplay, class = 'compact',rownames = FALSE)