Skip to content

Instantly share code, notes, and snippets.

@actuaryactually
Last active February 22, 2017 16:18
Show Gist options
  • Save actuaryactually/295fac55233eb8b72df3f87de0db8249 to your computer and use it in GitHub Desktop.
Save actuaryactually/295fac55233eb8b72df3f87de0db8249 to your computer and use it in GitHub Desktop.
Quake Visualisations
#PRELIMINARIES:
pacman::p_load(data.table)
mydat1 <- fread('http://quakesearch.geonet.org.nz/csv?region=wellington&minmag=1&startdate=2014-05-01&enddate=2017-1-30T17:00:00')
head(mydat)
#the following site contains historic earthquake data for New Zealand: http://quakesearch.geonet.org.nz/
#Using the build query option on this page, we can look-up quakes in specific regions and time frames.
#Let's look up Wellington's seismic profile since 1 Jan 2011
#three links are indicated, each covering a non overlapping date ranges:
url1 <- 'http://quakesearch.geonet.org.nz/csv?region=wellington&minmag=1&startdate=2014-05-01&enddate=2017-1-30T17:00:00'
url2 <- 'http://quakesearch.geonet.org.nz/csv?region=wellington&minmag=1&startdate=2011-07-01&enddate=2014-05-01'
url3 <- 'http://quakesearch.geonet.org.nz/csv?region=wellington&minmag=1&startdate=2011-01-01T16:00:00&enddate=2011-07-01'
mydat1 <- fread(url1)
mydat2 <- fread(url2)
mydat3 <- fread(url3)
mydat <- rbind(mydat1,mydat2,mydat3)
#review download then tidy up:
head(mydat)
rm(mydat1,mydat2,mydat3)
colnames(mydat)[5] <- "long"
colnames(mydat)[6] <- "lat"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment