-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.Rmd
87 lines (61 loc) · 2.79 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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-"
)
```
<!-- # efts <img src="man/figures/logo.png" align="right" /> -->
# efts
Reading and writing Ensemble Forecast Time Series in netCDF files.
<!-- [![Build Status](https://travis-ci.org/efts/efts.svg?branch=master)](https://travis-ci.org/efts/efts) -->
## Overview
Plain text files are not well suited to storing the large volumes of data generated for and by ensemble streamflow forecasts with numerical weather prediction models. netCDF is a binary file format developed primarily for climate, ocean and meteorological data. netCDF has traditionally been used to store time slices of gridded data, rather than complete time series of point data. **efts** is for handling the latter.
**efts** is designed to handle netCDF data following the [NetCDF for Water Forecasting Conventions v2.0](https://github.com/jmp75/efts/blob/master/docs/netcdf_for_water_forecasting.md)
## Installation
```{r, eval = FALSE}
# From CRAN:
install.packages("efts")
# Or the the development version from GitHub:
# install.packages("devtools")
devtools::install_github("jmp75/efts")
```
## Example use
This is an extract from one of the package vignettes.
```{r}
library(efts)
ext_data <- system.file('extdata', package='efts')
rain_file <- file.path(ext_data, 'Upper_Murray_sample_rain.nc')
stopifnot(file.exists(rain_file))
rain_dat <- open_efts(rain_file)
class(rain_dat)
```
`rain_dat` has methods to discover and retrieve data in the file.
```{r}
cat(sprintf("This rainfall data set has data for %s stations, the lead time dimension is '%s' because this is not forecast data\n", rain_dat$get_station_count(),
rain_dat$get_lead_time_count()))
rain_dat$get_variable_names()
rain_dat$get_variable_dim_names("rain_der")
```
`rain_der` in this instance has two dimensions, but even if it had been defined as a 3 or 4 dimension data, or in different orders, the method `get_all_series` just does the low-level processing to present a meaninful multivariate `xts` series.
```{r}
d <- rain_dat$get_all_series(variable_name = 'rain_der')
head(d)
```
`xts` may insist on warning that the "timezone of object (UTC) is different than current timezone ().". This is normal and the series is exactly as it should be.
```{r obs_rainfall_plot}
plot(d[1:48], main="Interpolated rainfall (mm/h)")
```
You should use the `close` method once you are done with accessing the data set object and its underlying netCDF file.
```{r}
rain_dat$close()
```
## Related work
Placeholder section, see whether there is an intersect with:
* https://www.r-pkg.org/pkg/ensemblepp
* https://www.r-pkg.org/pkg/tsensembler
* https://www.r-pkg.org/pkg/hyfo