This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Important note: I'm no longer maintaining this gist, since this code is incorporated into the | |
### VulnToolkit package. | |
### Because it's not being maintained, the code below might not work. The latest, updated version | |
### of the NOAA scraper is available at https://github.com/troyhill/VulnToolkit/blob/master/R/noaa.r | |
### Function downloads and compiles tide data from NOAA CO-OPS website | |
### Requires RCurl and XML packages - install.packages("RCurl"); install.packages("XML") | |
### | |
### This version does not include a monthly time interval option |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Important note: I'm no longer maintaining this gist, since this code is incorporated into the | |
### VulnToolkit package. | |
### Because it's not being maintained, the code below might not work. The latest, updated version | |
### is available at https://github.com/troyhill/VulnToolkit/blob/master/R/HL.r | |
### Function to pick out high and low tides from a dataset of tidal water levels | |
### | |
### Arguments: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Important note: I'm no longer maintaining this gist, since this code is incorporated into the | |
### VulnToolkit package. | |
### Because it's not being maintained, the code below might not work. The latest, updated version | |
### is available at https://github.com/troyhill/VulnToolkit/blob/master/R/HL_plot.R | |
### Function to visually examine high and low tides found by function HL() | |
### Arguments are the same as for HL() | |
### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Important note: I'm no longer maintaining this gist, since this code is incorporated into the | |
### VulnToolkit package. | |
### Because it's not being maintained, the code below might not work. The latest, updated version | |
### is available at: | |
### https://github.com/troyhill/VulnToolkit/blob/master/R/number_tides.R | |
### function to number tides and insert tide numbers (for whole tidal cycles, flood, and ebb tides) | |
### in high-frequency dataset. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Important note: I'm no longer maintaining this gist, since this code is incorporated into the | |
### VulnToolkit package. | |
### Because it's not being maintained, the code below might not work. The latest, updated version | |
### is available at https://github.com/troyhill/VulnToolkit/blob/master/R/harcon.R | |
### Input argument is a single NOAA station number. See http://co-ops.nos.noaa.gov/stations.html?type=Water+Levels | |
### Output is a dataframe with a row for each harmonic constituent, and columns for | |
### each station's amplitude, phase, and speed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Important note: I'm no longer maintaining this gist, since this code is incorporated into the | |
### VulnToolkit package. | |
### Because it's not being maintained, the code below might not work. The latest, updated version | |
### is available at https://github.com/troyhill/VulnToolkit/blob/master/R/vuln_kit.R | |
### Code to transform tidal data to a set of resources to evaluate vulnerability to sea level rise | |
### | |
### Required arguments: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Important note: I'm no longer maintaining this gist, since this code is incorporated into the | |
### VulnToolkit package. | |
### Because it's not being maintained, the code below might not work. The latest, updated version | |
###is available at https://github.com/troyhill/VulnToolkit/blob/master/R/noaa_datums.R | |
### Input argument is a single NOAA station number. See http://co-ops.nos.noaa.gov/stations.html?type=Water+Levels | |
### Output is a dataframe with a row for each elevation datum listed for the station. | |
### Results are in meters and calculated over the 1983-2001 epoch. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### code to make decent-looking, simple panel graphics | |
profilePlot <- function(xdata = dated$OM.pct, ydata = dated$midpoint, siteList = dated$site, | |
xlabel = "Organic matter content (decimal fraction)", | |
ylabel = "depth (cm)", | |
rowNos = 4, colNos = 4, | |
xTiers = 1, | |
filename = "OM_profiles.png", | |
figylims = c(80, 0), | |
figxlims = c(0, 0.8) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install.packages("plyr") | |
library(plyr) | |
##### | |
# User inputs | |
# | |
# data should be the raw TopConLink output of the points tab from the "measurement" file | |
tsData <- read.delim("C:/RDATA/surveying/data_150526SWD.txt", header=TRUE, sep = "\t", na.strings=".") | |
# the TSObs dataset is needed to convert between total station orientations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NCDC_combine <- function(pdfFiles, pdfToText = "C:\\Program Files\\xpdfbin-win-3.04\\bin64\\pdftotext.exe") { | |
# get pdftotxt from ftp://ftp.foolabs.com/pub/xpdf/xpdfbin-win-3.04.zip | |
# get NCDC Local Climatological Data annual summary pdfs from https://www.ncdc.noaa.gov/IPS/lcd/lcd.html | |
combineWords <- function(input, terms = 9, n = 3, spacer = "_", spacerIn = " ") { | |
# function takes a vector of words with spaces (input), and returns some number of terms (terms), | |
# on the basis of combining sequences of n words | |
splitTerms <- strsplit(input, spacerIn)[[1]] # individual words | |
starts <- seq(from = 1, to = length(splitTerms), by = n) # start of new terms | |
for (i in 1:(length(starts))) { | |
tmpName <- paste(splitTerms[starts[i]:(starts[i] + n - 1)], collapse = spacer) |
OlderNewer