forked from EcoForecast/SURGE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpull_hist_tide.R
25 lines (18 loc) · 953 Bytes
/
pull_hist_tide.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
hist_tide_height = read.csv("~/SURGE/2014 tide height data/2014NHA.txt", sep="", skip="10")
hist_tideFormat<-as.numeric(levels(hist_tide_height$f)[hist_tide_height$f])
hist_surgeFormat<-as.numeric(levels(hist_tide_height$f2)[hist_tide_height$f2])
less.surge<-(hist_tideFormat+hist_surgeFormat)
hist_sorted_height<-hist_tide_height[order(hist_tide_height$yyyy.mm.dd),]
dates <- as.Date(hist_sorted_height$yyyy.mm.dd)
date1 <- as.Date("2014-03-01")
date2 <- as.Date("2014-04-30")
desired_rows <- which(dates >= date1 & dates <= date2)
height<-hist_sorted_height[desired_rows, ]
library(chron)
tod<-chron(times=hist_tide_height$hh.mi.ssf)
dtod<-paste(dates[desired_rows] , tod)
x<- strptime(dtod, format="%Y-%m-%d %H:%M:%S")[desired_rows]
hist_tide <-less.surge[desired_rows]
jpeg(file="~/SURGE/web/Historical_Tide_Height.jpg")
plot(x,hist_tide, ylab="Historical Tide Height (m)", xlab="Date", main="Historical Tide Height in Newport,UK")
dev.off()