N.B This document was created to fulfill a requirement in the non-credit online Coursera course - Reproducible Research - by Johns Hopkins University. The analysis is incomplete. It is not to be taken as scientific opinion.

I. Analysis Summary

The original data collected in the U.S. between 1950 - 2011, which contained 902297 observations and 37 variables underwent processing, which resulted in a data frame containing 653530 observations and 14 variables (Table 3). Data cleaning excluded information prior to 1996, when not all of the 48 prescribed event types were reported. It also involved sorting the 426 recorded event types into the 48 prescribed events, and converting property and crop damages costs to 2011 USD equivalents.

Analysis suggested that excessive_heat, tornado, flood, tsunami, and hurricane_typhoon were some of the leading causes of adverse population health effects; whereas flood, hurricane_typhoon, drought, and storm_surge_tide were among the leading causes of negative economic effects (Figures 1 and 2). Most states reporting high injuries also reported high mortality, which suggests a relationship between these population health consequences (Figure 1). In contrast, there were fewer overlaps in states reporting high property and crop damages (Figure 2), which may indicate some diversity in the susceptibility to economic harm. The more frequently reported events: thunderstorm_wind, hail, flood and tornado also had high population health and economic impacts (Figures 1 - 3). However, less frequent events, such as tsunami can also have high population health costs (Figure 1, Table 8). Accuracy of the analysis depended heavily on complete records in the fatalities, injuries, property damage, and crop damage columns, which requires further work.

II. Data Processing

II.A. Load data, general inspection and cleanup.

1. System description

  • R 4.3.1; RStudio build 561; Windows 10; 64 bit, 1.1 GHz Intel Celeron; 4.00 GB RAM

2. Set working directory

3. Download file

  • Download file if file does not exist.
###store url as an object
proj2url <- "https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2"

###download file if file does not exist
if(!file.exists("storms.csv.bzip2")) {
     (download.file(proj2url, destfile = "storms.csv.bzip2", mode = "wb"))
}

rm(proj2url)
###end of step3 file download

4. Unzip and read file into R

  • interpret blank as NA
  • remove external white spaces
storm <- read.csv("storms.csv.bzip2", na.strings = "", strip.white = TRUE)

###end of step4 unzip and read file

5. Change column names and evtype to lower case, view summary

  • To make typing easier, change column names and event type values to lower case.
  • Storm data frame created has 902297 observations, 37 variables.
colnames(storm) <- tolower(colnames(storm))

storm$evtype <- tolower(storm$evtype)

summary(storm)
##     state__       bgn_date           bgn_time          time_zone        
##  Min.   : 1.0   Length:902297      Length:902297      Length:902297     
##  1st Qu.:19.0   Class :character   Class :character   Class :character  
##  Median :30.0   Mode  :character   Mode  :character   Mode  :character  
##  Mean   :31.2                                                           
##  3rd Qu.:45.0                                                           
##  Max.   :95.0                                                           
##                                                                         
##      county       countyname           state              evtype         
##  Min.   :  0.0   Length:902297      Length:902297      Length:902297     
##  1st Qu.: 31.0   Class :character   Class :character   Class :character  
##  Median : 75.0   Mode  :character   Mode  :character   Mode  :character  
##  Mean   :100.6                                                           
##  3rd Qu.:131.0                                                           
##  Max.   :873.0                                                           
##                                                                          
##    bgn_range          bgn_azi           bgn_locati          end_date        
##  Min.   :   0.000   Length:902297      Length:902297      Length:902297     
##  1st Qu.:   0.000   Class :character   Class :character   Class :character  
##  Median :   0.000   Mode  :character   Mode  :character   Mode  :character  
##  Mean   :   1.484                                                           
##  3rd Qu.:   1.000                                                           
##  Max.   :3749.000                                                           
##                                                                             
##    end_time           county_end countyendn       end_range       
##  Length:902297      Min.   :0    Mode:logical   Min.   :  0.0000  
##  Class :character   1st Qu.:0    NA's:902297    1st Qu.:  0.0000  
##  Mode  :character   Median :0                   Median :  0.0000  
##                     Mean   :0                   Mean   :  0.9862  
##                     3rd Qu.:0                   3rd Qu.:  0.0000  
##                     Max.   :0                   Max.   :925.0000  
##                                                                   
##    end_azi           end_locati            length              width         
##  Length:902297      Length:902297      Min.   :   0.0000   Min.   :   0.000  
##  Class :character   Class :character   1st Qu.:   0.0000   1st Qu.:   0.000  
##  Mode  :character   Mode  :character   Median :   0.0000   Median :   0.000  
##                                        Mean   :   0.2301   Mean   :   7.503  
##                                        3rd Qu.:   0.0000   3rd Qu.:   0.000  
##                                        Max.   :2315.0000   Max.   :4400.000  
##                                                                              
##        f               mag            fatalities          injuries        
##  Min.   :0.0      Min.   :    0.0   Min.   :  0.0000   Min.   :   0.0000  
##  1st Qu.:0.0      1st Qu.:    0.0   1st Qu.:  0.0000   1st Qu.:   0.0000  
##  Median :1.0      Median :   50.0   Median :  0.0000   Median :   0.0000  
##  Mean   :0.9      Mean   :   46.9   Mean   :  0.0168   Mean   :   0.1557  
##  3rd Qu.:1.0      3rd Qu.:   75.0   3rd Qu.:  0.0000   3rd Qu.:   0.0000  
##  Max.   :5.0      Max.   :22000.0   Max.   :583.0000   Max.   :1700.0000  
##  NA's   :843563                                                           
##     propdmg         propdmgexp           cropdmg         cropdmgexp       
##  Min.   :   0.00   Length:902297      Min.   :  0.000   Length:902297     
##  1st Qu.:   0.00   Class :character   1st Qu.:  0.000   Class :character  
##  Median :   0.00   Mode  :character   Median :  0.000   Mode  :character  
##  Mean   :  12.06                      Mean   :  1.527                     
##  3rd Qu.:   0.50                      3rd Qu.:  0.000                     
##  Max.   :5000.00                      Max.   :990.000                     
##                                                                           
##      wfo             stateoffic         zonenames            latitude   
##  Length:902297      Length:902297      Length:902297      Min.   :   0  
##  Class :character   Class :character   Class :character   1st Qu.:2802  
##  Mode  :character   Mode  :character   Mode  :character   Median :3540  
##                                                           Mean   :2875  
##                                                           3rd Qu.:4019  
##                                                           Max.   :9706  
##                                                           NA's   :47    
##    longitude        latitude_e     longitude_       remarks         
##  Min.   :-14451   Min.   :   0   Min.   :-14455   Length:902297     
##  1st Qu.:  7247   1st Qu.:   0   1st Qu.:     0   Class :character  
##  Median :  8707   Median :   0   Median :     0   Mode  :character  
##  Mean   :  6940   Mean   :1452   Mean   :  3509                     
##  3rd Qu.:  9605   3rd Qu.:3549   3rd Qu.:  8735                     
##  Max.   : 17124   Max.   :9706   Max.   :106220                     
##                   NA's   :40                                        
##      refnum      
##  Min.   :     1  
##  1st Qu.:225575  
##  Median :451149  
##  Mean   :451149  
##  3rd Qu.:676723  
##  Max.   :902297  
## 
###end of step 5 all to lower case

6. Subset storm data frame, replace forward slash

  • subset storm data frame and create evstorm data frame to reduce data size
  • perform replacements to improve uniformity and help future sorting
###subset storm to create evstorm data frame
evstorm <- subset(storm, select = c(bgn_date, countyname, state, evtype, length, width, mag, fatalities, injuries, propdmg, propdmgexp, cropdmg, cropdmgexp, remarks, refnum))

rm(storm)

{###replace forward slash with underscore
evstorm$evtype[evstorm$evtype == "cold/wind chill"] <- "cold_wind chill"
evstorm$evtype[evstorm$evtype == "frost/freeze"] <- "frost_freeze"
evstorm$evtype[evstorm$evtype == "storm surge/tide"] <- "storm surge_tide"
evstorm$evtype[evstorm$evtype == "extreme cold/wind chill"] <- "extreme cold_wind chill"
##change "and" to "&"
evstorm$evtype <- sub(" and ", " & ", evstorm$evtype)
}

###end of step6 subset columns

7. Remove extra spaces, replace missing and empty values with NA

  • remove extra internal white spaces
  • blanks, nulls, and spaces are replaced with NA
  • create a copy of the evtype column as column evtype2a
  • 882 unique event types
paste(length(unique(evstorm$evtype2a)), "unique event types")
## [1] "882 unique event types"

8. Change column class to date-time, subset rows

  • Extract months and years from bgn_date column
  • Subset evstorm data frame for events on or after 1996 since 48 event types were recorded from 1996 onwards.
  • data frame evstorm has 426 unique event types; 653530 rows; 15 columns
library(lubridate)

#change class to date_time, replace old data
evstorm$bgn_date <- mdy_hms(evstorm$bgn_date)
#extract month
evstorm$bgn_month <- month(evstorm$bgn_date)
#extract year
evstorm$bgn_year <- year(evstorm$bgn_date)
###subset rows 1996 - 2011
evstorm <- evstorm[evstorm$bgn_year >= 1996, ] #653530 observations from 902297

paste(nrow(evstorm), "rows,", ncol(evstorm), "columns in evstorm data frame")
## [1] "653530 rows, 18 columns in evstorm data frame"
###end step8 filter by date

9. Create statename column

  • Amending state.abb and state.name lists in R with extra territories in the NOAA data set; NOAA data set has 70 unique values in state column
  • Assignments of additional 20 abbreviations not in state.abb based on:
  • use this data frame to create new column in evstorm data frame: statename
9.b. View evstorm data frame summary
summary(evstorm)
##     bgn_date                       countyname           state          
##  Min.   :1996-01-01 00:00:00.00   Length:653530      Length:653530     
##  1st Qu.:2000-11-21 00:00:00.00   Class :character   Class :character  
##  Median :2005-05-14 00:00:00.00   Mode  :character   Mode  :character  
##  Mean   :2004-10-25 14:35:22.18                                        
##  3rd Qu.:2008-08-22 00:00:00.00                                        
##  Max.   :2011-11-30 00:00:00.00                                        
##     evtype              length             width               mag         
##  Length:653530      Min.   :  0.0000   Min.   :   0.000   Min.   :    0.0  
##  Class :character   1st Qu.:  0.0000   1st Qu.:   0.000   1st Qu.:    0.0  
##  Mode  :character   Median :  0.0000   Median :   0.000   Median :   50.0  
##                     Mean   :  0.1014   Mean   :   4.633   Mean   :   45.3  
##                     3rd Qu.:  0.0000   3rd Qu.:   0.000   3rd Qu.:   75.0  
##                     Max.   :400.0000   Max.   :4400.000   Max.   :22000.0  
##    fatalities           injuries           propdmg         propdmgexp       
##  Min.   :  0.00000   Min.   :0.00e+00   Min.   :   0.00   Length:653530     
##  1st Qu.:  0.00000   1st Qu.:0.00e+00   1st Qu.:   0.00   Class :character  
##  Median :  0.00000   Median :0.00e+00   Median :   0.00   Mode  :character  
##  Mean   :  0.01336   Mean   :8.87e-02   Mean   :  11.69                     
##  3rd Qu.:  0.00000   3rd Qu.:0.00e+00   3rd Qu.:   1.00                     
##  Max.   :158.00000   Max.   :1.15e+03   Max.   :5000.00                     
##     cropdmg         cropdmgexp          remarks              refnum      
##  Min.   :  0.000   Length:653530      Length:653530      Min.   :248768  
##  1st Qu.:  0.000   Class :character   Class :character   1st Qu.:412150  
##  Median :  0.000   Mode  :character   Mode  :character   Median :575533  
##  Mean   :  1.839                                         Mean   :575533  
##  3rd Qu.:  0.000                                         3rd Qu.:738915  
##  Max.   :990.000                                         Max.   :902297  
##    evtype2a           bgn_month        bgn_year     statename        
##  Length:653530      Min.   : 1.00   Min.   :1996   Length:653530     
##  Class :character   1st Qu.: 5.00   1st Qu.:2000   Class :character  
##  Mode  :character   Median : 6.00   Median :2005   Mode  :character  
##                     Mean   : 6.06   Mean   :2004                     
##                     3rd Qu.: 8.00   3rd Qu.:2008                     
##                     Max.   :12.00   Max.   :2011

10. Event numbers

  • create event number objects to contain prescribed event names, to make relabelling uniform
  • some events were difficult to match with the 48 prescribed events, two event names were created: event0 for general events (e.g. marine accident where it’s unclear if it’s associated with a prescribed event); and event0h for temperature-related events (e.g. low summer temperature, lacking description of health or economic impact, and above temperatures specified for frost_freeze)
  • total event types is 50: 48 prescribed events + 2 designations for difficult to assign events
{###event numbers
     event0 <- "noted"; event0h <- "noted_temp"; event1 <- "avalanche"; event2 <- "blizzard"; event3 <- "heavy_snow"; event4 <- "lake_effect_snow"; event5 <- "sleet"; event6 <- "ice_storm"; event7 <- "winter_storm"; event8 <- "extreme_cold_wind_chill"; event9 <- "cold_wind_chill"; event10 <- "frost_freeze"; event11 <- "freezing_fog"; event12 <- "dense_fog"; event13 <- "winter_weather"; 

event14 <- "debris_flow"; event15 <- "lakeshore_flood"; event16 <- "high_surf"; event17 <- "storm_surge_tide"; event18 <- "coastal_flood";  event19 <- "tsunami"; event20 <- "astronomical_low_tide"; event21 <- "flash_flood"; event22 <- "flood"; event23 <- "seiche"; event24 <- "rip_current";

event25 <- "lightning"; event26 <- "thunderstorm_wind"; event27 <- "high_wind"; event28 <- "strong_wind"; event29 <- "marine_thunderstorm_wind"; event30 <- "marine_high_wind"; event31 <- "marine_strong_wind"; event32 <- "hail"; event33 <- "marine_hail"; event34 <- "tornado"; event35 <- "waterspout"; event36 <- "funnel_cloud"; event37 <- "dust_devil"; event38 <- "hurricane_typhoon"; event39 <- "tropical_storm"; event40 <- "tropical_depression"; event41 <- "heavy_rain"

event42 <- "excessive_heat"; event43 <- "heat"; event44 <- "drought"; event45 <- "dust_storm"; event46 <- "dense_smoke"; event47 <- "wildfire"; event48 <- "volcanic_ash"; event49 <- "summary"

###end of step10 eventnumbers
}

11. Create data frame with 48 event names

  • Create data frame with list of event types using Table 1 in section 2.1.1 in the “National Weather Service Instruction” 2006 document.
  • Column evnum corresponds to the event number used to relabel non-prescribed event types, and the number of the event in section II.C.
  • Table is used in part II.C to check matches for phrases (e.g. number of prescribed events containing the word “high”)
evtype <- c("astronomical_low_tide", "avalanche", "blizzard", "coastal_flood", "cold_wind_chill", "debris_flow", "dense_fog", "dense_smoke", "drought", "dust_devil", "dust_storm", "excessive_heat", "extreme_cold_wind_chill", "flash_flood", "flood", "frost_freeze", "funnel_cloud", "freezing_fog", "hail", "heat", "heavy_rain", "heavy_snow", "high_surf", "high_wind", "hurricane_typhoon", "ice_storm", "lake_effect_snow", "lakeshore_flood", "lightning", "marine_hail", "marine_high_wind", "marine_strong_wind", "marine_thunderstorm_wind", "rip_current", "seiche", "sleet", "storm_surge_tide", "strong_wind", "thunderstorm_wind", "tornado", "tropical_depression", "tropical_storm", "tsunami", "volcanic_ash", "waterspout", "wildfire", "winter_storm", "winter_weather", "noted", "noted_temp")

evnum <- c(20, 1, 2, 18, 9, 14, 12, 46, 44, 37, 45, 42, 8, 21, 22, 10, 36, 11, 32, 43, 41, 3, 16, 27, 38, 6, 4, 15, 25, 33, 30, 31, 29, 24, 23, 5, 17, 28, 26, 34, 40, 39, 19, 48, 35, 47, 7, 13, 0, "0h")

event48names <- as.data.frame(cbind(evtype, evnum))

rm(evnum, evtype)

###end of step11 events data frame
11.b. Table 1: Create table containing prescribed event data frame.
###package for creating scrollable table
library(kableExtra)

kable(event48names, caption = "Table 1: Prescribed event types. The column evtype corresponds to one of the 48 prescribed event types and two event types created to contain events that were difficult to classify, and evnum corresponds to a cleaning step in II.C (for the 48 event types) and the event object used to relabel event types.") %>% 
     kable_styling(full_width = T) %>% 
 scroll_box(width = "400px", height = "300px")
Table 1: Prescribed event types. The column evtype corresponds to one of the 48 prescribed event types and two event types created to contain events that were difficult to classify, and evnum corresponds to a cleaning step in II.C (for the 48 event types) and the event object used to relabel event types.
evtype evnum
astronomical_low_tide 20
avalanche 1
blizzard 2
coastal_flood 18
cold_wind_chill 9
debris_flow 14
dense_fog 12
dense_smoke 46
drought 44
dust_devil 37
dust_storm 45
excessive_heat 42
extreme_cold_wind_chill 8
flash_flood 21
flood 22
frost_freeze 10
funnel_cloud 36
freezing_fog 11
hail 32
heat 43
heavy_rain 41
heavy_snow 3
high_surf 16
high_wind 27
hurricane_typhoon 38
ice_storm 6
lake_effect_snow 4
lakeshore_flood 15
lightning 25
marine_hail 33
marine_high_wind 30
marine_strong_wind 31
marine_thunderstorm_wind 29
rip_current 24
seiche 23
sleet 5
storm_surge_tide 17
strong_wind 28
thunderstorm_wind 26
tornado 34
tropical_depression 40
tropical_storm 39
tsunami 19
volcanic_ash 48
waterspout 35
wildfire 47
winter_storm 7
winter_weather 13
noted 0
noted_temp 0h

II.B Functions for relabelling (functions 1-5 deleted, not used)

1. Look for event within event

  • This function searches for keywords within events in the evtype column (e.g. search for event type labels with “marine” that also has word “hail”), then the event names in the evtype2a column are replaced.
  • A value must be entered for every field.
## NULL

2. Within an event type, search remarks for key words or phrases

  • Within an event type, the function searches the remarks column for specified words or phrases, then replaces the event type in the evtype2a column based on the extracted refnum (unique to each reported observation).

II.C. Group together event records by changing evtype2a

  • 985 unique event types to start
  • 882 unique event types after removing extra spaces, changing “and” to “&”
  • 426 unique event types after subsetting rows to on or after 1996
  • There should be 50 event types (48 prescribed event types + 2 event types for difficult to classify events)
  • This section was initially applied to the 882 unique evtypes, making some steps unnecessary because some variations do not exist in the filtered data frame.
  • The definitions are quoted from the 2007 National Weather Service Instruction, as provided in the course assignment page, or the updated 2021 version.

1. event = avalanche

paste(unique(grep("aval", event48names$evtype, value = TRUE)), " = aval prescribed variations")
## [1] "avalanche  = aval prescribed variations"
paste(length(unique(grep("aval", evstorm$evtype, value = TRUE))), " = unique aval in evtype")
## [1] "1  = unique aval in evtype"
evstorm$evtype2a[evstorm$evtype == "avalance"] <- event1

###end event1 avalanche

2. event = blizzard

  • Defined as strong winds and heavy snow;
  • All events containing the word “blizzard” (e.g. blizzard and extreme wind chill) will be replaced by “blizzard”.
unique(grep("blizzard", event48names$evtype, value = TRUE))
## [1] "blizzard"
paste(length(unique(grep("blizz", evstorm$evtype, value = TRUE))), "= unique blizz events in evtype")
## [1] "3 = unique blizz events in evtype"
##replace blizzard variations with blizzard, no exceptions (supply a nonsense word in exceptions field to ensure no match)
{###function6 event_within_event_butnot; based on evtype column
lookfor1 <- "blizzard"
thathas <- "blizzard"
butnot <- "noexceptionsbananarama"
replacewith <- event2
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}##2745 blizzard events corrected

####look into events labelled "snow", search remarks to relabel
paste(nrow(evstorm[evstorm$evtype2a == "snow", ]), "= rows in evtype snow")
## [1] "425 = rows in evtype snow"
{#function7 in events, look for words in remarks, except for other words in remarks
ineventf7b <- "snow"
lookfor1f7b <- "blizzard"
butnotf7b <- "noexceptionsbananarama"
replacewithf7b <- event2
evstorm <- evwithinremark_fun7(ineventf7b, lookfor1f7b, butnotf7b, replacewithf7b)
####must enter value for all fields; ineventf7b is a specific event
rm(ineventf7b,lookfor1f7b,butnotf7b,replacewithf7b)
}

###end event2; blizzard

3. event = heavy snow

  • Defined as heavy snow accumulation, normally strong winds or other precipitation not present, if they are then “winter storm” should be used.
  • 15887 “heavy snow” observations
paste(length(unique(grep("heavy snow", evstorm$evtype, value = TRUE))), "= unique heavy snow in evtype column")
## [1] "3 = unique heavy snow in evtype column"
#15736 "heavy snow" events
##100 snow-type events
##3 are heavy snow variations

####specific events relabel as "heavy snow"
{include <- c("snow/heavy snow", "snow & heavy snow", "heavy snow and", "heavy wet snow", "prolong cold/snow")
evstorm$evtype2a[evstorm$evtype %in% include] <- event3

rm(include)
}

####look into snow variation events to relabel as heavy snow
paste(length(unique(grep("snow", evstorm$evtype2a, value = TRUE))), "= events with word snow in evtype2a")
## [1] "48 = events with word snow in evtype2a"
#64 variations of snow events

{###function6 event within event
lookfor1 <- "snow"
thathas <- "record|accumul|excess|advisor"
butnot <- "lake|ice|blizzard|rain|storm|wind|sleet|ice|freezing|drizzl"
replacewith <- event3
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}#10 snow events relabelled as "heavy snow


####look into events labelled "snow", search remarks to relabel
paste(nrow(evstorm[evstorm$evtype2a == "snow", ]), "= nrow snow events in evtype2a")
## [1] "423 = nrow snow events in evtype2a"
{#function7 in events, look for words in remarks, except for other words in remarks
ineventf7b <- "snow"
lookfor1f7b <- "heavy|record|accumulat|excess|significatn|advisor|heav|record|[4-9]( +)inch|[1-3](. )inch|[1-3](.. )inch|[1-3](... )inch|three inch|four inch|five inch|six inch|seven inch|eight inch|nine inch|ten inch"
butnotf7b <- "storm|( +)wind|blizzard|sleet|( +)ice|( +)rain|squall|( +)blow|( +)light( +)|shower|( +)lake( +)|( +)drizzle( +)"
replacewithf7b <- event3
evstorm <- evwithinremark_fun7(ineventf7b, lookfor1f7b, butnotf7b, replacewithf7b)
####must enter value for all fields; ineventf7b is a specific event
rm(ineventf7b,lookfor1f7b,butnotf7b,replacewithf7b)
}#204 of 617 relabelled as heavy snow


###end event3; heavy snow

4. event = lake-effect snow

  • Snow near large bodies of water.
paste(length(unique(grep("lake", evstorm$evtype, value = TRUE))), "= unique lake events in evtype")
## [1] "4 = unique lake events in evtype"
##change lake and snow variations to lake-effect snow
{###function6 event within event
lookfor1 <- "snow"
thathas <- "lake"
butnot <- "noexceptionsbananarama"
replacewith <- event4
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}

#############
####in event labelled "snow" look for lake-effect snow
{#function7 in events, look for words in remarks, except for other words in remarks
ineventf7b <- "snow"
lookfor1f7b <- "lake effect"
butnotf7b <- "some lake|storm( +)"
replacewithf7b <- event4
evstorm <- evwithinremark_fun7(ineventf7b, lookfor1f7b, butnotf7b, replacewithf7b)
####must enter value for all fields; ineventf7b is a specific event
rm(ineventf7b,lookfor1f7b,butnotf7b,replacewithf7b)
}#7 relabelled as lake-effect snow

###end event4 lake-effect snow

5. event = sleet

  • Could refer to ice pellets, rain and snow mixed, glaze.
  • Label ice pellets, rain and snow, freezing rain, glaze as sleet; exclude ice storm.
paste(length(unique(grep("sleet", evstorm$evtype, value = TRUE))), "= unique sleet events in evtype")#18 sleet variations
## [1] "6 = unique sleet events in evtype"
####relabel specific events as "sleet"
evstorm$evtype2a[evstorm$evtype2a %in% c("freezing rain", "light freezing rain", "glaze", "freezing drizzle", "freezing drizzle & freezing")] <- event5

####within sleet, label all as sleet, except for ice storm
{###function6 event within event
lookfor1 <- "sleet"
thathas <- lookfor1
butnot <- "ice storm"
replacewith <- event5
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}

####look for sleet in ice
{###function6 event within event
lookfor1 <- "ice"
thathas <- "glaze|pellet|snow"
butnot <- "ice storm|blizzard|storm|heavy snow|ice/snow|falling"
replacewith <- event5
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}

####within snow variations, relabel anything with rain or freezing rain as sleet
{###function6 event within event
lookfor1 <- "snow"
thathas <- "rain|sleet|drizzle"
butnot <- "ice storm|blizzard|storm"
replacewith <- event5
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}#7 snow variations relabelled as "sleet"

###end event5 sleet

6. event = ice storm

  • ice accretion
unique(grep("ice", event48names$evtype, value = TRUE))
## [1] "ice_storm"
paste(length(unique(grep("ice", evstorm$evtype, value = TRUE))), "= unique ice events in evtype")
## [1] "15 = unique ice events in evtype"
###relabel ice storm variations
{icevents <- c("ice storm/flash flood", "ice storm", "ice", "ice/strong winds", "ice storm & snow", "glaze/ice storm", "sleet/ice storm")
evstorm$evtype2a[evstorm$evtype %in%  icevents] <- event6

rm(icevents)
}#2070 ice storm events

###end event6 ice storm

7. event = winter storm

  • Defined as winter event with more than one significant hazard type (e.g. sleet and ice or snow, sleet and ice, heavy snow and blowing snow), and more than one precipitation type presented a hazard.
paste(unique(grep("winter", event48names$evtype, value = TRUE)), "= prescribed events containing winter")
## [1] "winter_storm = prescribed events containing winter"  
## [2] "winter_weather = prescribed events containing winter"
paste(length(unique(grep("winter storm", evstorm$evtype, value = TRUE))), "= unique winter storm events in evtype")#11435 events
## [1] "1 = unique winter storm events in evtype"
###Specific winter events to classify as "winter storm"
evstorm$evtype2a[evstorm$evtype2a %in% c("winter mix", "winter weather mix", "wintery mix", "snow & ice storm", "snow/ice storm", "light snow/freezing precip", "mixed precipitation", "wintry mix", "heavy mix", "ice/snow")] <- event7

####Combine winter storm variations
##combine "winter storm" event variations
{###function6 event within event
lookfor1 <- "winter storm|mixed precip"
thathas <- lookfor1
butnot <- "blizzard"
replacewith <- event7
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}

###in event "winter weather/mix" look in remarks for storm-related words
{#function7 in events, look for words in remarks, except for other words in remarks
ineventf7b <- "winter weather/mix"
lookfor1f7b <- "storm|combin|gust|wind"
butnotf7b <- "noexceptionsbananarama"
replacewithf7b <- event7
evstorm <- evwithinremark_fun7(ineventf7b, lookfor1f7b, butnotf7b, replacewithf7b)
####must enter value for all fields; ineventf7b is a specific event
rm(ineventf7b,lookfor1f7b,butnotf7b,replacewithf7b)
}

####in heavy snow, label everything except "heavy snow", "snow/heavy snow", "snow & heavy snow", "heavy snow and", "heavy wet snow", "prolong cold/snow" as "winter storm"
{hsnow <- unique(grep("heavy snow", evstorm$evtype2a, value = TRUE))
nhsnow <- hsnow[!(hsnow %in% c("heavy snow", "snow/heavy snow", "snow & heavy snow", "heavy snow and"))]
evstorm$evtype2a[evstorm$evtype2a %in% nhsnow] <- event7

rm(hsnow, nhsnow)
}

##look into snow event variations
paste(length(unique(grep("snow", evstorm$evtype2a, value = TRUE))), "snow events in evtype2a")
## [1] "30 snow events in evtype2a"
{###function6 event within event
lookfor1 <- "snow"
thathas <- "storm|blowing|thundersnow|wind|mountain|wet|snow showers"
butnot <- "blizzard|light|heavy snow|sleet|freezing rain|lake|ice storm|drought|lack"
replacewith <- event7
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}

####look into events labelled "snow", search remarks to relabel
paste(nrow(evstorm[evstorm$evtype2a == "snow", ]), "=number of rows with snow in evtype2a")
## [1] "285 =number of rows with snow in evtype2a"
{#function7 in events, look for words in remarks, except for other words in remarks
ineventf7b <- "snow"
lookfor1f7b <- "storm|wind|rain|shower"
butnotf7b <- "lake effect|blizzard|ice storm"
replacewithf7b <- event7
evstorm <- evwithinremark_fun7(ineventf7b, lookfor1f7b, butnotf7b, replacewithf7b)
####must enter value for all fields; ineventf7b is a specific event
rm(ineventf7b,lookfor1f7b,butnotf7b,replacewithf7b)
}

####look into heavy precipitation

{#function7 in events, look for words in REMARKS, except for other words in remarks
ineventf7b <- c("heavy precipitation", "record precipitation", "excessive precipitation")
lookfor1f7b <- "snow|storm"
butnotf7b <- "noexceptionsbananana"
replacewithf7b <- event7
evstorm <- evwithinremark_fun7(ineventf7b, lookfor1f7b, butnotf7b, replacewithf7b)
##must enter value for all fields
rm(ineventf7b,lookfor1f7b,butnotf7b,replacewithf7b)
}

###end event7 winter storm

8. event = extreme cold_wind chill

  • Period of extremely cold temperatures, typically -35 F or colder.
paste(length(grep("extreme cold_wind chill", evstorm$evtype)), "= number of evtype extreme cold wind chill observations")
## [1] "1002 = number of evtype extreme cold wind chill observations"
##1002 original extreme cold_wind chill labels

####some events labelled as extreme cold_wind chill are several degrees above freezing; should relabel as frost_freeze or cold_wind chill
{{nextcold <- evstorm[evstorm$evtype == "extreme cold_wind chill", ]
extcoldm <- nextcold[nextcold$bgn_month %in% (4:9), ]
##anything with frost or freeze in remarks will be relabelled frost_freeze: event10
##which rows contain keywords
extcoldfr <- grep("frost|freeze", extcoldm$remarks, ignore.case = TRUE)
##what are the refnums
extcoldfref <- extcoldm[extcoldfr, c("refnum")]
evstorm$evtype2a[evstorm$refnum %in% extcoldfref] <- event10
}
###label others as "noted", since they had no economic or social impact, and were generally above 20C
{nextcold <- evstorm[evstorm$evtype == "extreme cold_wind chill", ]
extcoldm2 <- nextcold[nextcold$bgn_month %in% (4:9), c("refnum")]
extcoldnt1 <- extcoldm2[!(extcoldm2 %in% extcoldfref)]
evstorm$evtype2a[evstorm$refnum %in% extcoldnt1] <- event0h
}
     rm(nextcold,extcoldm,extcoldm2,extcoldfr,extcoldfref, extcoldnt1)
}

{####look into "wind chill" and "windchill", relabel anything with extreme or bitter as extreme cold_wind chill
unique(grep("wind chill|windchill", evstorm$evtype2a, value = TRUE))
{###function6 event within event
lookfor1 <- "wind chill|windchill"
thathas <- "extreme|bitter"
butnot <- "extreme cold_wind chill"
replacewith <- event8
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}
####relabel specific wind chill events
wchill <- c("high winds & wind chill", "high wind/wind chill", "high wind/low wind chill", "wind chill/high wind", "cold wind chill temperatures", "low wind chill", "wind chill")
evstorm$evtype2a[evstorm$evtype2a %in% wchill] <- event8

rm(wchill)
}

###look into cold events
#exclude properly labelled events cold_wind chill and extreme cold_wind chill; and funnel cloud, tornado events
{{coldevent <- unique(grep("cold", evstorm$evtype, value = TRUE))
windchillevent <- unique(grep("extreme cold_wind chill|cold_wind chill|funnel|tornado|fog", evstorm$evtype, value = TRUE))
nowindchill <- coldevent[!(coldevent %in% windchillevent)]
}#out of 2463 cold events, 909 poorly classified cold events

###look for specific temperatures -3x to -9x F
{#function7 in events, look for words in remarks, except for other words in remarks
ineventf7b <- nowindchill
lookfor1f7b <- "( +)(\\-)[3-9](. +)|[3-9](. +)below|[3-9](. +)degrees below|(\\-)[3-9](. +)f"
butnotf7b <- "noexceptionsbananarama"
replacewithf7b <- event8
evstorm <- evwithinremark_fun7(ineventf7b, lookfor1f7b, butnotf7b, replacewithf7b)
####must enter value for all fields; ineventf7b is a specific event
rm(ineventf7b,lookfor1f7b,butnotf7b,replacewithf7b)
}
     rm(coldevent,windchillevent,nowindchill)
     
}

###end event8 extreme cold_wind chill

9. event = cold_wind chill

  • Period of low temperatures (typically -18 F or lower), also includes unseasonably cold temperatures that result in fatality (typically -15 F), excludes injuries and fatalities during a winter precipitation event.
paste(unique(grep("cold", event48names$evtype, value = TRUE)), "= prescribed event type with cold")
## [1] "cold_wind_chill = prescribed event type with cold"        
## [2] "extreme_cold_wind_chill = prescribed event type with cold"
paste(length(unique(grep("cold", evstorm$evtype2a, value = TRUE))), "= unique cold events in evtype2a")
## [1] "17 = unique cold events in evtype2a"
###relabel specific events
evstorm$evtype2a[evstorm$evtype %in% c("record low", "low temperature record", "unseasonal low temp", "low temperature", "hyperthermia/exposure", "hyperthermia/exposure")] <- event9

{####Check cold_wind chill events for weird records
{ncold <- evstorm[evstorm$evtype == "cold_wind chill", ]
coldm <- ncold[ncold$bgn_month %in% (4:9), ]

###relabel as frost_freeze
coldfr1 <- grep("( +)[1-3](. +)degree|frost|freeze|snow", coldm$remarks, ignore.case = TRUE)
coldwchill1 <- grep("death|die|dead", coldm$remarks, ignore.case = TRUE)
coldfr2 <- coldfr1[!(coldfr1 %in% coldwchill1)]
##relabel to frost_freeze
colmfrnum <- coldm[coldfr2, c("refnum")]
evstorm$evtype2a[evstorm$refnum %in% colmfrnum] <- event10 #label as frost_freeze
}
###keep some as cold_wind chill
{coldwchill2 <- coldm[coldwchill1, c("refnum")]
##unchanged refnum
coldrefnum <- c(colmfrnum, coldwchill2)
coldint <- coldm[!(coldm$refnum %in% coldrefnum), c("refnum")]
###label remaining records as "interesting", do not fit storm events and no economic or social costs
evstorm$evtype2a[evstorm$refnum %in% coldint] <- event0h
}
     rm(ncold,coldm,coldfr1,coldwchill1,coldfr2,colmfrnum,coldwchill2,coldrefnum,coldint)
}

###look into cold events
{{coldevent <- unique(grep("cold", evstorm$evtype, value = TRUE))
windchillevent <- unique(grep("extreme cold_wind chill|cold_wind chill|funnel|tornado|fog", evstorm$evtype, value = TRUE))
nowindchill <- coldevent[!(coldevent %in% windchillevent)]
}

###in cold events, label everything that is not "extreme cold_wind chill" or "frost_freeze" as "cold_wind chill"

{coldeventdf2 <- evstorm[evstorm$evtype %in% nowindchill, ]
extremefrost <- grep("frost|freeze warning|crop|grow|plant|tree|bud|( +)(\\-)[3-9](. +)|[3-9](. +)below|[3-9](. +)degrees below|(\\-)[3-9](. +)f", coldeventdf2$remarks, ignore.case=TRUE)
refnum1 <- coldeventdf2[(extremefrost), c("refnum")]
refnum2 <- coldeventdf2[!(coldeventdf2$refnum %in% refnum1), c("refnum")]

evstorm$evtype2a[evstorm$refnum %in% refnum2] <- event9
}
     rm(coldevent,windchillevent,nowindchill,coldeventdf2,extremefrost,refnum1,refnum2)
}

###relabel hypothermia and hypothermia/exposure
{###function6 event within event
lookfor1 <- "hypothermia"
thathas <-  lookfor1
butnot <- "noexceptionsbananarama"
replacewith <- event9
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}

###end event9 cold_wind chill

10. event = frost_freeze

  • Temperature of 32 F or lower, resulting in formation of ice crystals on surfaces causing human or economic impact.
paste(unique(grep("frost", event48names$evtype, value = TRUE)), "= prescribed event types with frost")
## [1] "frost_freeze = prescribed event types with frost"
paste(length(unique(grep("freeze", evstorm$evtype, value = TRUE))), "= unique freeze in evtype")
## [1] "6 = unique freeze in evtype"
####relabel specific events 
evstorm$evtype2a[evstorm$evtype %in% c("monthly temperature")] <- event10

###look into cold events
{{coldevent <- unique(grep("cold", evstorm$evtype, value = TRUE))
windchillevent <- unique(grep("extreme cold_wind chill|cold_wind chill|funnel|tornado|fog", evstorm$evtype, value = TRUE))
nowindchill <- coldevent[!(coldevent %in% windchillevent)]
}
{#function7 in events, look for words in remarks, except for other words in remarks
ineventf7b <- nowindchill
lookfor1f7b <- "frost|freeze|crop|grow|plant|tree|bud"
butnotf7b <- "( +)(\\-)[3-9](. +)|[3-9](. +)below|[3-9](. +)degrees below|(\\-)[3-9](. +)f"
replacewithf7b <- event10
evstorm <- evwithinremark_fun7(ineventf7b, lookfor1f7b, butnotf7b, replacewithf7b)
####must enter value for all fields; ineventf7b is a specific event
rm(ineventf7b,lookfor1f7b,butnotf7b,replacewithf7b)
}
     rm(coldevent,windchillevent,nowindchill)
}

###relabel frost events as frost_freeze
{###function6 event within event
lookfor1 <- "frost"
thathas <- lookfor1
butnot <- "noexceptionsbananarama"
replacewith <- event10
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}

###relabel "freeze" events as "frost_freeze"
{freeze <- unique(grep("freeze", evstorm$evtype2a, value = TRUE))
evstorm$evtype2a[evstorm$evtype2a %in% freeze] <- event10

rm(freeze)
}

###end event10 frost_freeze

11. event = freezing fog

  • Fog that freezes on contact, forming a rime or glaze, resulting in human or economic impact.
paste(unique(grep("fog", event48names$evtype, value = TRUE)), "= prescribed event types with frost")
## [1] "dense_fog = prescribed event types with frost"   
## [2] "freezing_fog = prescribed event types with frost"
paste(length(unique(grep("fog", evstorm$evtype, value = TRUE))), "= unique fog in evtype")
## [1] "5 = unique fog in evtype"
###relabel specific events
evstorm$evtype2a[evstorm$evtype2a %in% c("fog & cold temperatures", "ice fog")] <- event11

####look into "fog" event and relabel anything with ice, icy, freez as "freezing fog"
{#function7 in events, look for words in remarks, except for other words in remarks
ineventf7b <- "fog"
lookfor1f7b <- "( +)ice( +)|( +)icy( +)|freez|froz"
butnotf7b <- "noexceptionsbananarama"
replacewithf7b <- event11
evstorm <- evwithinremark_fun7(ineventf7b, lookfor1f7b, butnotf7b, replacewithf7b)
####must enter value for all fields; ineventf7b is a specific event
rm(ineventf7b,lookfor1f7b,butnotf7b,replacewithf7b)
}

###end event 11 freezing fog

12. event = dense fog

  • Fog reducing visibility resulting in human or economic impact.
paste(unique(grep("fog", event48names$evtype, value = TRUE)), "= prescribed fog event")
## [1] "dense_fog = prescribed fog event"    "freezing_fog = prescribed fog event"
paste(length(unique(grep("fog", evstorm$evtype, value = TRUE))), "= unique fog types in evtype")
## [1] "5 = unique fog types in evtype"
##relabel specific events as dense fog
evstorm$evtype2a[evstorm$evtype2a == "patchy dense fog"] <- event12

###in event labelled fog, relabel everything as "dense fog" unless it's freezing fog; make sure all other events are properly labelled before running
evstorm$evtype2a[evstorm$evtype2a == "fog"] <- event12


###end event12 dense fog

13. event = winter weather

  • Winter precipitation that causes human or economic effects, but does not meet warning criteria; also include unusual or out of season winter-type events; also include snow squall.
  • All other winter or ice-related events that cannot be included in the above classifications were classified as winter weather.
paste(unique(grep("winter", event48names$evtype, value = TRUE)), "= prescribed winter event types")
## [1] "winter_storm = prescribed winter event types"  
## [2] "winter_weather = prescribed winter event types"
paste(length(unique(grep("winter", evstorm$evtype, value = TRUE))), "= unique events containing winter in evtype")
## [1] "7 = unique events containing winter in evtype"
##relabel specific events as winter weather
{winterev <- c("freezing spray", "icy roads", "ice roads", "black ice", "ice on road", "patchy ice")
evstorm$evtype2a[evstorm$evtype2a %in% winterev] <- event13

rm(winterev)
}

###relabel "ice floes" event; do not exist in 1996 - 2011 data set
{evstorm$evtype2a[evstorm$refnum == 208943] <- event7
evstorm$evtype2a[evstorm$refnum == 208970] <- event13
}

{###within "winter weather/mix" event, relabel everything not labelled as "winter storm" as "winter weather"
evstorm$evtype2a[evstorm$evtype2a == "winter weather/mix"] <- event13
##within event "snow", relabel that anything that's not classified as event 2- 12 as "winter weather": make sure that other classifications are completed before relabelling remnants as "winter weather"
evstorm$evtype2a[evstorm$evtype2a == "snow"] <- event13
}

####re-classify snow variations
{###function6 event within event
lookfor1 <- "snow"
thathas <- "squall|first|early|light|season|moderate|late|blowing|drift|falling|month"
butnot <- "wind|freezing|storm|lake|blizzard|sleet"
replacewith <- event13
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}

###end event13 winter weather

14. event = debris flow

  • Previously labelled as landslide; a slurry of loose soil, rock, organic matter, and water, similar to wet concrete, which is capable of holding particles larger than gravel in suspension. They can mobilize from landslides on steep, nearly saturated slopes or be triggered by intense rain after wildfires.
  • Lahars or mudflows from volcanic activity are not considered a debris flow.
paste(unique(grep("debr", event48names$evtype, value = TRUE)), "= prescribed events with debr")
## [1] "debris_flow = prescribed events with debr"
paste(length(unique(grep("mud|slide|land", evstorm$evtype, value = TRUE))), "= unique events with mud|slide|land")
## [1] "9 = unique events with mud|slide|land"
###specific events to re-classify as debris flow
evstorm$evtype2a[evstorm$evtype2a %in% c("landslides", "landslump", "landslide", "rock slide", "landslide/urban flood", "heavy rain effects", "rainstorm")] <- event14

{####look for volca in mud slide events
     debr1 <- unique(grep("mud", evstorm$evtype2a, value = TRUE))
debr2 <- evstorm[evstorm$evtype2a %in% debr1, ]
grep("volca", debr2$remarks, ignore.case = TRUE)

rm(debr1, debr2)
}

##change anything with "mud" to "debris flow"
{###function6 event within event
lookfor1 <- "mud"
thathas <- lookfor1
butnot <- "noexceptionsbananarama"
replacewith <- event14
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}


###end event14 debris flow

15. event = lakeshore flood

  • Flooding of lakeshore areas.
paste(unique(grep("lake", event48names$evtype, value = TRUE)), "= prescribed events with lake")
## [1] "lake_effect_snow = prescribed events with lake"
## [2] "lakeshore_flood = prescribed events with lake"
paste(length(unique(grep("lak", evstorm$evtype, value = TRUE))), "= unique events with lak in evtype")
## [1] "4 = unique events with lak in evtype"
####relabel lakeshore flood variations
evstorm$evtype2a[evstorm$evtype2a == "lake flood"] <- event15

###end event15 lakeshore flood

16. event = high surf

  • Large waves breaking on or near shore.
paste(length(unique(grep("surf", evstorm$evtype, value = TRUE))), "=unique surf events in evtype")
## [1] "9 =unique surf events in evtype"
{###relabel high surf variations
hsurf1 <- unique(grep("high surf|heavy surf|hazardous surf|rough surf", evstorm$evtype2a, value = TRUE))
evstorm$evtype2a[evstorm$evtype2a %in% hsurf1] <- event16

rm(hsurf1)
}

####relabel specific high surf event
evstorm$evtype2a[evstorm$evtype == "hurricane-generated swells"] <- event16

####in coastal flood variations, look for high surf events
#create data frame with coast or beach keywords
{cstfix1 <- unique(grep("coast|cst|beach", evstorm$evtype2a, value = TRUE))
cstfix2 <- evstorm[evstorm$evtype2a %in% cstfix1, ]
#look for rows with "high surf" in remarks
cstfix3 <- grep("high surf|heavy surf", cstfix2$remarks, ignore.case = TRUE)
#extract refnum
cstfix4 <- cstfix2[cstfix3, c("refnum")]
evstorm$evtype2a[evstorm$refnum %in% cstfix4] <- event16

rm(cstfix1,cstfix2,cstfix3,cstfix4)
}

######look for high surf in events labelled "astronomical high tide" and "tidal flooding"
{#function7 in events, look for words in remarks, except for other words in remarks
ineventf7b <- c("astronomical high tide", "tidal flooding")
lookfor1f7b <- "high surf|heavy surf|heav sea"
butnotf7b <- "noexceptionsbananarama"
replacewithf7b <- event16
evstorm <- evwithinremark_fun7(ineventf7b, lookfor1f7b, butnotf7b, replacewithf7b)
####must enter value for all fields; ineventf7b is a specific event
rm(ineventf7b,lookfor1f7b,butnotf7b,replacewithf7b)
}

###end event16 high surf

17. event = storm surge_tide

  • tide events related to storm, hurricane, typhoon
  • Vertical rise above normal water level associated with a storm; combination of strong, persistent onshore wind, high astronomical tide and low atmospheric pressure; causing flooding, erosion, damages, fatalities, injuries.
####relabel storm surge variations
paste(length(unique(grep("storm surge|high tide", evstorm$evtype, value = TRUE))), "= unique storm surge|high tide events in evtype")
## [1] "3 = unique storm surge|high tide events in evtype"
{stide_rl <- c("high wind & high tides", "storm surge")
evstorm$evtype2a[evstorm$evtype2a %in% stide_rl] <- event17

rm(stide_rl)
}

####in coastal flood variations, look for storm surge_tide events
#create data frame with coast or beach keywords
{cstfix1 <- unique(grep("coast|cst|beach", evstorm$evtype2a, value = TRUE))
cstfix2 <- evstorm[evstorm$evtype2a %in% cstfix1, ]
#look for rows with storm in remarks
cstfix3 <- grep("storm( +)|cyclone|hurricane|typhoon|tropical|blizzard|nor'easter|northeaster", cstfix2$remarks, ignore.case = TRUE)
#extract refnum
cstfix4 <- cstfix2[cstfix3, c("refnum")]
evstorm$evtype2a[evstorm$refnum %in% cstfix4] <- event17

rm(cstfix1,cstfix2,cstfix3,cstfix4)
}

######look for storm surge in events labelled "astronomical high tide" and "tidal flooding"
{#function7 in events, look for words in remarks, except for other words in remarks
ineventf7b <- c("astronomical high tide", "tidal flooding")
lookfor1f7b <- "storm( +)|cyclone|hurricane|typhoon|tropical|blizzard|no'easter|northeaster"
butnotf7b <- "noexceptionsbananarama"
replacewithf7b <- event17
evstorm <- evwithinremark_fun7(ineventf7b, lookfor1f7b, butnotf7b, replacewithf7b)
####must enter value for all fields; ineventf7b is a specific event
rm(ineventf7b,lookfor1f7b,butnotf7b,replacewithf7b)
}

###end event17 storm surge_tide

18. event = coastal flood

  • Flooding of coastal areas, can be caused by high astronomical tide, excludes storm-related flood
####relabel individual events; do not exist in 1996 - 2011 data
evstorm$evtype2a[evstorm$evtype2a %in% c("high tides", "tidal flood")] <- event18

####in coastal flood variations, label everything that's not high surf or storm surge_tide as coastal flood; relies on having first two events properly labelled first.
#create data frame with coast or beach keywords
{cstfix1 <- unique(grep("coast|cst|beach", evstorm$evtype2a, value = TRUE))
cstfix2 <- evstorm[evstorm$evtype2a %in% cstfix1, ]
#extract refnum
cstfix4 <- cstfix2[, c("refnum")]
evstorm$evtype2a[evstorm$refnum %in% cstfix4] <- event18

rm(cstfix1,cstfix2,cstfix4)
} 

######look for high surf in events labelled "astronomical high tide" and "tidal flooding"
{#function7 in events, look for words in remarks, except for other words in remarks
ineventf7b <- c("astronomical high tide", "tidal flooding")
lookfor1f7b <- "tide|flood|King Salmon|canal wall"
butnotf7b <- "storm( +)|cyclone|hurricane|typhoon|tropical|blizzard|no'easter|northeaster|high surf|heavy surf|heav sea"
replacewithf7b <- event18
evstorm <- evwithinremark_fun7(ineventf7b, lookfor1f7b, butnotf7b, replacewithf7b)
####must enter value for all fields; ineventf7b is a specific event
rm(ineventf7b,lookfor1f7b,butnotf7b,replacewithf7b)
}

###end event18 coastal flood

19. event = tsunami

  • Series of very long waves generated by any rapid, large-scale disturbance of the sea (e.g. underwater earthquake) resulting in human or economic damage.
  • no variations in term used, no changes made
paste(unique(grep("tsu|sun", event48names$evtype, value = TRUE)), "= prescribed events with tsu|sun")
## [1] "tsunami = prescribed events with tsu|sun"
paste(unique(grep("tsu|sun", evstorm$evtype, value = TRUE)), "= unique events in evtype with tsu|sun")
## [1] "tsunami = unique events in evtype with tsu|sun"
###end event19 tsunami

20. event = astronomical low tide

  • Abnormal, or extremely low tide levels, that result in human or economic impact, excerbated by strong winds.
  • The National Weather Service Instruction guide includes low tide exacerbated by atmospheric influence in the astronomical low tide event type. Therefore include blow-out tide.
paste(unique(grep("tide", event48names$evtype, value = TRUE)), "= prescribed events with tide")
## [1] "astronomical_low_tide = prescribed events with tide"
## [2] "storm_surge_tide = prescribed events with tide"
paste(length(unique(grep("tide", evstorm$evtype, value = TRUE))), "= unique events in evtype with tide")
## [1] "5 = unique events in evtype with tide"
#####some "astronomical low tide" events do not seem to be about low tides
##events recorded as "astronomical low tide" likely in error, 10 events (high wind, interesting, dense fog, heavy snow, blizzard, lightning, wildfire, excessive heat, drought)
#altfix3 <- altfix1[-altfix2, ]
{evstorm$evtype2a[evstorm$refnum == 647970] <- event27
evstorm$evtype2a[evstorm$refnum == 649551] <- event0h
evstorm$evtype2a[evstorm$refnum == 649731] <- event12
evstorm$evtype2a[evstorm$refnum == 676985] <- event3
evstorm$evtype2a[evstorm$refnum == 691806] <- event2
evstorm$evtype2a[evstorm$refnum == 711365] <- event25
evstorm$evtype2a[evstorm$refnum %in% c("731634", "894370")] <- event47
evstorm$evtype2a[evstorm$refnum == 888709] <- event42
evstorm$evtype2a[evstorm$refnum == 899493] <- event44
}

####relabel blow-out tide as "astronomical low tide"
{###function6 event within event
lookfor1 <- "tide"
thathas <- "blow-out"
butnot <- "noexceptionsbananarama"
replacewith <- event20
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}

###end event20 astronomical low tide

21. event = flash flood

  • Life-threatening rapid rise of water into a normally dry area.
paste(unique(grep("flash", event48names$evtype, value = TRUE)), "= prescribed events with flash")
## [1] "flash_flood = prescribed events with flash"
paste(length(unique(grep("flash", evstorm$evtype, value = TRUE))), "= unique events in evtype with flash")
## [1] "5 = unique events in evtype with flash"
###relabel specific events
evstorm$evtype2a[evstorm$evtype2a %in% c("dam break", "heavy precipatation")] <- event21

###relabel everything with keyword "flash" as "flash flood"
{###function6 event within event
lookfor1 <- "flash"
thathas <- lookfor1
butnot <- "noexceptionsbananarama"
replacewith <- event21
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}

####relabel cool events, 1 is flash flood
####relabel specific cool events
{evstorm$evtype2a[evstorm$evtype %in% c("unseasonably cool", "cool spell", "unseasonably cool & wet")] <- event0h
cool1 <- evstorm[evstorm$evtype == "record cool", c("refnum")]
cool2 <- cool1[!(cool1 %in% 336089)]
evstorm$evtype2a[evstorm$refnum %in% cool2] <- event0h
evstorm$evtype2a[evstorm$refnum == 336089] <- event21

rm(cool1,cool2)
}

###end event21 flash flood

22. event = flood

  • Any high flow, overflow, or inundation by water which causes damage; includes urban and stream flooding, river flooding.
paste(unique(grep("flood", event48names$evtype, value = TRUE)), "= prescribed events with flood")
## [1] "coastal_flood = prescribed events with flood"  
## [2] "flash_flood = prescribed events with flood"    
## [3] "flood = prescribed events with flood"          
## [4] "lakeshore_flood = prescribed events with flood"
paste(length(unique(grep("flood", evstorm$evtype, value = TRUE))), "= unique events with flood")
## [1] "24 = unique events with flood"
####relabel specific events as flood
evstorm$evtype2a[evstorm$evtype2a %in% c("dam failure")] <- event22
###relabel 4 ice jam observations
{evstorm$evtype2a[evstorm$refnum %in% c(215016, 263607)] <- event22
evstorm$evtype2a[evstorm$refnum %in% c(254420, 262419)] <- event0
}

####label flood variations as "flood" except for lake, coast, flash
{###function6 event within event
lookfor1 <- "flood|fld|fldg"
thathas <- lookfor1
butnot <- "lake|coast|flash|tidal"
replacewith <- event22
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}

####relabel urban and stream as flood
{###function6 event within event
lookfor1 <- "urban|stream"
thathas <- lookfor1
butnot <- "thunderstorm"
replacewith <- event22
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}

###end event22 flood

23. event = seiche

  • A standing-wave oscillation in any enclosed lake, results in shoreline flooding and/or damage; may be caused by high winds or fast-moving squall lines, earthquakes, debris flow.
  • no variations, no changes needed
paste(unique(grep("sei", event48names$evtype, value = TRUE)), "= prescribed events with sei")
## [1] "seiche = prescribed events with sei"
paste(unique(grep("sei", evstorm$evtype, value = TRUE)), "= unique evtype with sei")
## [1] "seiche = unique evtype with sei"
###end event23 seiche

24. event = rip current

  • Develops in waters and bays of the ocean, Great Lakes and other lakes, or any location that experiences breaking waves; cause human impact such as (near)drowning, rescues, and economic losses.
paste(unique(grep("cur", evstorm$evtype, value = TRUE)), "= unique evtype with cur")
## [1] "rip currents = unique evtype with cur"
## [2] "rip current = unique evtype with cur"
####relabel variant as "rip current"
evstorm$evtype2a[evstorm$evtype2a %in% c("rip currents")] <- event24

###end event24 rip current

25. event = lightning

  • A sudden electrical discharge from a thunderstorm, resulting in a fatality, injury, and/or damage.
paste(length(unique(grep("lightning", evstorm$evtype, value = TRUE))), "= number of unique evtype with lightning")
## [1] "2 = number of unique evtype with lightning"
####
#relabel specific events
evstorm$evtype2a[evstorm$evtype %in% c("red flag criteria")] <- event25

###relabel variations in lightning, including thunderstorm events
{###function6 event within event
lookfor1 <- "lightning|lighting|ligntning"
thathas <- lookfor1
butnot <- "northern|freezing rain|sleet|snow"
replacewith <- event25
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}

###end event25 lightning

26. event = thunderstorm wind

  • Winds arising from convection, occurring within 30 minutes of lightning being observed; of at least 50 knots (58 mph), or winds of any speed producing a fatality, injury, or damage; include downburst, gustnado.
  • events labelled thunderstorm or tstm, with hail will be labelled thunderstorm wind; events where tornado and other weather events are mentioned in the remarks, but are labelled thunderstorm wind are kept as thunderstorm wind
paste(length(unique(grep("thunderstorm|tstm|thunerstorm", evstorm$evtype, value = TRUE))), "= unique evtype with thunderstorm|tstm|thunerstorm")
## [1] "26 = unique evtype with thunderstorm|tstm|thunerstorm"
####relabel specific event
evstorm$evtype2a[evstorm$evtype %in% c("gusty wind/hail", "heavy rain/severe weather", "thunderstorm winds urban flood", "metro storm, may 26", "wind storm", "wall cloud", "gusty thunderstorm winds", "gusty thunderstorm wind", "large wall cloud", "apache county", "rotating wall cloud", "heatburst", "drowning")] <- event26

{###function6 event within event
lookfor1 <- "thunderstorm|tstm|thunerstorm|thundertorm|tunderstorm|thundertsorm|thundestorm|thunderstrom|thundeerstorm|thunderestr|thuderstorm|thunderestorm" 
thathas <- lookfor1 #every thunderstorm event labelled as thunderstorm
butnot <- "marine|thundersnow|tornado|hail|lightning|lighting|ligntning"
replacewith <- event26
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}

####relabel variations
{###function6 event within event
lookfor1 <- "gustnado|downburst|microburst|mircoburst|micoburst|summary"
thathas <- lookfor1
butnot <- "marine"
replacewith <- event26
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}

####thunderstorm in thunderstorm & hail events
{{thail1 <- unique(grep("hail", evstorm$evtype, value = TRUE))
thail2 <- unique(grep("tstm|thunderstorm", evstorm$evtype, value = TRUE))
thail3 <- thail1[thail1 %in% thail2]
thail3b <- thail3[!(thail3 %in% "tornado")]
thail4 <- evstorm[evstorm$evtype %in% thail3b, ]
}
{thail5t <- grep("tstm|thunderstorm|gustnado|down|blow|damage|destroy|gust|storm|wind|fell|fall|broke|outage|knocked off", thail4$remarks, ignore.case = TRUE)
thail6t <- thail4[thail5t, c("refnum")]
##refnum of NA remarks, classify as thunderstorm wind
thail7t <- thail4[(is.na(thail4$remarks)), c("refnum")]
evstorm$evtype2a[evstorm$refnum %in% c(thail6t, thail7t)] <- event26
}
     ###objects used in hail, DO NOT remove here
}

###end event26 thunderstorm wind

27. event = high wind

  • Non-convective winds of 35 knots (40 mph) or greater lasting 1 hour or longer, or gusts 50 knots (58 mph) or greater for any duration; in mountainous areas numerical values are 43 knots (50 mph) and 65 knots (75 mph).
  • The High Wind event name will not be used for severe local storms or winter storm events. These events should be included in the Thunderstorm Wind and Winter Storm categories, respectively.
paste(length(unique(grep("high wind", evstorm$evtype, value = TRUE))), "= unique events with high wind")
## [1] "4 = unique events with high wind"
###relabel high wind variations
{###function6 event within event
lookfor1 <- "high wind"
thathas <- lookfor1
butnot <- "hurricane|blizzard|storm|typhoon|tropical|cyclone|tide|flood|snow|cold|chill|feezing|windchill|seas|winter|dust|coast|flood|marine|thunderstorm"
replacewith <- event27
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}

####specific events
evstorm$evtype2a[evstorm$evtype %in% c("high", "wake low wind", "wnd")] <- event27

###end event27 high wind

28. event = strong wind

  • Non-convective winds gusting less than 50 knots (58 mph), or sustained winds less than 35 knots (40 mph), causing fatality, injury, or damage; excludes winds from storm events.
####relabel specific events
evstorm$evtype2a[evstorm$evtype %in% c("strong wind gust", "gradient wind", "non-severe wind damage", "gusty lake wind")] <- event28

####relabel strong wind variations
{###function6 event within event
lookfor1 <- "strong wind"
thathas <- lookfor1
butnot <- "ice|snow|flood|marine"
replacewith <- event28
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}

###end event28 strong wind
28.b. Relabel gust|gusty and wind events
  • See II.C.27 and II.C.28 for wind speeds.
#remaining wind events
{wind1l <- c("wind", "wind damage", "winds", "gusty winds", "gusty wind", "gusty wind/rain", "gusty wind/hvy rain", "gusty wind/hail", "wind gusts", "gusty lakd wind", "gradient winds", "storm force winds", "wind advisory")
wind1 <- evstorm[evstorm$evtype %in% wind1l, ]
}

####look for thunderstorm
{gusttstm1 <- grep("thunderstorm", wind1$remarks, ignore.case = TRUE)
gusttstm1b <- grep("no thunderstorm|not|absence", wind1$remarks, ignore.case = TRUE)
gusttstm1c <- gusttstm1[!(gusttstm1 %in% gusttstm1b)]
gusttstm2 <- wind1[gusttstm1c, c("refnum")]
evstorm$evtype2a[evstorm$refnum %in% gusttstm2] <- event26
}

####look for tropical storm in gust; no tropical depression in remarks; 4 observations
{gusttrop1 <- grep("tropical storm", wind1$remarks, ignore.case = TRUE) # row ts in gust
gusttrop1b <- grep("remnant", wind1$remarks, ignore.case = TRUE)
gusttrop1c <- gusttrop1[!(gusttrop1 %in% gusttrop1b)]
gusttrop2 <- wind1[gusttrop1c, c("refnum")] #refnum ts in gust
evstorm$evtype2a[evstorm$refnum %in% gusttrop2] <- event39 #relabel ts in gust
}

####look for tornado in gust; 3 observation
{gusttor1 <- grep("tornado", wind1$remarks, ignore.case = TRUE) #row tor in gust
gusttor1b <- gusttor1[!(gusttor1 %in% gusttstm1c)]
gusttor2 <- wind1[gusttor1b, "refnum"] #refnum tor in gust
evstorm$evtype2a[evstorm$refnum %in% gusttor2] <- event34 #relabel as tor
}

####look for hurricane in gust;
{gusthur1 <- grep("hurricane erin", wind1$remarks, ignore.case = TRUE) #row tor in gust
gusthur2 <- wind1[gusthur1, c("refnum")] #refnum tor in gust
evstorm$evtype2a[evstorm$refnum %in% gusthur2] <- event38
}

####look for mph, knots; that's not thunderstorm, tropical storm, or tornado
{gustmph1 <- grep("mph|knot|kt", wind1$remarks, ignore.case = TRUE) #remarks w mph
gustmph2 <- wind1[gustmph1, c("refnum")] #refnum of remarks
gustnamed2 <- c(gusttstm2, gusttrop2, gusttor2, gusthur2) #refnum of labelled gusts
gustmph3 <- gustmph2[!(gustmph2 %in% gustnamed2)] #refnum [mph - labelled] gusts
gustmph4 <- wind1[wind1$refnum %in% gustmph3, ] #df [mph - labelled] gusts
##look for high wind; 4 of 57 within wind parameters; 4 high wind
#wind speeds of 50 - 99 knots, or 59 - 99 mph
gusthw1 <- "[5-9](. +)knot|[5-9](. +)kt|[6-9](. +)mph|5[9]( +)mph"
gusthw2 <- grep(gusthw1, gustmph4$remarks, ignore.case = TRUE)
gusthw3 <- gustmph4[gusthw2, c("refnum")]
evstorm$evtype2a[evstorm$refnum %in% gusthw3] <- event27
}

###remaining gust records as strong wind
{gustsw1 <- c(gustnamed2, gusthw3)
gustsw2 <- wind1[ , c("refnum")]
gustsw3 <- gustsw2[!(gustsw2 %in% gustsw1)]
evstorm$evtype2a[evstorm$refnum %in% gustsw3] <- event28
}

rm(wind1,wind1l, gusttstm1,gusttstm1b,gusttstm1c,gusttstm2, gusttrop1,gusttrop1b,gusttrop1c,gusttrop2, gusttor1,gusttor1b,gusttor2, gusthur1, gusthur2, gustmph1,gustmph2,gustnamed2,gustmph3,gustmph4, gusthw1,gusthw2,gusthw3, gustsw1,gustsw2,gustsw3)

###end event28b gust|gusty wind

29. event = marine thunderstorm wind

  • Winds associated with thunderstorms, occurring over the waters and bays of the ocean, Great Lakes, etc; speeds of at least 34 knots (39 mph) for 2 hours or less, or winds of any speed that result in human or economic impact.
####relabel marine thunderstorm wind variations
evstorm$evtype2a[evstorm$evtype2a %in% c("marine tstm wind")] <- event29

###end event29 marine thunderstorm wind

30. event = marine high wind

  • Non-convective, sustained winds or frequent gusts of 48 knots (55 mph) or more, resulting in human or economic impact over marine forecast zones.
  • no variations, no changes; see II.C.31.b
paste(unique(grep("marine", evstorm$evtype, value = TRUE)), "= unique events with marine")
## [1] "marine accident = unique events with marine"         
## [2] "marine tstm wind = unique events with marine"        
## [3] "marine hail = unique events with marine"             
## [4] "marine high wind = unique events with marine"        
## [5] "marine thunderstorm wind = unique events with marine"
## [6] "marine strong wind = unique events with marine"
###end event30 marine high wind

31. event = marine strong wind

  • Non-convective, sustained winds or frequent gusts up to 47 knots (54 mph) with human or economic impact in specific marine forecast zones.
  • no variations, no changes; see II.C.31.b
paste(length(unique(grep("marine", evstorm$evtype, value = TRUE))), "= unique events with marine")
## [1] "6 = unique events with marine"
###end event31 marine strong wind

32. event = hail

  • Frozen precipitation that form balls or irregular lumps of ice.
paste(length(unique(grep("hail", evstorm$evtype, value = TRUE))), " = unique events with hail")
## [1] "9  = unique events with hail"
#relabel all hail events except for "marine hail"
{###function6 event within event
lookfor1 <- "hail" 
thathas <- lookfor1
butnot <- "marine|tornado|thunderstorm|tstm|gusty"
replacewith <- event32
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}

####hail in thunderstrom & hail events
{{thail1 <- unique(grep("hail", evstorm$evtype, value = TRUE))
thail2 <- unique(grep("tstm|thunderstorm", evstorm$evtype, value = TRUE))
thail3 <- thail1[thail1 %in% thail2]
thail3b <- thail3[!(thail3 %in% "tornado")]
thail4 <- evstorm[evstorm$evtype %in% thail3b, ]
}
{thail5h <- grep("hail", thail4$remarks, ignore.case = TRUE)
thail6h <- thail5h[!(thail5h %in% thail5t)]
thail7h <- thail4[thail6h, c("refnum")]
evstorm$evtype2a[evstorm$refnum %in% thail7h] <- event32
}
rm(thail1,thail2,thail3,thail3b,thail4,thail5t,thail6t,thail7t,thail5h,thail6h,thail7h)
}

####relabel specific events in thunderstorm & hail events as hail, flood, heavy rain, thunderstorm wind, lightning
{evstorm$evtype2a[evstorm$refnum == 273361] <- event32
evstorm$evtype2a[evstorm$refnum %in% c(308116, 318436)] <- event22
evstorm$evtype2a[evstorm$refnum == 308164] <- event41
evstorm$evtype2a[evstorm$refnum == 408911] <- event26
evstorm$evtype2a[evstorm$refnum == 435712] <- event25
}

###end event32 hail

33. event = marine hail

  • Hail occurring in marine forecaast zones.
  • no variations, no changes
paste((unique(grep("marine", evstorm$evtype, value = TRUE))), "= unique evtype with marine")
## [1] "marine accident = unique evtype with marine"         
## [2] "marine tstm wind = unique evtype with marine"        
## [3] "marine hail = unique evtype with marine"             
## [4] "marine high wind = unique evtype with marine"        
## [5] "marine thunderstorm wind = unique evtype with marine"
## [6] "marine strong wind = unique evtype with marine"
###end event33 marine hail

34. event = tornado

  • Violently rotating column of air; must be in contact with the ground; exclude wind damage from rear-flank downdraft; may include landspouts and funnels meeting criteria in section 47.6 of 2021 guide.
paste(length(unique(grep("tornado", evstorm$evtype, value = TRUE))), "= unique evtype with tornado")
## [1] "2 = unique evtype with tornado"
####relabel tornado variations, include tornado/waterspout combinations since damage was on land
{###function6 event within event
lookfor1 <- "tornado"
thathas <- lookfor1
butnot <- "noexceptionsbanana"
replacewith <- event34
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}

####relabel specific events
evstorm$evtype2a[evstorm$evtype %in% c("wall cloud/funnel cloud", "torndao")] <- event34

###end event34 tornado

35. event = waterspout

  • Violently rotating column of air; in contact with waters in water bodies included in Marine Forecast Zones; classify as waterspout when it’s on the water surface, tornado when it’s on land.
paste(length(unique(grep("spout", evstorm$evtype, value = TRUE))), "= unique evtype with spout")
## [1] "3 = unique evtype with spout"
####relabel waterspout variations
{###function6 event within event
lookfor1 <- "waterspout|water spout|wayterspout"
thathas <- lookfor1
butnot <- "tornado|dust devil"
replacewith <- event35
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}

###end event 35 waterspout

36. event = funnel cloud

  • Rotating, visible extension of a cloud pendant from a convective cloud with circulation not reaching the ground.
paste(length(unique(grep("funnel", evstorm$evtype, value = TRUE))), "= unique evtype with funnel")
## [1] "2 = unique evtype with funnel"
####relabel funnel cloud variations
{###function6 event within event
lookfor1 <- "funnel"
thathas <- lookfor1
butnot <- "thunderstorm|hail|waterspout|wall|land|dust|tornado"
replacewith <- event36
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}

###end event36 funnel cloud

37. event = dust devil

  • Ground-based, rotating column of air, not in contact with a cloud base, usually of short duration, rendered visible by dust, sand, or other debris; resulting in public interest, human or economic impact.
paste(length(unique(grep("dust", evstorm$evtype, value = TRUE))), "= unique evtype with dust")
## [1] "5 = unique evtype with dust"
###relabel dust devil variations
evstorm$evtype2a[evstorm$evtype2a %in% c("dust devil waterspout", "dust devel", "landspout", "whirlwind")] <- event37

###end event37 dust devil

38. event = hurricane_typhoon

  • Tropical cyclone in which the 1-minute sustained wind speed is 64 knots (74 mph) or greater.
paste(length(unique(grep("typhoon", evstorm$evtype, value = TRUE))), "= unique evtype with typhoon")
## [1] "2 = unique evtype with typhoon"
####relabel hurrican and typhoon variations
{###function6 event within event
lookfor1 <- "hurricane|typhoon"
thathas <- lookfor1
butnot <- "swell"
replacewith <- event38
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}

###end event38 hurricane_typhoon

39. event = tropical storm

  • Tropical cyclone in which the 1-minute sustained wind speed ranges from 34 - 63 knots (39 to 73 mph).
paste(unique(grep("tropical", evstorm$evtype, value = TRUE)), "= unique evtype with tropical")
## [1] "tropical storm = unique evtype with tropical"     
## [2] "tropical depression = unique evtype with tropical"
####relabel tropical storm variations

{###function6 event within event
lookfor1 <- "tropical"
thathas <- lookfor1
butnot <- "depression"
replacewith <- event39
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}

###end event39 tropical storm

40. event = tropical depression

  • Tropical cyclone in which the 1-minute sustained wind speed is 33 knots (38 mph) or less.
  • no variations, no changes
paste(length(unique(grep("tropical", evstorm$evtype, value = TRUE))), "= unique evtype with tropical")
## [1] "2 = unique evtype with tropical"
###end event40 tropical depression

41. event = heavy rain

  • Unusually large amount of rain, which does not cause a flash flood or flood event, but causes human or economic impact.
paste(length(unique(grep("heavy rain|hvy rain", evstorm$evtype, value = TRUE))), "= unique evtype with heavy rain|hvy rain")
## [1] "9 = unique evtype with heavy rain|hvy rain"
###relabel specific events as heavy rain
evstorm$evtype2a[evstorm$evtype %in% c("rapidly rising water", "high water", "rain & wind", "cool & wet")] <- event41

####relabel heavy rain variations
{###function6 event within event
lookfor1 <- "heavy rain|hvy rain"
thathas <- lookfor1
butnot <- "freezing|lightning|flood|small stream|snow|high surf|tstm|thunderstorm|severe weather|effects|high surf
"
replacewith <- event41
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}

####look into heavy precipitation events
{#function7 in events, look for words in REMARKS, except for other words in remarks
ineventf7b <- c("heavy precipitation", "record precipitation", "excessive precipitation")
lookfor1f7b <- "precipitation"
butnotf7b <- "snow|storm|sleet|ice|flood"
replacewithf7b <- event41
evstorm <- evwithinremark_fun7(ineventf7b, lookfor1f7b, butnotf7b, replacewithf7b)
##must enter value for all fields
rm(ineventf7b,lookfor1f7b,butnotf7b,replacewithf7b)
}

{#####look into various rain events
rain1 <- c("excessive rain", "torrential rain", "excessive wetness", "unseasonably wet", "rain", "record/excessive rainfall", "record rainfall", "heavy showers", "heavy shower", "rain damage", "rain (heavy)", "prolonged rain", "excessive rainfall", "torrential rainfall", "remnants of floyd", "abnormally wet", "rain/wind", "wet weather", "wet year", "unseasonal rain", "excessive", "wet month", "monthly rainfall", "early rain", "extremely wet")
rain2 <- evstorm[evstorm$evtype %in% rain1, ] #88 observations

####look for flash flood
rainflash1 <- grep("flash flood", rain2$remarks, ignore.case = TRUE)
rainflash2 <- rain2[rainflash1, c("refnum")]
evstorm$evtype2a[evstorm$refnum %in% rainflash2] <- event21

####look for flood
rainflood1 <- grep("flood", rain2$remarks, ignore.case = TRUE)
rainflood2 <- rainflood1[!(rainflood1 %in% rainflash1)]
rainflood3 <- rain2[rainflood2, c("refnum")]
evstorm$evtype2a[evstorm$refnum %in% rainflood3] <- event22

####relabel remainder as heavy rain
rainrain1 <- rain2[-rainflood1, c("refnum")]
evstorm$evtype2a[evstorm$refnum %in% rainrain1] <- event41

rm(rain1,rain2, rainflash1,rainflash2, rainflood1,rainflood2,rainflood3, rainrain1)
}

###end event41 heavy rain

42. event = excessive heat

  • Results from combination of high temperatures (well above normal) and high humidity; meets or exceeds locally/regionally established excessive heat warning thresholds; no temperatures specified.
  • relabel all extreme|excessive|record heat events including those mentioning drought as excessive heat.
paste(length(unique(grep("heat", evstorm$evtype, value = TRUE))), "= unique heat evtype")
## [1] "6 = unique heat evtype"
####relabel excessive variations
{###function6 event within event
lookfor1 <- "heat"
thathas <- "excessive|record|extreme"
butnot <- "noexceptionsbanana"
replacewith <- event42
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}

###end event42 excessive heat

43. event = heat

  • A period of heat resulting from the combination of high temperatures (above normal) and relative humidity; meets or exceeds locally/regionally established advisory thresholds; includes events below heat adivsory criteria that result in fatality; no temperatures specified.
  • Relabel all heat events, except those labelled excessive heat, but including those mentioning drought as heat.
####relabel excessive variations
{###function6 event within event
lookfor1 <- "heat"
thathas <- lookfor1
butnot <- "excessive|record|extreme|heatburst"
replacewith <- event43
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}

###end event43 heat

44. event = drought

  • Deficiency of moisture that results in adverse impact on people, animals, or vegetation over a sizeable area.
paste(length(unique(grep("drought", evstorm$evtype, value = TRUE))), "= unique evtype with drought")
## [1] "3 = unique evtype with drought"
####relabel specific events
evstorm$evtype2a[evstorm$evtype %in% c("red flag fire wx", "below normal precipitation")] <- event44

####relabel dry events
{dry1 <- c("monthly precipitation", "lack of snow", "dry pattern", "record dry month", "unseasonably dry", "dry", "snow drought", "mild/dry pattern", "mild & dry pattern", "dry spell", "dry conditions", "dryness", "abnormally dry", "very dry", "dry weather", "excessively dry", "record dryness", "driest month", "record low rainfall")
####look for drought
dry2 <- evstorm[evstorm$evtype %in% dry1, ]
dry3 <- grep("dry|drought|record low rain|below normal rain|drier|dries|least snow", dry2$remarks, ignore.case = TRUE)
dry4 <- dry2[dry3, c("refnum")]
evstorm$evtype2a[evstorm$refnum %in% dry4] <- event44
####relabel remainder as interesting
dry2b <- dry2[ ,c("refnum")]
drynt1 <- dry2b[!(dry2b %in% dry4)]
evstorm$evtype2a[evstorm$refnum %in% drynt1] <- event0

rm(dry1,dry2,dry3,dry4,dry2b,drynt1)
}

###end event44 drought
44.b. Relabel warm and hot events
  • relabel based on remarks within events
  • excessive heat criteria: >95 F or containing key phrases indicating unusually high heat
  • heat criteria: <95F with fatality or injury
  • drought criteria: include anything that mentions lack of rain, snow or precipitation
####look into warm or hot events; 345 observations
{heat1 <- (unique(grep("warm|hot", evstorm$evtype, value = TRUE)))
heat1b <- c("record temperatures")
heat2 <- evstorm[evstorm$evtype %in% c(heat1, heat1b), ]
heat2b <- heat2[, c("refnum")]
}

#####look for excessive heat
##excessive heat no mention of fatality
{heatex1a <- "oppressive|heatwave|heat wave|very hot|extreme|intense|sweltering|record heat|( +)9[5-9]|( +)10[0-9]|( +)11[0-9]|( +)12[0-9]|( +)13[0-9]"
heatex1b <- grep(heatex1a, heat2$remarks, ignore.case = TRUE)
heatex2a <- "( +)[0-9]( +)|( +)1[0-9]( +)|( +)2[0-9]( +)|( +)3[0-9]( +)|( +)4[0-9]( +)|( +)5[0-9]( +)|( +)6[0-9]( +)|( +)7[0-6]"
heatex2b <- grep(heatex2a, heat2$remarks, ignore.case = TRUE)
heatex3 <- heatex1b[!(heatex1b %in% heatex2b)]
heatex4 <- heat2[heatex3, c("refnum")] #17 observations
evstorm$evtype2a[evstorm$refnum %in% heatex4] <- event42
}

####look for heat with fatality
{heatht1a <- heat2b[!(heat2b %in% heatex4)]#328 not excessive heat
heat3 <- heat2[heat2$refnum %in% heatht1a, ] #328 observations, not excessive heat
heatht1c <- "death|die|fatal|dead|hyperthermia|stroke|exhaust|collaps|illness|hospital|injur|power grid|lost power"
heatht1d <- grep(heatht1c, heat3$remarks, ignore.case = TRUE)
heatht2 <- heat3[heatht1d, c("refnum")] #11
evstorm$evtype2a[evstorm$refnum %in% heatht2] <- event43
}

####look for drought
{heatdr1a <- c(heatex4, heatht2)
heatdr1b <- heat2b[!(heat2b %in% heatdr1a)]
heat4 <- heat2[heat2$refnum %in% heatdr1b, ]
heatdr1c <- "dry|drought|dries|record low rain|below normal rain"
heatdr1d <- grep(heatdr1c, heat4$remarks, ignore.case = TRUE)
heatdr2 <- heat4[heatdr1d, c("refnum")]
evstorm$evtype2a[evstorm$refnum %in% heatdr2] <- event44
}

####relabel remaining records as noted_temp
{heatnt1a <- c(heatex4, heatht2, heatdr2)
heatnt1b <- heat2b[!(heat2b %in% heatnt1a)]
heatnt2 <- heat2[heat2$refnum %in% heatnt1b, ]
evstorm$evtype2a[evstorm$refnum %in% heatnt1b] <- event0h
}

rm(heat1,heat1b,heat2,heat2b, heatex1a,heatex1b,heatex2a,heatex2b,heatex3,heatex4, heatht1a,heat3,heatht1c,heatht1d,heatht2, heatdr1a,heatdr1b,heat4,heatdr1c,heatdr1d,heatdr2, heatnt1a,heatnt1b,heatnt2)

###end event44.b warm|hot

45. event = dust storm

  • Strong winds over dry ground, with little or no vegetation, that lift particles of dust or sand, reducing visibility below locally/regionally established values; exclude thunderstorms.
paste(length(unique(grep("dust", evstorm$evtype, value = TRUE))), "= unique evtype with dust")
## [1] "5 = unique evtype with dust"
####relabel dust storm variations
{###function6 event within event
lookfor1 <- "dust"
thathas <- lookfor1
butnot <- "devil|devel"
replacewith <- event45
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}

###end event45 dust storm

46. event = dense smoke

  • Dense smoke reducing visibility; adverse impact on people, transportation, commerce.
paste(length(unique(grep("smoke", evstorm$evtype, value = TRUE))), "= unique evtype with smoke")
## [1] "2 = unique evtype with smoke"
{###function6 event within event
lookfor1 <- "smoke"
thathas <- lookfor1
butnot <- "noexceptionsbanana"
replacewith <- event46
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}

###end event46 dense smoke

47. event = wildfire

  • Any significant forest fire, grassland fire, rangeland fire, or wildland-urban interface fire that consumes the natural fuels and spreads in response to its environment.
paste(length(unique(grep("fire", evstorm$evtype, value = TRUE))), "= unique evtype with fire")
## [1] "4 = unique evtype with fire"
####relabel wildfire variations
{###function6 event within event
lookfor1 <- "fire"
thathas <- lookfor1
butnot <- "red flag|lightning"
replacewith <- event47
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}

###end event47 wildfire

48. event = volcanic

  • Fine particles of mineral matter from a volcanic eruption.
paste(length(unique(grep("volcanic ash", evstorm$evtype, value = TRUE))), "= unique evtype with volcanic ash")
## [1] "3 = unique evtype with volcanic ash"
####relabel volcanic ash variations
{###function6 event within event
lookfor1 <- "volcanic ash|volcanic eruption|vog"
thathas <- lookfor1
butnot <- "noexceptionsbanana"
replacewith <- event48
evstorm <- evwithinev_fun(lookfor1, thathas, butnot, replacewith)
###must enter value for all fields
rm(lookfor1,thathas,butnot,replacewith)
}

###end event48 volcanic ash

49. event = noted, noted_temp

  • Relabel specific events that can’t be classified within the 48 prescribed events as either noted or noted_temp (for events mentioning unusual temperatures).
####relabel events that can't be categorized
evstorm$evtype2a[evstorm$evtype %in% c("northern lights", "?", "none", "southeast", "no severe weather", "severe turbulence", "normal precipitation", "rogue wave")] <- event0

####relabel temperature events that can't be categorized
evstorm$evtype2a[evstorm$evtype %in% c("mild pattern", "record high", "record high temperature", "record high temperatures", "temperature record", "record temperature", "high temperature record")] <- event0h

###end event49 noted

50. Relabel event = other

  • event type label “other” contains a mixture of events
  • search remarks for keywords to relabel the observations
  • first subset evstorm data frame for evtype labelled as “other” to create the other1 data frame, then extract the refnum, use this refnum to relabel the events in the evstorm data frame in the evtype2a column
####subset event "other"; 52 obs
{other1 <- evstorm[evstorm$evtype == "other", ]
other1b <- other1[ ,c("refnum")]
}

####look for dust devil; 6 obs
{otherdd1 <- grep("dust devil|dustdevil", other1$remarks, ignore.case = TRUE)
otherdd1b <- other1[otherdd1, c("refnum")]
evstorm$evtype2a[evstorm$refnum %in% otherdd1b] <- event37
}

####look for heavy rain; 31 obs
{otherhr1 <- grep("heavy rain|excess rainfall", other1$remarks, ignore.case = TRUE)
otherhr1b <- other1[otherhr1, c("refnum")]
evstorm$evtype2a[evstorm$refnum %in% otherhr1b] <- event41
}

####look for lightning-caused fire; 2 obs
{otherlf1 <- grep("lightning-caused fire", other1$remarks, ignore.case = TRUE)
otherlf1b <- other1[otherlf1, c("refnum")]
evstorm$evtype2a[evstorm$refnum %in% otherlf1b] <- event25
}

####look for winter weather; 2 obs
{otherww1 <- grep("light snow", other1$remarks, ignore.case = TRUE)
otherww1b <- other1[otherww1, c("refnum")]
evstorm$evtype2a[evstorm$refnum %in% otherww1b] <- event13
}

####look for avalanche; 1 obs
{otherav1 <- grep("avalanche", other1$remarks, ignore.case = TRUE)
otherav1b <- other1[otherav1, c("refnum")]
evstorm$evtype2a[evstorm$refnum %in% otherav1b] <- event1
}

####look for thunderstorm; 4 obs
{othertst1 <- grep("thunderstorm", other1$remarks, ignore.case = TRUE)
othertst1b <- other1[othertst1, c("refnum")]
evstorm$evtype2a[evstorm$refnum %in% othertst1b] <- event26
}

####look for blizzard; 1 obs
{otherbl1 <- grep("blizzard", other1$remarks, ignore.case = TRUE)
otherbl1b <- other1[otherbl1, c("refnum")]
evstorm$evtype2a[evstorm$refnum %in% otherbl1b] <- event2
}

####look for flood; 1 obs
{otherfl1 <- grep("flood", other1$remarks, ignore.case = TRUE)
otherfl1b <- other1[otherbl1, c("refnum")]
evstorm$evtype2a[evstorm$refnum %in% otherfl1b] <- event22
}

####look for strong wind; 2 obs
{othersw1 <- grep("strong wind|56 mph", other1$remarks, ignore.case = TRUE)
othersw1b <- other1[othersw1, c("refnum")]
evstorm$evtype2a[evstorm$refnum %in% othersw1b] <- event28
}

####look for high wind; 1 obs
{otherhw1 <- grep("62 mph", other1$remarks, ignore.case = TRUE)
otherhw1b <- other1[otherhw1, c("refnum")]
evstorm$evtype2a[evstorm$refnum %in% otherhw1b] <- event27
}

####look for coastal flood; 1 obs
{othercf1 <- grep("shore swell", other1$remarks, ignore.case = TRUE)
othercf1b <- other1[othercf1, c("refnum")]
evstorm$evtype2a[evstorm$refnum %in% othercf1b] <- event18
}

####relabel remaining record
evstorm$evtype2a[evstorm$refnum == 378658] <- event0h

rm(other1,other1b, otherdd1,otherdd1b, otherhr1,otherhr1b, otherlf1,otherlf1b, otherww1, otherww1b, otherav1,otherav1b, othertst1,othertst1b, otherbl1,otherbl1b, otherfl1,otherfl1b, othersw1,othersw1b, otherhw1,otherhw1b, othercf1,othercf1b)

###end event50 other

51. Change spaces, dashes to underscore; remove parenthesis

{evstorm$evtype2a <- gsub("( +)", "_", evstorm$evtype2a)
evstorm$evtype2a <- gsub("\\-", "_", evstorm$evtype2a)
evstorm$evtype2a <- gsub("\\(", "", evstorm$evtype2a)
evstorm$evtype2a <- gsub("\\)", "", evstorm$evtype2a)
}

###remove event type codes used to relabel event types
rm(event0, event0h, event1, event2, event3, event4, event5, event6, event7, event8, event9, event10, event11, event12, event13, event14, event15, event16, event17, event18, event19, event20, event21, event22, event23, event24, event25, event26, event27, event28, event29, event30, event31, event32, event33, event34, event35, event36, event37, event38, event39, event40, event41, event42, event43, event44, event45, event46, event47, event48, event49)

###check number of event types

paste(length(unique(evstorm$evtype2a)), "= unique events in evtype2a, expect 50")
## [1] "50 = unique events in evtype2a, expect 50"
###end step51 remove spaces

52. Table 2: Create table showing number of unique events changed to one of the 48 prescribed event types.

###PREVIOUS -- create list of event types

###PREVIOUS - go through event types in events list, count the number of rows for each event, count the number of recorded event types that were relabelled to one of the 50 events.

###store the loop result as an object so it doesn't get printed
{t5 <- r5
     rm(events, r5)
###render a scrollable table
kable(t5, caption = "Table 2: Number of events relabelled to one of the 48 prescribed event types and two noted events. Column presc_ev_name are the prescribed event names, and num_evtype_incl are the number of event names from the original that became part of the corresponding prescribed event.") %>% 
     kable_styling(full_width = F) %>% 
 scroll_box(width = "500px", height = "300px")
}
Table 2: Number of events relabelled to one of the 48 prescribed event types and two noted events. Column presc_ev_name are the prescribed event names, and num_evtype_incl are the number of event names from the original that became part of the corresponding prescribed event.
presc_ev_name num_evtype_incl num_observations
astronomical_low_tide 3 166
avalanche 2 379
blizzard 4 2637
coastal_flood 10 516
cold_wind_chill 15 936
debris_flow 9 621
dense_fog 4 1689
dense_smoke 2 21
drought 24 2558
dust_devil 5 147
dust_storm 3 422
excessive_heat 9 1714
extreme_cold_wind_chill 10 1293
flash_flood 10 51016
flood 27 27793
frost_freeze 24 1772
funnel_cloud 2 6068
freezing_fog 3 88
hail 7 207865
heat 7 732
heavy_rain 23 11630
heavy_snow 10 14162
high_surf 14 1098
high_wind 11 19986
hurricane_typhoon 4 271
ice_storm 2 1881
lake_effect_snow 3 661
lakeshore_flood 1 23
lightning 6 13211
marine_hail 1 442
marine_high_wind 1 135
marine_strong_wind 2 50
marine_thunderstorm_wind 4 11989
rip_current 2 734
seiche 1 21
sleet 15 361
storm_surge_tide 10 736
strong_wind 14 4108
thunderstorm_wind 105 211416
tornado 4 23157
tropical_depression 1 60
tropical_storm 3 687
tsunami 1 20
volcanic_ash 5 30
waterspout 2 3392
wildfire 4 4178
winter_storm 16 12119
winter_weather 32 8126
noted 16 41
noted_temp 27 372
###end of step52 count relabels

II.D Economic costs

1. Property damage costs

  • 5 unique property damage exponents
  • replace character exponents with numerical values
unique(evstorm$propdmgexp)
## [1] "K" NA  "M" "B" "0"
####Property damage exponents

{#translate codes to numeric values; translate NA and 0 as exponents of 1, which keeps the propdmg values, after multiplication with the exponent
evstorm$propdmgexp2[evstorm$propdmgexp == "K"] <- 10^3
evstorm$propdmgexp2[evstorm$propdmgexp %in% c("M", "m")] <- 10^6
evstorm$propdmgexp2[evstorm$propdmgexp == "B"] <- 10^9
evstorm$propdmgexp2[is.na(evstorm$propdmgexp)] <- 1
evstorm$propdmgexp2[evstorm$propdmgexp == "0"] <- 1

evstorm$propdmgexp2 <- as.numeric(evstorm$propdmgexp2)
}
###calculate property damage
evstorm$propdmg2 <- evstorm$propdmg * evstorm$propdmgexp2
###count zero values
paste(length(which(evstorm$propdmg == "0")), "observations without property damage costs")
## [1] "464262 observations without property damage costs"
###end of step1 property damage exponents

2. Crop damage costs

  • 4 unique crop damage exponents
  • replace character exponents with numerical values
unique(evstorm$cropdmgexp)
## [1] "K" NA  "M" "B"
##Copy cropdmgexp column
{evstorm$cropdmgexp2 <- evstorm$cropdmgexp

##translate codes to numeric values; translate NA as one, which keeps the cropdmg value after multiplying cropdmg * cropdmgexp2
evstorm$cropdmgexp2[evstorm$cropdmgexp %in% c("K", "k")] <- (10^3)
evstorm$cropdmgexp2[evstorm$cropdmgexp %in% c("M", "m")] <- (10^6)
evstorm$cropdmgexp2[evstorm$cropdmgexp == c("B")] <- 10^9
evstorm$cropdmgexp2[is.na(evstorm$cropdmgexp)] <- 1

evstorm$cropdmgexp2 <- as.numeric(evstorm$cropdmgexp2)
}

###calculate crop damage
evstorm$cropdmg2 <- (evstorm$cropdmg * evstorm$cropdmgexp2)
###count zero values
paste(length(which(evstorm$cropdmg == "0")), "events without crop damage costs")
## [1] "634839 events without crop damage costs"
###end of step2 cropdmgexp

3. Inflation compared to 2011; property damage and crop damage

  • The frequency of storm events may vary from year to year.
  • Adjusting costs based on inflation relative to a reference year (2011) might help in comparing effects.
  • https://www.usinflationcalculator.com/
    • accessed August 22, 2023

III. Analysis

III.A compute health and economic effects

  • Tables and graphs are prepared in the analysis section (this section), but are rendered in the results section (IV).

1. Table 3: Subset evstorm data frame

  • From evstorm, create new data frame evstorm2: 653530 rows, 14 variables
###subset evstorm data frame
evstorm2 <- evstorm[ , c("bgn_date", "countyname", "statename", "evtype", "fatalities", "injuries", "remarks", "refnum", "evtype2a", "bgn_month", "bgn_year", "propdmg3", "cropdmg3")]

######add extra column to help count events
evstorm2$ones <- 1

#####summary of new data frame
summary(evstorm2)
##     bgn_date                       countyname         statename        
##  Min.   :1996-01-01 00:00:00.00   Length:653530      Length:653530     
##  1st Qu.:2000-11-21 00:00:00.00   Class :character   Class :character  
##  Median :2005-05-14 00:00:00.00   Mode  :character   Mode  :character  
##  Mean   :2004-10-25 14:35:22.18                                        
##  3rd Qu.:2008-08-22 00:00:00.00                                        
##  Max.   :2011-11-30 00:00:00.00                                        
##     evtype            fatalities           injuries          remarks         
##  Length:653530      Min.   :  0.00000   Min.   :0.00e+00   Length:653530     
##  Class :character   1st Qu.:  0.00000   1st Qu.:0.00e+00   Class :character  
##  Mode  :character   Median :  0.00000   Median :0.00e+00   Mode  :character  
##                     Mean   :  0.01336   Mean   :8.87e-02                     
##                     3rd Qu.:  0.00000   3rd Qu.:0.00e+00                     
##                     Max.   :158.00000   Max.   :1.15e+03                     
##      refnum         evtype2a           bgn_month        bgn_year   
##  Min.   :248768   Length:653530      Min.   : 1.00   Min.   :1996  
##  1st Qu.:412150   Class :character   1st Qu.: 5.00   1st Qu.:2000  
##  Median :575533   Mode  :character   Median : 6.00   Median :2005  
##  Mean   :575533                      Mean   : 6.06   Mean   :2004  
##  3rd Qu.:738915                      3rd Qu.: 8.00   3rd Qu.:2008  
##  Max.   :902297                      Max.   :12.00   Max.   :2011  
##     propdmg3            cropdmg3              ones  
##  Min.   :0.000e+00   Min.   :0.000e+00   Min.   :1  
##  1st Qu.:0.000e+00   1st Qu.:0.000e+00   1st Qu.:1  
##  Median :0.000e+00   Median :0.000e+00   Median :1  
##  Mean   :6.491e+05   Mean   :6.546e+04   Mean   :1  
##  3rd Qu.:1.500e+03   3rd Qu.:0.000e+00   3rd Qu.:1  
##  Max.   :1.288e+11   Max.   :1.736e+09   Max.   :1
#####count number of event types, rows, and columns
paste(length(unique(evstorm2$evtype2a)), "= evtype in evstorm2 data frame")#expect 50 events
## [1] "50 = evtype in evstorm2 data frame"
paste(nrow(evstorm2), "rows", ncol(evstorm2), "columns")
## [1] "653530 rows 14 columns"
###column descriptions
evstorm2d1 <- c("year-month-day start of storm event", "county name where event occurred", "name of state (e.g. Alabama) territory (e.g. Guam) or area (e.g. Gulf_of_Mexico) where event occured", "426 event types", "number of deaths associated with event", "number of injuries associated with event", "additional information about event may include severity location health and economic impact", "unique 6 digit identifier for specific event", "event type relabelled into one of th 48 prescribed events or two noted events", "month of event start", "year of event start", "property damage cost in USD adjusted to 2011 dollar equivalent", "crop damage cost in USD adjusted to 2011 dollar equivalent", "value of one to help count events")

###class of each column
evstorm2d2 <- cbind(sapply(evstorm2, class))
###combine column class and descriptions to create a table
evstorm2d3 <- data.frame(cbind(evstorm2d2, evstorm2d1))
colnames(evstorm2d3) <- c("class", "description")

rm(evstorm2d1, evstorm2d2)

###display table with column descriptions
kable(evstorm2d3, caption = "Table 3: Description of columns in evstorm2 data frame") %>%
     kable_styling(full_width = T) %>% 
 scroll_box(height = "300px")
Table 3: Description of columns in evstorm2 data frame
class description
bgn_date POSIXct, POSIXt year-month-day start of storm event
countyname character county name where event occurred
statename character name of state (e.g. Alabama) territory (e.g. Guam) or area (e.g. Gulf_of_Mexico) where event occured
evtype character 426 event types
fatalities numeric number of deaths associated with event
injuries numeric number of injuries associated with event
remarks character additional information about event may include severity location health and economic impact
refnum numeric unique 6 digit identifier for specific event
evtype2a character event type relabelled into one of th 48 prescribed events or two noted events
bgn_month numeric month of event start
bgn_year numeric year of event start
propdmg3 numeric property damage cost in USD adjusted to 2011 dollar equivalent
cropdmg3 numeric crop damage cost in USD adjusted to 2011 dollar equivalent
ones numeric value of one to help count events
###end of step1 subset

2. Compute total and mean health effects for each event type

### total fatality for each event
fatal1 <- evstorm2 %>% 
     group_by(as.factor(evtype2a)) %>% 
     summarise(total_fatal = sum(fatalities, na.rm = TRUE)) %>% 
     arrange(desc (total_fatal))
colnames(fatal1) <- c("evtype", "total")

### mean fatality for each event
fatal2 <- evstorm2 %>% 
     group_by(as.factor(evtype2a)) %>% 
     summarise(mean_fatal = mean(fatalities, na.rm = TRUE)) %>% 
     arrange(desc (mean_fatal))
colnames(fatal2) <- c("evtype", "average")

### total injury for each event
injury1 <- evstorm2 %>% 
     group_by(as.factor(evtype2a)) %>% 
     summarise(total_injury = sum(injuries, na.rm = TRUE)) %>% 
     arrange(desc (total_injury))
colnames(injury1) <- c("evtype", "total")

### mean injury for each event
injury2 <- evstorm2 %>% 
     group_by(as.factor(evtype2a)) %>% 
     summarise(mean_injury = mean(injuries, na.rm = TRUE)) %>% 
     arrange(desc (mean_injury))
colnames(injury2) <- c("evtype", "average")

###create data frame containing fatalities and injuries arranged in descending order
healthtab1 <- cbind("rank" = c(1:50), fatal1, fatal2, injury1, injury2)

3. Compute total health effects from each state

###total fatality by state
fatalst <- evstorm2 %>% 
     group_by(as.factor(statename)) %>% 
     summarise(totalf = sum(fatalities, na.rm = TRUE)) %>% 
     arrange(desc (totalf))
colnames(fatalst) <- c("state", "fatalities")

###total injuries by state
injuryst <- evstorm2 %>% 
     group_by(as.factor(statename)) %>% 
     summarise(totali = sum(injuries, na.rm = TRUE)) %>% 
     arrange(desc (totali))
colnames(injuryst) <- c("state", "injuries")

###create data frame wih fatalities and injuries arranged in decreasing number of incidence reported
healthtab2 <- cbind("rank" = c(1:70), fatalst, injuryst)

4. Compute total and mean economic effects

###total property loss for each event
prop1 <- evstorm2 %>% 
     group_by(as.factor(evtype2a)) %>% 
     summarise(total_property = sum(propdmg3, na.rm = TRUE)) %>% 
     arrange(desc (total_property))
colnames(prop1) <- c("evtype", "total")

###mean property loss
prop2 <- evstorm2 %>% 
     group_by(as.factor(evtype2a)) %>% 
     summarise(mean_property = mean(propdmg3, na.rm = TRUE)) %>% 
     arrange(desc (mean_property))
colnames(prop2) <- c("evtype", "average")

### total crop loss
crop1 <- evstorm2 %>% 
     group_by(as.factor(evtype2a)) %>% 
     summarise(total_crop = sum(cropdmg3, na.rm = TRUE)) %>% 
     arrange(desc (total_crop))
colnames(crop1) <- c("evtype", "total")

###mean crop loss
crop2 <- evstorm2 %>% 
     group_by(as.factor(evtype2a)) %>% 
     summarise(total_crop = mean(cropdmg3, na.rm = TRUE)) %>% 
     arrange(desc (total_crop))
colnames(crop2) <- c("evtype", "average")

###data frame containing property and crop losses arranged in descending order
econ1 <- cbind("rank" = c(1:50), prop1, prop2, crop1, crop2)

5. Compute total economic effects for each state

###total property loss reported by each state
{propst <- evstorm2 %>% 
     group_by(as.factor(statename)) %>% 
     summarise(totalp = sum(propdmg3, na.rm = TRUE)) %>% 
     arrange(desc (totalp))
colnames(propst) <- c("state", "propdmg")

###total crop loss reported by each state
cropst <- evstorm2 %>% 
     group_by(as.factor(statename)) %>% 
     summarise(totalc = sum(cropdmg3, na.rm = TRUE)) %>% 
     arrange(desc (totalc))
colnames(cropst) <- c("state", "cropdmg")

###data frame with property and crop loss in descending order by state
econ2 <- cbind("rank" = c(1:70), propst, cropst)
}

6. Compute frequency of events

7. Frequency of highest impact events

#==PREVIOUS - create function to count events for each year

###frequency of events reported per year
{evfl <- ev1("flood")
evtor <- ev1("tornado")
evdr <- ev1("drought")
eveh <- ev1("excessive_heat")
evsst <- ev1("storm_surge_tide")
evht <- ev1("hurricane_typhoon")
evts <- ev1("tsunami")
}

###arrange high impact events into groups based on magnitude
{evgrp1 <- rbind(evfl, evtor)
evgrp2 <- rbind(evdr, eveh)
evgrp3 <- rbind(evsst, evht, evts)

rm(evfl, evtor, evdr, eveh, evsst, evht, evts)
}

###end of step7 frequency of high impact events

III.B Tables summarizing health and economic costs

1. Table 4: Total and mean fatalities and injuries for each event type

### Computations from Part III.A.2
healthtab1a
Table 4: Fatalities and injuries from event types. Total and average fatalities and injuries were computed for each event type.
Total Fatalities
Ave Fatalities
Total Injuries
Ave Injuries
rank evtype total evtype average evtype total evtype average
1 excessive_heat 1799 tsunami 1.6500000 tornado 20667 tsunami 6.4500000
2 tornado 1511 excessive_heat 1.0495916 flood 6838 hurricane_typhoon 4.9003690
3 flash_flood 887 rip_current 0.7384196 excessive_heat 6394 excessive_heat 3.7304551
4 lightning 651 avalanche 0.5883905 thunderstorm_wind 5168 heat 1.7868852
5 rip_current 542 hurricane_typhoon 0.4612546 lightning 4141 tornado 0.8924731
6 flood 444 marine_strong_wind 0.4000000 flash_flood 1674 dust_storm 0.8909953
7 thunderstorm_wind 384 heat 0.3237705 winter_storm 1489 rip_current 0.6852861
8 heat 237 cold_wind_chill 0.2158120 wildfire 1458 freezing_fog 0.6363636
9 high_wind 235 noted 0.1463415 hurricane_typhoon 1328 sleet 0.6288089
10 avalanche 223 high_surf 0.1347905 heat 1308 marine_strong_wind 0.5400000
11 cold_wind_chill 202 extreme_cold_wind_chill 0.1245166 high_wind 1094 tropical_storm 0.4949054
12 winter_storm 200 tropical_storm 0.0873362 dense_fog 799 dense_fog 0.4730610
13 extreme_cold_wind_chill 161 debris_flow 0.0692432 hail 726 avalanche 0.4116095
14 high_surf 148 tornado 0.0652502 heavy_snow 701 wildfire 0.3489708
15 strong_wind 129 lightning 0.0492771 rip_current 503 lightning 0.3134509
16 hurricane_typhoon 125 freezing_fog 0.0454545 winter_weather 485 dust_devil 0.2925170
17 heavy_snow 108 ice_storm 0.0435938 blizzard 388 flood 0.2460332
18 heavy_rain 97 dense_fog 0.0384843 dust_storm 376 high_surf 0.2222222
19 wildfire 87 strong_wind 0.0314021 strong_wind 373 noted 0.1707317
20 ice_storm 82 sleet 0.0277008 tropical_storm 340 ice_storm 0.1690590
21 blizzard 70 blizzard 0.0265453 ice_storm 318 blizzard 0.1471369
22 winter_weather 69 dust_storm 0.0260664 high_surf 244 winter_storm 0.1228649
23 dense_fog 65 storm_surge_tide 0.0217391 heavy_rain 234 strong_wind 0.0907984
24 tropical_storm 60 wildfire 0.0208234 sleet 227 debris_flow 0.0885668
25 debris_flow 43 dust_devil 0.0204082 avalanche 156 storm_surge_tide 0.0679348
26 frost_freeze 35 frost_freeze 0.0197517 tsunami 129 winter_weather 0.0596850
27 tsunami 33 flash_flood 0.0173867 frost_freeze 64 high_wind 0.0547383
28 marine_thunderstorm_wind 21 winter_storm 0.0165030 freezing_fog 56 heavy_snow 0.0494987
29 marine_strong_wind 20 flood 0.0159752 debris_flow 55 frost_freeze 0.0361174
30 storm_surge_tide 16 high_wind 0.0117582 storm_surge_tide 50 extreme_cold_wind_chill 0.0332560
31 dust_storm 11 winter_weather 0.0084913 dust_devil 43 flash_flood 0.0328132
32 sleet 10 heavy_rain 0.0083405 extreme_cold_wind_chill 43 cold_wind_chill 0.0299145
33 hail 7 coastal_flood 0.0077519 marine_thunderstorm_wind 34 thunderstorm_wind 0.0244447
34 noted 6 heavy_snow 0.0076260 cold_wind_chill 28 heavy_rain 0.0201204
35 coastal_flood 4 marine_high_wind 0.0074074 marine_strong_wind 27 marine_high_wind 0.0074074
36 freezing_fog 4 thunderstorm_wind 0.0018163 noted 7 coastal_flood 0.0038760
37 dust_devil 3 marine_thunderstorm_wind 0.0017516 drought 4 hail 0.0034927
38 waterspout 2 waterspout 0.0005896 coastal_flood 2 marine_thunderstorm_wind 0.0028359
39 marine_high_wind 1 hail 0.0000337 waterspout 2 drought 0.0015637
40 astronomical_low_tide 0 astronomical_low_tide 0.0000000 funnel_cloud 1 waterspout 0.0005896
41 dense_smoke 0 dense_smoke 0.0000000 marine_high_wind 1 funnel_cloud 0.0001648
42 drought 0 drought 0.0000000 astronomical_low_tide 0 astronomical_low_tide 0.0000000
43 funnel_cloud 0 funnel_cloud 0.0000000 dense_smoke 0 dense_smoke 0.0000000
44 lake_effect_snow 0 lake_effect_snow 0.0000000 lake_effect_snow 0 lake_effect_snow 0.0000000
45 lakeshore_flood 0 lakeshore_flood 0.0000000 lakeshore_flood 0 lakeshore_flood 0.0000000
46 marine_hail 0 marine_hail 0.0000000 marine_hail 0 marine_hail 0.0000000
47 noted_temp 0 noted_temp 0.0000000 noted_temp 0 noted_temp 0.0000000
48 seiche 0 seiche 0.0000000 seiche 0 seiche 0.0000000
49 tropical_depression 0 tropical_depression 0.0000000 tropical_depression 0 tropical_depression 0.0000000
50 volcanic_ash 0 volcanic_ash 0.0000000 volcanic_ash 0 volcanic_ash 0.0000000

2. Table 5: Total reported fatalities and injuries from each state or area

### Computations from Part III.A.3

healthtab2a
Table 5: Total fatalities and injuries from each state, territory or area in descending order.
Total Fatalities
Total Injuries
rank state fatalities state injuries
1 Texas 756 Texas 9222
2 Illinois 586 Missouri 5960
3 Florida 544 Alabama 3707
4 Missouri 533 Florida 2884
5 California 498 California 2769
6 Pennsylvania 492 Tennessee 2385
7 Alabama 449 Oklahoma 2375
8 Tennessee 327 Georgia 1666
9 New_York 268 Arkansas 1656
10 North_Carolina 263 Pennsylvania 1450
11 Arkansas 228 North_Carolina 1378
12 Oklahoma 219 Illinois 1328
13 Arizona 175 Maryland 1293
14 Georgia 160 Mississippi 1217
15 Mississippi 160 Michigan 1195
16 Ohio 158 Iowa 984
17 Colorado 147 Utah 979
18 New_Jersey 147 New_Jersey 936
19 Louisiana 144 New_York 908
20 Maryland 141 Virginia 902
21 Kansas 140 Ohio 895
22 Indiana 133 Kentucky 850
23 South_Carolina 131 Kansas 845
24 Utah 130 Indiana 835
25 Washington 119 Louisiana 812
26 Kentucky 117 Wisconsin 806
27 Virginia 114 Massachusetts 687
28 Puerto_Rico 111 Colorado 662
29 Michigan 110 Arizona 635
30 Wisconsin 110 South_Carolina 559
31 Nevada 89 Minnesota 513
32 Guam 81 South_Dakota 473
33 Minnesota 72 Guam 416
34 Oregon 72 District_of_Columbia 369
35 West_Virginia 67 Nebraska 350
36 Alaska 62 Wyoming 309
37 Iowa 61 North_Dakota 265
38 New_Mexico 61 Washington 258
39 Montana 52 Delaware 255
40 Wyoming 52 Nevada 205
41 Idaho 42 Oregon 201
42 Nebraska 42 Idaho 173
43 American_Samoa 41 Connecticut 172
44 North_Dakota 41 New_Mexico 168
45 South_Dakota 36 American_Samoa 164
46 Connecticut 35 Montana 150
47 Massachusetts 34 New_Hampshire 139
48 Hawaii 33 Maine 130
49 Delaware 24 West_Virginia 124
50 New_Hampshire 24 Alaska 104
51 Maine 22 Hawaii 81
52 Vermont 19 Puerto_Rico 50
53 District_of_Columbia 13 Vermont 41
54 Marine_North_Atlantic 12 Marine_AM 30
55 Marine_AM 10 Rhode_Island 25
56 US_Virgin_Islands 7 Marine_North_Atlantic 23
57 Rhode_Island 6 US_Mainland_Pacific_Coastal_Water 3
58 US_Mainland_Pacific_Coastal_Water 5 Lake_Michigan 2
59 Lake_Michigan 4 US_Virgin_Islands 2
60 Gulf_of_Mexico 1 Gulf_of_Mexico 0
61 Lake_Superior 1 Lake_Erie 0
62 Pacific_Hawaiian_Water 1 Lake_Huron 0
63 Lake_Erie 0 Lake_Ontario 0
64 Lake_Huron 0 Lake_Superior 0
65 Lake_Ontario 0 Marine_Pacific_Micronesia_Guam 0
66 Marine_Pacific_Micronesia_Guam 0 Marine_XX 0
67 Marine_XX 0 Pacific_Coastal_Water_Alaska 0
68 Pacific_Coastal_Water_Alaska 0 Pacific_Hawaiian_Water 0
69 St_Clair_Lake_River 0 St_Clair_Lake_River 0
70 St_Lawrence 0 St_Lawrence 0

3. Table 6: Total and average property and crop damage from each event type

### Computations from Part III.A.4

econtab1
Table 6: Property and crop damage from storm event types (USD). Total damage is the sum of damage costs for all years, average damage is the average cost for each event type. Costs were adjusted to 2011 USD values (Section II.D.3).
Total Property Damage
Ave Property Damage
Total Crop Damange
Ave Crop Damage
rank evtype total evtype average evtype total evtype average
1 flood 1.630766e+11 hurricane_typhoon 3.569090e+08 drought 16892647620 hurricane_typhoon 2.468352e+07
2 hurricane_typhoon 9.672234e+10 storm_surge_tide 7.465757e+07 hurricane_typhoon 6689235052 drought 6.603850e+06
3 storm_surge_tide 5.494797e+10 tropical_storm 1.394415e+07 flood 5794360164 frost_freeze 1.713242e+06
4 tornado 2.787676e+10 tsunami 7.461276e+06 frost_freeze 3035864130 tropical_storm 1.205818e+06
5 flash_flood 1.807705e+10 flood 5.867542e+06 hail 3029990426 cold_wind_chill 3.790679e+05
6 hail 1.712294e+10 ice_storm 2.416178e+06 flash_flood 1567563101 excessive_heat 3.217564e+05
7 tropical_storm 9.579630e+09 wildfire 2.244772e+06 thunderstorm_wind 1230607354 flood 2.084827e+05
8 thunderstorm_wind 9.434343e+09 tornado 1.203816e+06 heavy_rain 929377794 wildfire 1.146291e+05
9 wildfire 9.378659e+09 debris_flow 5.845844e+05 tropical_storm 828396800 heavy_rain 7.991211e+04
10 high_wind 6.155846e+09 drought 5.072944e+05 high_wind 771950561 high_wind 3.862457e+04
11 ice_storm 4.544830e+09 flash_flood 3.543407e+05 excessive_heat 551490440 debris_flow 3.609823e+04
12 winter_storm 1.728469e+09 lakeshore_flood 3.279957e+05 wildfire 478920586 flash_flood 3.072689e+04
13 drought 1.297659e+09 high_wind 3.080079e+05 cold_wind_chill 354807550 strong_wind 1.815263e+04
14 lightning 8.759285e+08 blizzard 2.696731e+05 tornado 328938741 extreme_cold_wind_chill 1.608739e+04
15 heavy_snow 8.284926e+08 coastal_flood 1.768721e+05 heavy_snow 99498598 hail 1.457672e+04
16 blizzard 7.111281e+08 winter_storm 1.426247e+05 strong_wind 74570990 tornado 1.420472e+04
17 heavy_rain 6.958139e+08 high_surf 1.122570e+05 debris_flow 22417000 ice_storm 1.089280e+04
18 debris_flow 3.630269e+08 hail 8.237527e+04 extreme_cold_wind_chill 20801000 dust_storm 8.157583e+03
19 strong_wind 2.054810e+08 lake_effect_snow 6.638153e+04 ice_storm 20489350 heavy_snow 7.025745e+03
20 tsunami 1.492255e+08 lightning 6.630297e+04 winter_storm 16607800 thunderstorm_wind 5.820786e+03
21 high_surf 1.232581e+08 seiche 6.113333e+04 winter_weather 15450000 blizzard 3.748199e+03
22 coastal_flood 9.126601e+07 heavy_rain 5.982923e+04 blizzard 9884000 high_surf 1.953552e+03
23 lake_effect_snow 4.387819e+07 heavy_snow 5.850110e+04 lightning 8925409 winter_weather 1.901304e+03
24 frost_freeze 3.640585e+07 strong_wind 5.001973e+04 dust_storm 3442500 winter_storm 1.370394e+03
25 winter_weather 3.174551e+07 thunderstorm_wind 4.462455e+04 high_surf 2145000 storm_surge_tide 1.222351e+03
26 dense_fog 2.531088e+07 freezing_fog 3.198420e+04 storm_surge_tide 899650 tsunami 1.050000e+03
27 extreme_cold_wind_chill 1.642762e+07 tropical_depression 3.140417e+04 heat 188680 lightning 6.756044e+02
28 cold_wind_chill 1.086509e+07 volcanic_ash 2.116667e+04 marine_thunderstorm_wind 50000 heat 2.577596e+02
29 excessive_heat 9.360000e+06 frost_freeze 2.054506e+04 tsunami 21000 marine_thunderstorm_wind 4.170490e+00
30 marine_thunderstorm_wind 8.246428e+06 dust_storm 1.519427e+04 astronomical_low_tide 0 astronomical_low_tide 0.000000e+00
31 lakeshore_flood 7.543900e+06 dense_fog 1.498572e+04 avalanche 0 avalanche 0.000000e+00
32 dust_storm 6.411980e+06 extreme_cold_wind_chill 1.270504e+04 coastal_flood 0 coastal_flood 0.000000e+00
33 waterspout 5.919830e+06 cold_wind_chill 1.160800e+04 dense_fog 0 dense_fog 0.000000e+00
34 avalanche 4.270529e+06 avalanche 1.126789e+04 dense_smoke 0 dense_smoke 0.000000e+00
35 freezing_fog 2.814610e+06 marine_high_wind 9.796891e+03 dust_devil 0 dust_devil 0.000000e+00
36 tropical_depression 1.884250e+06 marine_strong_wind 8.457478e+03 freezing_fog 0 freezing_fog 0.000000e+00
37 sleet 1.819060e+06 excessive_heat 5.460910e+03 funnel_cloud 0 funnel_cloud 0.000000e+00
38 heat 1.596700e+06 dust_devil 5.299963e+03 lake_effect_snow 0 lake_effect_snow 0.000000e+00
39 marine_high_wind 1.322580e+06 dense_smoke 5.190476e+03 lakeshore_flood 0 lakeshore_flood 0.000000e+00
40 seiche 1.283800e+06 sleet 5.038947e+03 marine_hail 0 marine_hail 0.000000e+00
41 dust_devil 7.790945e+05 winter_weather 3.906659e+03 marine_high_wind 0 marine_high_wind 0.000000e+00
42 volcanic_ash 6.350000e+05 heat 2.181284e+03 marine_strong_wind 0 marine_strong_wind 0.000000e+00
43 marine_strong_wind 4.228739e+05 waterspout 1.745233e+03 noted 0 noted 0.000000e+00
44 rip_current 2.049500e+05 noted 1.743902e+03 noted_temp 0 noted_temp 0.000000e+00
45 funnel_cloud 1.581000e+05 marine_thunderstorm_wind 6.878328e+02 rip_current 0 rip_current 0.000000e+00
46 dense_smoke 1.090000e+05 rip_current 2.792234e+02 seiche 0 seiche 0.000000e+00
47 noted 7.150000e+04 funnel_cloud 2.605471e+01 sleet 0 sleet 0.000000e+00
48 marine_hail 4.200000e+03 marine_hail 9.502262e+00 tropical_depression 0 tropical_depression 0.000000e+00
49 astronomical_low_tide 0.000000e+00 astronomical_low_tide 0.000000e+00 volcanic_ash 0 volcanic_ash 0.000000e+00
50 noted_temp 0.000000e+00 noted_temp 0.000000e+00 waterspout 0 waterspout 0.000000e+00

4. Table 7: Total property and crop damage in each state or area

### Computation from Part III.A.5

econtab2
Table 7: Property and crop damage from each state, territory, or area (USD). Total damage is the sum of damage costs for all years and all events for each state. Costs were adjusted to 2011 USD values (Section II.D.3)
Total Property Damage
Total Crop Damange
rank state propdmg state cropdmg
1 California 137457535654 Texas 9002744028
2 Louisiana 64863799967 Florida 4453415927
3 Florida 42137183007 Iowa 4272988786
4 Mississippi 32924642692 California 3639092560
5 Texas 24384820264 North_Carolina 2671000281
6 Alabama 11908174713 Nebraska 2071681250
7 North_Carolina 9360264990 Mississippi 1843386858
8 North_Dakota 6939932387 Louisiana 1453810760
9 Tennessee 6393465119 Oklahoma 1448384525
10 Missouri 6235591398 Wisconsin 1134802691
11 Ohio 5450066907 Georgia 1101644234
12 Minnesota 5444237844 Indiana 946063240
13 Oklahoma 4466583943 Puerto_Rico 829043540
14 New_York 4454791962 Missouri 790146415
15 Arizona 3865129558 Pennsylvania 785757675
16 Arkansas 3797522339 Washington 672718600
17 Iowa 3657919321 Virginia 625652490
18 Pennsylvania 3529756652 Kansas 579561325
19 New_Jersey 3513164533 Illinois 577580388
20 Puerto_Rico 3033943128 North_Dakota 538996330
21 Wisconsin 2960065365 Ohio 468921525
22 Colorado 2953362887 Kentucky 367440150
23 Kentucky 2775552738 Michigan 300898300
24 Georgia 2559354659 Minnesota 300889934
25 Kansas 2426141237 Arizona 284660940
26 New_Mexico 2304687689 New_York 191084500
27 Illinois 2202689400 Colorado 183221415
28 Virginia 2095978909 Arkansas 172927503
29 Indiana 2051277233 Alabama 153970693
30 Nebraska 2032245577 Maryland 145103360
31 Michigan 1857022506 Guam 133887800
32 Vermont 1487445203 New_Jersey 128676000
33 Maryland 1343979696 South_Dakota 108094490
34 Guam 1208157130 South_Carolina 76825180
35 Oregon 1185605269 Oregon 63738475
36 West_Virginia 1104688662 Montana 53127140
37 Nevada 1059503185 West_Virginia 47355433
38 Massachusetts 1034207330 Delaware 39811000
39 Washington 841245291 New_Mexico 35909190
40 Utah 819745516 Vermont 27920250
41 Maine 643511600 Tennessee 23677060
42 South_Carolina 557066439 Hawaii 10026788
43 South_Dakota 461871631 Idaho 9369130
44 Alaska 321079450 Utah 5070842
45 Montana 292112955 Wyoming 3938596
46 Hawaii 235255868 American_Samoa 1864570
47 New_Hampshire 226344828 Massachusetts 1381180
48 Idaho 226312913 Nevada 278800
49 American_Samoa 223453330 US_Virgin_Islands 255450
50 District_of_Columbia 193278612 New_Hampshire 230000
51 Wyoming 191999808 Alaska 228250
52 Connecticut 176262303 Maine 191050
53 Delaware 152124584 Marine_AM 50000
54 Rhode_Island 119101080 Connecticut 37500
55 US_Virgin_Islands 51057790 District_of_Columbia 6900
56 Marine_AM 5714300 Gulf_of_Mexico 0
57 Gulf_of_Mexico 4321867 Lake_Erie 0
58 Lake_Michigan 2835455 Lake_Huron 0
59 Lake_Superior 448000 Lake_Michigan 0
60 Marine_North_Atlantic 315660 Lake_Ontario 0
61 Lake_Ontario 84300 Lake_Superior 0
62 US_Mainland_Pacific_Coastal_Water 78970 Marine_North_Atlantic 0
63 Pacific_Coastal_Water_Alaska 35350 Marine_Pacific_Micronesia_Guam 0
64 Lake_Erie 32350 Marine_XX 0
65 St_Lawrence 18750 Pacific_Coastal_Water_Alaska 0
66 Lake_Huron 0 Pacific_Hawaiian_Water 0
67 Marine_Pacific_Micronesia_Guam 0 Rhode_Island 0
68 Marine_XX 0 St_Clair_Lake_River 0
69 Pacific_Hawaiian_Water 0 St_Lawrence 0
70 St_Clair_Lake_River 0 US_Mainland_Pacific_Coastal_Water 0

5. Table 8: Number of each event reported

### Computation from Part III.A.6

evnumstab2
Table 8: Number of observed incidences for each event. The event column contains the event name corresponding to one of the 48 prescribed or two noted events, and the num_observations column contains the number of reported observations for that event. The num_observations values are the same as those in Table 2 (II.C.52)
rank event num_observations
1 thunderstorm_wind 211416
2 hail 207865
3 flash_flood 51016
4 flood 27793
5 tornado 23157
6 high_wind 19986
7 heavy_snow 14162
8 lightning 13211
9 winter_storm 12119
10 marine_thunderstorm_wind 11989
11 heavy_rain 11630
12 winter_weather 8126
13 funnel_cloud 6068
14 wildfire 4178
15 strong_wind 4108
16 waterspout 3392
17 blizzard 2637
18 drought 2558
19 ice_storm 1881
20 frost_freeze 1772
21 excessive_heat 1714
22 dense_fog 1689
23 extreme_cold_wind_chill 1293
24 high_surf 1098
25 cold_wind_chill 936
26 storm_surge_tide 736
27 rip_current 734
28 heat 732
29 tropical_storm 687
30 lake_effect_snow 661
31 debris_flow 621
32 coastal_flood 516
33 marine_hail 442
34 dust_storm 422
35 avalanche 379
36 noted_temp 372
37 sleet 361
38 hurricane_typhoon 271
39 astronomical_low_tide 166
40 dust_devil 147
41 marine_high_wind 135
42 freezing_fog 88
43 tropical_depression 60
44 marine_strong_wind 50
45 noted 41
46 volcanic_ash 30
47 lakeshore_flood 23
48 dense_smoke 21
49 seiche 21
50 tsunami 20

III.C Create graphs summarizing health and economic effects.

  • graphs containing events with highest health and economic consequences

1. Figure 1 prepare: Health effects graphs

library(ggplot2)
baror <- geom_bar(stat = "identity", fill = "#999999", colour ="#336666")
bargr <- geom_bar(stat = "identity", fill = "#336666", colour ="#999999")

f1 <- ggplot(fatal1[1:15, ], aes(x = total/(10^3), y = reorder(evtype, total))) +
     theme_bw() +
     bargr +
     scale_x_continuous(breaks = seq(0, 1.8, 0.2)) +
     labs(subtitle = "a. Total Fatalities", x = "(*10^3) sum fatalities", y = "event")

f2 <- ggplot(fatal2[1:15, ], aes(x = average, y = reorder(evtype, average))) +
     theme_bw() +
     bargr +
      scale_x_continuous(breaks = seq(0, 1.75, 0.2)) +
     labs(subtitle = "b. Mean Fatalities", x = "mean fatalities", y = "event")

f3 <- ggplot(fatalst[1:15, ], aes(x = fatalities, y = reorder(state, fatalities))) +
     theme_bw() +
     baror +
     scale_x_continuous(breaks = seq(0, 800, 100)) +
     labs(subtitle = "c. Total Fatalities", x = "sum fatalities", y = "state")

i1 <-ggplot(injury1[1:15, ], aes(x = total/(10^3), y = reorder(evtype, total))) +
     theme_bw() +
     bargr +
     scale_x_continuous(breaks = seq(0, 22, 2)) +
     labs(subtitle = "d. Total Injuries", x = "(*10^3) sum injuries", y = "event")

i2 <-ggplot(injury2[1:15, ], aes(x = average, y= reorder(evtype, average))) +
     theme_bw() +
     bargr +
     scale_x_continuous(breaks = seq(0, 15, 1)) +
     labs(subtitle = "e. Mean Injuries", x = "mean injuries", y = "event")

i3 <- ggplot(injuryst[1:15, ], aes(x = injuries/(10^3), y = reorder(state, injuries))) +
     theme_bw() +
     baror +
      scale_x_continuous(breaks = seq(0, 10, 1)) +
     labs(subtitle = "f. Total Injuries", x = "(*10^3) sum injuries", y = "state")

library(gridExtra)
grid.arrange(f1, i1, f2, i2, f3, i3, ncol = 2, top = "Population Health Effects (1996-2011)")
###end of step1 health effects graphs

2. Figure 2 prepare: Economic effects graphs

p1 <- ggplot(prop1[1:15, ], aes(x = total/(10^9), y = reorder(evtype, total))) +
     theme_bw() +
     bargr +
     scale_x_continuous(breaks = seq(0, 175, 20)) +
     labs(subtitle = "a. Total Property Damage", x = "sum property damage (*10^9 USD)", y= "event")

p2 <- ggplot(prop2[1:15, ], aes(x = average/(10^6), y = reorder(evtype, average))) +
     theme_bw() +
     bargr +
     scale_x_continuous(breaks = seq(0, 1000, 50)) +
     labs(subtitle = "b. Average Property Damage", x = "Average property damage (*10^6 USD)", y = "event")

p3 <- ggplot(propst[1:15, ], aes(x = propdmg/(10^9), y = reorder(state, propdmg))) +
     theme_bw() +
     baror +
     scale_x_continuous(breaks = seq(0, 150, 20)) +
     labs(subtitle = "c. Property Damage by State", x = "sum property damage (*10^9 USD)", y = "state")

c1 <- ggplot(crop1[1:15, ], aes(x = total/ (10^9), y = reorder(evtype, total))) +
     theme_bw() +
     bargr +
     scale_x_continuous(breaks = seq(0, 19, 2)) +
     labs(subtitle = "d. Total Crop Damage", x = "sum crop damage (*10^9 USD)", y= "event")

c2 <- ggplot(crop2[1:15, ], aes(x = average/(10^6), y = reorder(evtype, average))) +
     theme_bw() +
     bargr +
     scale_x_continuous(breaks = seq(0, 26, 4)) +
     labs(subtitle = "e. Average Crop Damage", x = "average crop damage (*10^6 USD)", y = "event")

c3 <- ggplot(cropst[1:15, ], aes(x = cropdmg/(10^9), y = reorder(state, cropdmg))) +
     theme_bw() +
     baror +
     scale_x_continuous(breaks = seq(0, 10, 1)) +
     labs(subtitle = "f. Crop Damage by State", x = "sum crop damage (*10^9 USD)", y = "state")


grid.arrange(p1, c1, p2, c2, p3, c3, ncol = 2, top = "Economic Effects (1996-2011)")
###end of step2 economic effects graphs

3. Figure 3 prepare: Frequency of events graphs

#######Plot for most frequent events; computations in III.A.6

evtop15 <- ggplot(evnums[1:15, ], aes(x = num_observations/(10^3), y = reorder(event, num_observations))) +
     theme_bw() +
     bargr +
     scale_x_continuous(breaks = seq(0, 225, 25)) +
     labs(subtitle = "d. Top 15 Events Reported", x = "(*10^3) sum events", y = "event")

##==PREVIOUS - create function to plot reported events by year; computations in II.A.7


###plot event groups; see II.A.7 for computations
{pgrp1 <- evgr(evgrp1, "a. Flood and Tornado") +
     scale_y_continuous(breaks = seq(0, 3700, 500))

pgrp2 <- evgr(evgrp2, "c. Drought and Excessive Heat") +
     scale_y_continuous(breaks = seq(0, 400, 50))

pgrp3 <- evgr(evgrp3, "b. Hurricane Typhoon, Storm Surge Tide, Tsunami") +
     scale_y_continuous(breaks = seq(0, 85, 10))
}

grid.arrange(pgrp1, pgrp2, pgrp3, evtop15, ncol = 2, top = "Number of Reported High Impact Event Types (1996-2011)")
###end of step3 frequency reports graphs

IV. Results

IV.A Graphs of health and economic effects

1. Figure 1: Population health effects

  • See III.A.2, III.A.3, for computations, III.B.1 and III.B.2 for complete tables, and III.C.1 for preparation.

Excessive_heat, tornado, tsunami, flood, and hurricane_typhoon were found to have high total and mean fatalities, injuries (Figure 1 a, b, d, e). Moreover, excessive_heat was in the top three events with the highest total and mean fatalities and injuries. Tornadoes caused noticeably higher total injuries compared to other injury-related storm events. In terms of locations, the majority of states reporting the highest fatalities also reported the highest injuries, with the same 13 states reporting both the highest fatalities and injuries (Figure 1 c, f).

Figure 1: Fifteen events and states associated with the highest numbers of reported fatalities and injuries. Total fatalities and injuries are the sum for all observations for each event, averages are the mean of observations for each event (See III.A.2 and III.A.3 for computations). Full lists are shown in Tables 4 and 5.
Figure 1: Fifteen events and states associated with the highest numbers of reported fatalities and injuries. Total fatalities and injuries are the sum for all observations for each event, averages are the mean of observations for each event (See III.A.2 and III.A.3 for computations). Full lists are shown in Tables 4 and 5.

2. Figure 2: Economic effects

  • See III.A.4, III.A.5, for computations, III.B.3 and III.B.4 for complete tables, and III.C.2 for preparation.

Flood, hurricane_typhoon, storm_surge_tide, and drought had some of the highest total and mean property and crop damages (Figure 2 a, b, d, e). There was a 1.5 to 3.5 fold difference between the most damaging and the second most damaging event, which indicates the relative high impact of the most costly events. States that reported the highest property damages did not always report the highest crop damage, with overlaps for 8 states (Figure 2, c, f).

Figure 2: Fifteen events and states associated with the highest numbers of reported property and crop damage. Total damage is the sum of damage costs for all years, average damage is the average cost for each event type. Costs were adjusted to 2011 USD values (Section II.D.3). Computations are showin in sections III.A.4 and III.A.5. Full lists are shown in Tables 6 and 7
Figure 2: Fifteen events and states associated with the highest numbers of reported property and crop damage. Total damage is the sum of damage costs for all years, average damage is the average cost for each event type. Costs were adjusted to 2011 USD values (Section II.D.3). Computations are showin in sections III.A.4 and III.A.5. Full lists are shown in Tables 6 and 7

3. Figure 3: Reported incidences

  • See III.A.6, III.A.7, for computations, II.C.52 and III.B.5 for the complete tabulation of number of incidence reported, and III.C.3 for preparation.

The number of incidences reported per year for the top two events associated with the highest total and mean public health and economic effects are displayed in Figure 3. Of the seven high impact events, flood and tornado had also some of the highest incidence rates (Figure 3 a, d). Thunderstorm_wind and hail, which had the highest incidence numbers also had high cumulative population health and economic impacts, being among the 15 events with the highest total fatalities and injuries. In contrast tsunami, which had the highest mean fatalities and injuries (Figure 1), had the lowest reported incidence number of the 50 event classifications (Table 7). Among the seven high impact events in Figure 3, there is a trend of increasing number of incidences reported for flood and drought.

Figure 3: Number of reported incidences for events associated with the two highest public health and economic impacts from Figures 1 and 2 (See Table 8 for full list), and the 15 events with highest numbers of reported incidences. Computations are shown in Section III.A.6 and III.A.7.
Figure 3: Number of reported incidences for events associated with the two highest public health and economic impacts from Figures 1 and 2 (See Table 8 for full list), and the 15 events with highest numbers of reported incidences. Computations are shown in Section III.A.6 and III.A.7.

IV.B Limitations

Proper sorting of the recorded event types into the 48 prescribed events + 2 notable groups is required to accurately determine relative impact of events. The sorting step (II.C) involved personal judgement, which requires a certain level of area-specific knowledge.

The values in the tables and graphs relied on the values in the fatalities, injuries, property damage (propdmg), and crop damage (cropdmg) columns. Additional checks were not done for these values. Incomplete values would result in less accurate tallies. Additional verification against the remarks may be necessary to improve accuracy of reported health and economic consequences. For example, a cursory search indicates that Hurricane Katrina resulted in over 1000 fatalities (https://en.wikipedia.org/wiki/Hurricane_Katrina). In contrast, the 190 incidences mentioning the phrase “Hurricane Katrina” in their remarks reported a total of 27 fatalities. Focusing on a subset of the data frame containing “Hurricane Katrina” in the remarks, reveals that fatality numbers of 1097 and 480 were mentioned in the remarks for Louisiana (refnum 577615). These numbers were not entered in the fatalities column, which has a value of zero. The issue is further complicated by remarks in unrelated events mentioning “Hurricane Katrina” (e.g. refnum 598473). Additional work would require better understanding of how each event is summarized, and the relationships between narratives of various incidences.

###create data frame for Hurricane Katrina
kat1 <- grep("Hurricane Katrina", evstorm2$remarks, ignore.case = TRUE)
kat1 <- evstorm2[kat1, ]
kat2 <- kat1[grep("death|fatal|die|dead|passed away", kat1$remarks, ignore.case = TRUE), ]

###Search remarks of Louisiana incident
hurkat1 <- kat2[kat2$refnum == 577615, c("remarks")] # Louisiana
hurkat2 <- unlist(strsplit(hurkat1, c("(\\.)", "(\\?)")))

####summary
paste(nrow(kat1), "incidences reported containing the phrase: Hurricane Katrina")
## [1] "190 incidences reported containing the phrase: Hurricane Katrina"
paste(sum(kat1$fatalities), "total fatalities")
## [1] "27 total fatalities"
paste(length(grep("death|fatal|die|dead|passed away", kat1$remarks, ignore.case = TRUE)), "incidences mentioning deaths")
## [1] "15 incidences mentioning deaths"
###return sentences mentioning fatalities
grep("death|fatal|die|dead|passed away", hurkat2, ignore.case = TRUE, value = TRUE)
## [1] " Fatalities occurring in Louisiana as a result of Hurricane Katrina numbered approximately 1097 people as of late June 2006" 
## [2] " 480 other Louisiana residents died in other states after evacuating"                                                        
## [3] " Detailed information on the deaths, locations, and indirect or direct fatalities will be described in updates to Storm Data"
###fatalities and injuries column content
kat2[kat2$refnum == 577615, c("statename", "refnum", "fatalities", "injuries")]
##        statename refnum fatalities injuries
## 577675 Louisiana 577615          0        0