项目作者: csiro-hydroinformatics

项目描述 :
Handling ensemble forecast time series in hydrology, meteorology and possibly other domains
高级语言: R
项目地址: git://github.com/csiro-hydroinformatics/efts.git
创建时间: 2018-02-13T05:51:31Z
项目社区:https://github.com/csiro-hydroinformatics/efts

开源协议:

下载


efts

Reading and writing Ensemble Forecast Time Series in netCDF files.

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

Installation

  1. # From CRAN:
  2. install.packages("efts")
  3. # Or the the development version from GitHub:
  4. # install.packages("devtools")
  5. devtools::install_github("jmp75/efts")

Example use

This is an extract from one of the package vignettes.

  1. library(efts)
  2. ext_data <- system.file('extdata', package='efts')
  3. rain_file <- file.path(ext_data, 'Upper_Murray_sample_rain.nc')
  4. stopifnot(file.exists(rain_file))
  5. rain_dat <- open_efts(rain_file)
  6. class(rain_dat)
  7. #> [1] "EftsDataSet"
  8. #> attr(,"package")
  9. #> [1] "efts"

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

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

  1. d <- rain_dat$get_all_series(variable_name = 'rain_der')
  2. head(d)
  3. #> Warning: timezone of object (UTC) is different than current timezone ().
  4. #> 1 2 3
  5. #> 2006-01-01 00:00:00 0.00000000 0.00000000 0.00000000
  6. #> 2006-01-01 01:00:00 0.00000000 0.00000000 0.00000000
  7. #> 2006-01-01 02:00:00 0.03022585 0.06189353 0.13274320
  8. #> 2006-01-01 03:00:00 0.00000000 0.00000000 0.00000000
  9. #> 2006-01-01 04:00:00 0.00000000 0.00000000 0.00000000
  10. #> 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.

  1. 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.

  1. rain_dat$close()

Placeholder section, see whether there is an intersect with: