High-Level Functions to Read and Write Ensemble Forecast Time Series in netCDF

The binary file format 'netCDF' is developed primarily for climate, ocean and meteorological data, and 'efts' is a package to read and write Ensemble Forecast Time Series data in 'netCDF'. 'netCDF' has traditionally been used to store time slices of gridded data, rather than complete time series of point data. 'efts' facilitates data handling stored in 'netCDF' files that follow a convention devised in the domain of ensemble hydrologic forecasting, but possibly applicable in other domains. 'efts' uses reference class objects to provide a high level interface to read and write such data, wrapping lower level operations performed using 'ncdf4'.

Reading and writing Ensemble Forecast Time Series in netCDF files.


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


# Or the the development version from GitHub:
# install.packages("devtools")

Loading ## Example use

This is an extract from one of the package vignettes.

ext_data <- system.file('extdata', package='efts')
rain_file <- file.path(ext_data, 'Upper_Murray_sample_rain.nc')
rain_dat <- open_efts(rain_file)
#> [1] "EftsDataSet"
#> attr(,"package")
#> [1] "efts"

rain_dat has methods to discover and retrieve data in the file.

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(),
#> This rainfall data set has data for 3 stations, the lead time dimension is '1' because this is not forecast data
#> [1] "area"          "lat"           "lon"           "rain_der"     
#> [5] "rain_der_qual" "station_id"    "station_name"  "x"            
#> [9] "y"
#> [1] "station" "time"

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.

d <- rain_dat$get_all_series(variable_name = 'rain_der')
#> Warning: timezone of object (UTC) is different than current timezone ().
#>                              1          2          3
#> 2006-01-01 00:00:00 0.00000000 0.00000000 0.00000000
#> 2006-01-01 01:00:00 0.00000000 0.00000000 0.00000000
#> 2006-01-01 02:00:00 0.03022585 0.06189353 0.13274320
#> 2006-01-01 03:00:00 0.00000000 0.00000000 0.00000000
#> 2006-01-01 04:00:00 0.00000000 0.00000000 0.00000000
#> 2006-01-01 05:00:00 0.01819110 0.02752321 0.06931218

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.

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.


Related work

Placeholder section, see whether there is an intersect with:


Version 0.9.0


  • Fixes based on CRAN reviewer feedback, for second submission to CRAN
  • Add helper template functions for optional metadata variable and mandatory file attributes
  • Related to above, revised key functions signatures for creating datasets
  • Example code in documentation is not marked as 'dontrun'
  • Add stricter checks for mandatory variables and attributes
  • Add stricter checks for direct get_values and put_values

Version 0.8.0


  • First submission to CRAN

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.9-0 by Jean-Michel Perraud, 10 months ago


Report a bug at https://github.com/jmp75/efts/issues

Browse source code at https://github.com/cran/efts

Authors: Jean-Michel Perraud [aut, cre] , David Robertson [aut] , James Bennett [aut]

Documentation:   PDF Manual  

GPL-2 license

Imports methods, stringr, lubridate, magrittr, xts, plyr, ncdf4, udunits2

Suggests testthat, zoo, knitr

See at CRAN