Chapter 10 USCRN
10.1 How to use USCRN
Go to this site.
Click on FTP Client Access under either Monthly, Daily, Hourly, or Sub-hourly depending on your preference.
Download the HEADERS.txt file by clicking on it. Optionally download README.txt file, which provides a guide to interpreting each column in the dataset.
Click the year of the data you want and select the station of interest, which will automatically download the data.
10.2 Code example
Getting surface temperatures in Spokane, WA for July, 2017
From the web page, click FTP Client Access under sub-hourly, download HEADERS.txt, and hit 2017 to download CRNS0101-05-2017-WA_Spokane_17_SSW.txt.
fulldf <- read.delim(PATH_TO_FILE)
headers <- read.delim("HEADERS.txt", sep = "", header = T, skip = 1)
colnames(fulldf) <- colnames(headers)
time <- paste0(floor(fulldf$LST_TIME / 100), ":", fulldf$LST_TIME %% 100)
df <- data.frame("Date" = as.POSIXct(paste(fulldf$LST_DATE, time), format = "%Y%m%d %H:%M"),
"Data" = fulldf[, "SURFACE_TEMPERATURE"]) %>% na.omit()
df <- df[df$Date >= as.Date(paste0("2017-07-01")) &
df$Date <= as.Date(paste0("2017-07-31")), ]