-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
99 lines (83 loc) · 3.31 KB
/
README.Rmd
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
---
output: github_document
editor_options:
chunk_output_type: console
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
# Meteorological data
<!-- badges: start -->
<!-- badges: end -->
Daily meteorological data were downloaded from [TuTiempo.net](https://en.tutiempo.net)
for the following 4 climatic stations:
```{r echo = FALSE}
(selected_stations <- read.csv("data/stations.csv"))
```
Which, on the map, are located here in red, from left to right and from top to
bottom:
```{r echo = FALSE, message = FALSE, fig.retina = 2, fig.align = "center"}
library(sf)
library(dplyr)
laos <- readRDS("data-raw/gadm36_LAO_1_sf.rds")
stations <- readxl::read_excel("/Users/choisy/Dropbox/aaa/R_packages/tutiempo/data-raw/climatic stations.xlsx")
stations_sf <- stations %>%
select(-elevation, -from) %>%
na.exclude() %>%
st_as_sf(coords = c("longitude", "latitude"), crs = 4326)
selected_stations <- selected_stations %>%
select(-elevation) %>%
na.exclude() %>%
st_as_sf(coords = c("longitude", "latitude"), crs = 4326)
plot(st_geometry(laos))
plot(st_geometry(stations_sf), add = TRUE)
plot(st_geometry(selected_stations), col = "red", add = TRUE)
```
After cleaning (see [cleaning pipeline](https://ecomore2.github.io/meteo/make_data.html)),
the meteorological data as well and the climatic stations characteristics are
available here:
* [meteo.csv](https://raw.githubusercontent.com/ecomore2/meteo/master/data/meteo.csv) (905.5 KB)
* [stations.csv](https://raw.githubusercontent.com/ecomore2/meteo/master/data/stations.csv) (211 K)
From where they can be copied and pasted. They can also be downloaded directly
from R as so:
```{r eval = FALSE}
if (! "readr" %in% rownames(installed.packages())) install.packages("readr")
meteo <- readr::read_csv("https://raw.githubusercontent.com/ecomore2/meteo/master/data/meteo.csv",
col_types = "iDddddiddddllll")
stations <- readr::read_csv("https://raw.githubusercontent.com/ecomore2/meteo/master/data/stations.csv",
col_types = "cciddi")
```
Dictionary:
* **day**: date of data colletion
* **ta**: average temperature (°C)
* **tx**: maximum temperature (°C)
* **tn**: minimum temperature (°C)
* **slp**: atmospheric pressure at sea level (hPa)
* **h**: average relative humidity (%)
* **pp**: total rainfall and / or snowmelt (mm)
* **vv**: average visibility (km)
* **v**: average wind speed (km / h)
* **vm**: maximum sustained wind speed (km / h)
* **ra**: boolean indicating whether there was rain or drizzle
* **sn**: boolean indicating whether it snowed
* **ts**: boolean indicating whether there were storm
* **fg**: boolean indicating whether there was floo
Below is a visual representation of the data per station:
```{r echo = FALSE, message = FALSE, fig.retina = 2, fig.align = "center"}
library(visdat)
meteo <- readr::read_csv("data/meteo.csv", col_types = "iDddddiddddllll")
# for(i in unique(meteo$station)) vis_dat(meteo[meteo$station == i, ])
sta <- unique(meteo$station)
print(sta[1])
vis_dat(meteo[meteo$station == sta[1], ], FALSE)
print(sta[2])
vis_dat(meteo[meteo$station == sta[2], ], FALSE)
print(sta[3])
vis_dat(meteo[meteo$station == sta[3], ], FALSE)
print(sta[4])
vis_dat(meteo[meteo$station == sta[4], ], FALSE)
```