Compare commits

...

2 Commits

Author SHA1 Message Date
ming 29daf1b240 add L7.qmd 2026-05-26 13:43:04 +08:00
ming 982f26736f Update Ref.bib 2026-05-26 13:42:53 +08:00
17 changed files with 672804 additions and 2 deletions
+40
View File
@@ -45809,3 +45809,43 @@ barcante2020cyanobacteria
year = {2008} year = {2008}
} }
@Article{tatters2025benthic,
title = {Benthic cyanobacterial accumulations and associated cyanotoxins in coastal urban stormwater pond networks},
author = {Tatters, Avery O. and Clevenger, Courtney and Strangman, Wendy K. and Oehrle, Stuart and Kudela, Raphael M. and Aukamp, Jessica and Wan, Yongshan},
year = 2025,
journal = {Harmful Algae},
publisher = {Elsevier BV},
volume = 144,
pages = 102833,
url = {http://dx.doi.org/10.1016/j.hal.2025.102833},
issn = {1568-9883},
doi = {10.1016/j.hal.2025.102833}
}
@Article{maurer2024temporal,
title = {Temporal Dynamics of Cyanobacterial Bloom Community Composition and Toxin Production from Urban Lakes},
author = {Maurer, Julie A. and Xia, Runjie and Kim, Andrew M. and Oblie, Nana and Hefferan, Sierra and Xie, Hannuo and Slitt, Angela and Jenkins, Bethany D. and Bertin, Matthew J.},
year = 2024,
journal = {ACS ES&T Water},
publisher = {American Chemical Society (ACS)},
volume = 4,
pages = {34233432},
url = {http://dx.doi.org/10.1021/acsestwater.4c00266},
issn = {2690-0637},
doi = {10.1021/acsestwater.4c00266},
number = 8}
@article{paerl2016duelling,
author = {Paerl, Hans W. and Otten, Timothy G.},
title = {Duelling CyanoHABs: unravelling the environmental drivers controlling dominance and succession among diazotrophic and non-N2-fixing harmful cyanobacteria},
journal = {Environmental Microbiology},
volume = {18},
number = {2},
pages = {316-324},
doi = {10.1111/1462-2920.13035},
url = {https://enviromicro-journals.onlinelibrary.wiley.com/doi/abs/10.1111/1462-2920.13035},
eprint = {https://enviromicro-journals.onlinelibrary.wiley.com/doi/pdf/10.1111/1462-2920.13035},
year = {2016}
}
+1 -1
View File
@@ -34,4 +34,4 @@ website:
- text: Codes - text: Codes
url: https://git.drwater.net/{{< var projtype >}}/{{< var reponame >}}/src/branch/{{< var branch >}} url: https://git.drwater.net/{{< var projtype >}}/{{< var reponame >}}/src/branch/{{< var branch >}}
- text: Issue - text: Issue
url: https://git.drwater.net/manuscript/{{< var reponame >}}/issues url: https://git.drwater.net/{{< var projtype >}}/{{< var reponame >}}/issues
+1 -1
View File
@@ -33,4 +33,4 @@ website:
- text: Codes - text: Codes
url: https://git.drwater.net/{{< var projtype >}}/{{< var reponame >}}/src/branch/{{< var branch >}} url: https://git.drwater.net/{{< var projtype >}}/{{< var reponame >}}/src/branch/{{< var branch >}}
- text: Issue - text: Issue
url: https://git.drwater.net/manuscript/{{< var reponame >}}/issues url: https://git.drwater.net/{{< var projtype >}}/{{< var reponame >}}/issues
+170
View File
@@ -0,0 +1,170 @@
---
title: "RWEP L7- Data Transform"
---
# Data Source
```{r}
dailylanddf <- readr::read_csv("../data/chinawq/daily_land.csv")
metadatadf <- readxl::read_xls("../data/chinawq/metadata_and_statistics.xls")
monthlylanddf <- readr::read_csv("../data/chinawq/monthly_ocean.csv")
weeklylanddf <- readr::read_csv("../data/chinawq/weekly_land.csv")
```
```{r}
require(tidyverse)
dailylanddf
dailylanddf |>
select(.data$MonitoringLocationIdentifier, .data$LongitudeMeasure_WGS84)
dailylanddf |>
select("MonitoringLocationIdentifier", "LongitudeMeasure_WGS84")
dailylanddf |>
select(1:3)
dailylanddf |>
rename(x = 1) |>
rename(y = 2)
```
# 内置function
```{r}
dailylanddf |>
select(1:3) |>
rename_all(\(x) c("a", "b", "c")) |>
rename_all(\(x) paste0(x, "_new"))
dailylanddf |>
select(1:3) |>
rename_all(~ c("a", "b", "c")) |>
rename_all(~ paste0(., "_new"))
dailylanddf |>
select(1:3) |>
rename_all(~ c("x", "y", "z"))
```
```{r}
fulldatadf <- readr::read_csv("../data/chinawq/full_dataset.csv")
datadf <- fulldatadf |>
select(lon = 2, lat = 3, date = 4, varname = 5, value = 6) |>
mutate(value = as.numeric(value)) |>
tidyr::pivot_wider(names_from = varname, values_from = value)
saveRDS(datadf, "../data/chinawq/datadf.rds")
```
# 统计
## 统计每月的DO的平均值
```{r}
datadf <- readRDS("../data/chinawq/datadf.rds")
datadf |>
select(1:7) |>
mutate(month = month(date)) |>
select(lon, lat, month, date, everything()) |>
group_by(month) |>
summarize(DO_mean = mean(DO, na.rm = TRUE), DO_sd = sd(DO, na.rm = TRUE)) |>
ggplot(aes(x = month, y = DO_mean)) +
geom_point() +
geom_smooth(method = "loess") +
geom_errorbar(aes(ymin = DO_mean - DO_sd, ymax = DO_mean + DO_sd))
```
```{r}
datadf |>
select(1:7) |>
mutate(month = month(date)) |>
mutate(year = year(date)) |>
select(lon, lat, year, month, date, everything()) |>
summarize(
DO_mean = mean(DO, na.rm = TRUE),
DO_sd = sd(DO, na.rm = TRUE),
.by = c(year, month)
) |>
ggplot(aes(x = month, y = DO_mean)) +
geom_point() +
geom_smooth(method = "loess") +
geom_errorbar(aes(ymin = DO_mean - DO_sd, ymax = DO_mean + DO_sd)) +
facet_wrap(~year)
```
```{r}
datadf |>
select(1:7) |>
mutate(month = month(date)) |>
mutate(year = year(date)) |>
select(-lon, -lat, -date) |>
group_by(year, month) |>
summarize_all(\(x) mean(x, na.rm = TRUE))
```
## nest
```{r}
for (isite in 1:10) {
m <- datadf |>
select(1:7) |>
tidyr::nest(wqdf = -c(lon, lat)) |>
pull(wqdf) |>
nth(isite) |>
lm(formula = DO ~ pH, data = _)
slope <- coef(m)[2]
print(slope)
}
```
## purrr::map
```{r}
datadf |>
select(1:7) |>
tidyr::nest(wqdf = -c(lon, lat)) |>
slice(1:10) |>
mutate(
m = purrr::map(
wqdf,
\(x) {
lm(formula = DO ~ pH, data = x)
}
)
) |>
mutate(slope = purrr::map_dbl(m, \(x) coef(x)[2])) |>
mutate(
p = purrr::map(wqdf, \(x) {
x |>
ggplot(aes(x = pH, y = DO)) +
geom_smooth(method = "lm") +
geom_point()
})
) |>
pull(p) |>
patchwork::wrap_plots() +
patchwork::plot_layout(ncol = 2)
```
@@ -0,0 +1 @@
UTF-8
Binary file not shown.
@@ -0,0 +1 @@
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff