generated from jtr13/quarto-edav-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathch4.rmarkdown
128 lines (43 loc) · 2.67 KB
/
ch4.rmarkdown
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
title-block-banner: true
---
## Exercise #1
The U.S. Climate Reference Network (USCRN) is a systematic and sustained network of climate monitoring stations. USCRN has sites across Contiguous U.S. along with some in Alaska, and Hawaii. These stations are instrumented to measure meteorological information such as temperature, precipitation, wind speed, along with other relevant hydrologic variables such as soil moisture at uniform depths (5, 10, 20, 50, 100 cm) at sub-hourly, daily and monthly time scales. Users can access daily data set from all station suing the following link: [Index of /pub/data/uscrn/products/daily01 (noaa.gov)](https://www.ncei.noaa.gov/pub/data/uscrn/products/daily01/)
Let us extract sample data from a USCRN site in Lafayette, LA, USA for 2021.
```{r}
#| label: import data
#| warning: false
# Yearly data from the sample station
CRNdat = read.csv(url("https://www.ncei.noaa.gov/pub/data/uscrn/products/daily01/2021/CRND0103-2021-LA_Lafayette_13_SE.txt"), header=FALSE,sep="")
# Data headers
headers=read.csv(url("https://www.ncei.noaa.gov/pub/data/uscrn/products/daily01/headers.txt"), header=FALSE,sep="")
# Column names as headers from the text file
colnames(CRNdat)=headers[2,1:ncol(CRNdat)]
# Replace fill values with NA
CRNdat[CRNdat == -9999]=NA
CRNdat[CRNdat == -99]=NA
CRNdat[CRNdat == 999]=NA
# View data sample
library(kableExtra)
dataTable = kbl(head(CRNdat,6),full_width = F)
kable_styling(dataTable,bootstrap_options = c("striped", "hover", "condensed", "responsive"))
```
Notice the variables provided in the dataset. As an example, we can plots soil moisture data from a depth of 20 cm for this station for our reference:
```{r}
#| label: fig-density
#| fig-cap: "Soil moisture values at the selected USCRN station"
#| fig-subcap:
#| - "Time series of SM"
#| - "SM kernel density"
#| layout-ncol: 2
# Sample plot for soil moisture
x=CRNdat$SOIL_MOISTURE_20_DAILY
# Plot time series and density distribution
plot(x, type="l", ylab="Soil moisture (v/v)",
col="cyan4", lwd=3)
plot(density(na.omit(x)), main=" ", xlab="",
col="cyan4", lwd=3)
```
Exercise:
1. Taking examples of any two USCRN stations across contrasting hydroclimates, compare and contrast any two recorded variables using time series plots, probability density distribution histograms and scatter plots. Select any year of your liking for the analysis.
2. Select two seasons for each elected variable and demonstrate the seasonal variability in the records for summer (MAMJJA) and winter (SONDJF) seasons using any two types of multivariate plots.