## Not run:
# ## Retrieve Bessie station MTS files for 00:00 Jun 01, 1997
# ## through 23:55 Oct 31, 1997
# bess.mts <- okmts(begintime="1997-06-01 00:00:00",
# endtime="1997-10-31 23:55", station="bess")
#
# ## Use POSIXct class to retrieve Medicine Park station air
# ## temperature for 09:30 through 20:30 Aug 12, 2004
# ## Set times, using 'America/Chicago' for Oklahoma time zone
# medi.time <- c(as.POSIXct("2004-08-12 09:30", tz="America/Chicago"),
# as.POSIXct("2004-08-12 20:30", tz="America/Chicago"))
# medi.mts <- okmts(begintime=medi.time[1], endtime=medi.time[2],
# station="medi", variables=c("TAIR", "RELH"))
#
# ## Download all data for 2001 for station closest to
# ## 36.575284 latitude, -99.478455 longitude, using multiple cores
# stn.mts <- okmts(begintime="2001-01-01 00:00:00",
# endtime="2001-12-31 23:55:00", lat=36.575284, lon=-99.478455, mcores=T)
#
# ## Retrieve Idabel station MTS data for 00:00 through 12:00 UTC (GMT)
# ## Nov 23, 2003
# ## Time values are returned in UTC
# idab.mts <- okmts(begintime="2003-11-23 00:00:00",
# endtime="2003-11-23 12:00:00", station="idab", localtime=F)
#
# ## Combine air temperature with bison movement data.
# ## Retrieve Foraker station MTS files for 00:00 Jan 31, 2011
# ## through 15:00 Feb 05, 2011
# fora.mts <- okmts(begintime="2011-01-31 00:00:00",
# endtime="2011-02-05 15:00:00", station="fora")
# ## Round bison timestamp down to five minute mark
# bison$newtime <- round(bison$timestamp, "min")
# bison$newtime$min <- as.integer(format(bison$newtime, "%M")) %/% 5 * 5
# bison$newtime <- as.POSIXct(bison$newtime)
# ## Add Foraker station air temperature to bison data
# bison$TAIR <- fora.mts$TAIR[match(bison$newtime, fora.mts$TIME)]
# ## End(Not run)
Run the code above in your browser using DataLab