Local Weather Data

Author

Nathan Craig

Published

July 18, 2023

Abstract

Read local weather data with a longer term aim towards correlating these data with environmental data logged inside the museum.

Local Temperature

First call the necessary libraries.

# Knitr options
knitr::opts_chunk$set(
  echo = FALSE,
  message = FALSE,
  warning = FALSE
  )


library(dplyr)
library(riem)
library(xts)
library(dygraphs)

Then request data and evaluate results (Table 1).

Table 1:

The first rows of station LRU

ABCDEFGHIJ0123456789
station
<chr>
valid
<dttm>
lon
<dbl>
lat
<dbl>
tmpf
<dbl>
dwpf
<dbl>
relh
<dbl>
drct
<dbl>
sknt
<dbl>
LRU2020-01-01 00:15:00-106.92232.289444.814.729.303504
LRU2020-01-01 00:35:00-106.92232.289441.714.032.003404
LRU2020-01-01 00:55:00-106.92232.289439.614.034.723305
LRU2020-01-01 01:15:00-106.92232.289436.914.038.593406
LRU2020-01-01 01:35:00-106.92232.289438.114.938.293407
LRU2020-01-01 01:55:00-106.92232.289437.015.340.693406

To use the dygraphs library, convert the data to a time series. Here, I use xts to create time series objects for temperature and relative humidity which are variables recorded inside at the museum. Then we take the two time series and cbind them into a single object.

This is then displayed by calling the dygraph function and applying minimal styling arguments.

Temperature
RH
0
10
20
30
40
50
60
70
80
90
100
110
Jul 2020
Jan 2021
Jul 2021
Jan 2022
Jul 2022
Jan 2023
Jul 2023
Figure 1: Graph showing temperature and relative humidity for the LRU

Logged Data

Temperature
RH
20
30
40
50
60
70
80
Apr 2021
Jul 2021
Oct 2021
Jan 2022
Apr 2022
     [,1] [,2]
                    las_cruces_temperature ts_list.base_temp
2020-01-01 00:15:00                   44.8                NA
2020-01-01 00:35:00                   41.7                NA
2020-01-01 00:55:00                   39.6                NA
2020-01-01 01:15:00                   36.9                NA
2020-01-01 01:35:00                   38.1                NA
2020-01-01 01:55:00                   37.0                NA

Citation

BibTeX citation:
@online{craig2023,
  author = {Craig, Nathan},
  title = {Local {Weather} {Data}},
  date = {2023-07-18},
  url = {https://um-environment.netlify.app/projects/2023-07-18-local-weather},
  langid = {en},
  abstract = {Read local weather data with a longer term aim towards
    correlating these data with environmental data logged inside the
    museum.}
}
For attribution, please cite this work as:
Craig, Nathan. 2023. “Local Weather Data.” July 18, 2023. https://um-environment.netlify.app/projects/2023-07-18-local-weather.