-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.Rmd
More file actions
98 lines (63 loc) · 3.75 KB
/
README.Rmd
File metadata and controls
98 lines (63 loc) · 3.75 KB
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
---
output:
md_document:
variant: markdown_github
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
## Interdecis
INDECIS software for intercomparison of reanalysis datasets: this is an open-source software, stand-alone and designed in R with capabilities to analyse the various climatic datasets performance using as reference E-OBS gridded dataset and ERA5 reanalysis product. The functions can be applied to any NetCDF files, as long as they are regularly spaced in the lat/lon grid format. Accuracy measures can be computed from the values extracted from the cells (grids) of the reference (E-OBS/ERA5) and analysed datasets, in which a given coordinates (points) fall.
The package is under development and currently provides common accuracy indicators for prediction models (i.e. mean error, mean absolute error, root mean squared error, correlation coefficients, index of agreement, etc). The indicators can be computed from daily data at yearly, seasonal and monthly scale. The routines implemented in the package can be applied for the ECV selected in the project (2m air temperature, relative humidity, 10m wind speed, daily total of precipitation and global solar radiation).
## Installing
Install the development versions from github with:
```{r code, eval=FALSE}
library(devtools)
install_github("alexdum/interdecis")
```
## Brief examples
As an example, we will use air temperature data available (E-OBS, MERA, EUROCORDEX) from package _interdecisdata_; this package can be installed with:
```{r interdecis, echo=TRUE, message=FALSE, warning=FALSE, paged.print=FALSE, eval=FALSE}
install.packages("http://193.26.129.60/anm_maps/interdecisdata_0.0.001.tar.gz", repos = NULL, type = "source")
```
### Extract data
Load EOBS air temperature dataset
```{r t_eobs, echo=TRUE, message=FALSE, warning=FALSE, paged.print=FALSE}
tavg.eobs <- raster::stack(system.file("eobs/tg_ens_mean_0.1deg_reg_2004-2005_v19.0e.nc", package = "interdecisdata"))
```
Load MERA 2m air temperature dataset
```{r t_mera, echo=TRUE, fig.height=4, fig.width=8, message=FALSE, warning=FALSE, paged.print=FALSE}
tavg.mera <- raster::stack(system.file("mera/mera_t2m_daily_2004_2005.nc", package = "interdecisdata"))
# raster::plot(tavg.mera[[1:2]])
```
Load EUROCORDEX tas dataset
```{r t_eurocordex, echo=TRUE, fig.height=4, fig.width=8, message=FALSE, warning=FALSE, paged.print=FALSE}
tavg.cordex <- raster::stack(system.file("eurocordex/tas_EUR-11_ECMWF-ERAINT_evaluation_domeniu.mic_r1i1p1_SMHI-RCA4_v1_day_20040101-20051231.nc", package = "interdecisdata"))
# raster::plot(tavg.cordex[[1:2]])
```
Extract renalysis data to point locations (lon = -8, lat = 52)
```{r ext_eobs, echo=TRUE, message=FALSE, warning=FALSE, paged.print=FALSE}
library(interdecis)
point <- cbind(lon = -8, lat = 52)
tavg.eobs.co <- extract_data(tavg.eobs, point, date1 = "2004-01-01", date2 = "2005-12-31")
tavg.mera.co <- extract_data(tavg.mera, point, date1 = "2004-01-01", date2 = "2005-12-31")
# convert to Celsius
tavg.mera.co$value <- tavg.mera.co$value - 273.15
tavg.cordex.co <- extract_data(tavg.cordex, point, date1 = "2004-01-01", date2 = "2005-12-31")
# convert to Celsius
tavg.cordex.co$value <- tavg.cordex.co$value - 273.15
```
### Compute model evaluation metrics
Convert extracted data from wide to long format
```{r wide_to_long, echo=TRUE, message=FALSE, warning=FALSE, paged.print=FALSE}
tavg.long <- wide_to_long(reference = "tavg.eobs.co", estimates = c("tavg.mera.co", "tavg.cordex.co"))
```
Calculate indicators accuracy between E-OBS data and modelled data (EURO-CORDEX and MERA)
```{r mod.stat, echo=TRUE, message=FALSE, warning=FALSE, paged.print=FALSE}
mod_met(tavg.long)
```