write.river.netCDF: Write netCDF files (one for each river) with riverine...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/write.river.netCDF.R

Description

For each entry in 'riverNames' a netCDF file is created. TODO

Usage

1
2
write.river.netCDF(riverNames, riverInfo, riverData, netCDF2input, dOt, year,
  overwrite = TRUE, warn = TRUE, cmd_ncgen = "ncgen")

Arguments

riverNames

character array with river names

riverInfo

list() of grid-information-lists(); to each element in riverNames one list element with the same name needs to exist in riverInfos

riverData

list() of river-inflow-data-lists(); to each element in riverData one list element with the same name needs to exist in riverInfos

netCDF2input

list() with two character arrays netCDF2input$untagged and netCDF2input$tagged; these contain the names of rivers, which are tagged and untagged, respectively

dOt

character; directory into which the final file should be written

year

integer; year to write out

overwrite

logical; overwrite 'dOt/filename' it already exists

warn

logical; allow/suppress warnings

cmd_ncgen

character: ncgen-call; if ncgen is not in the path (or the wrong verson of ncgen) please provide here '/path/ncgen-exec' for the ncgen binary

Value

file written

Author(s)

Daniel Neumann, daniel.neumann@io-warnemuende.de

See Also

write.river.newNML, write.river.newInflow

Examples

 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
  # read a file:
  test.mom.monthly <- list()
  test.mom.monthly$Warnow <- read.river.mom('files/GER_Dan_Str_Warnow.dat')
  test.mom.monthly$Trave <- read.river.mom('files/GER_Dan_Str_Trave.dat')
  
  # calculate annual means from monthly data
  test.mom.annual <- list()
  test.mom.daily$Warnow <- interpolate.river.mom(test.mom.monthly$Warnow, to = 'daily', method = 'step')
  test.mom.daily$Trave <- interpolate.river.mom(test.mom.monthly$Trave, to = 'daily', method = 'step')
  
  # get netCDF file variable mapping
  varmapping.hbm <- get.varmapping.hbm.netcdf()
  
  # get grid info
  grid_info <- get.infos.grids.hbm.basic()
  
  # get river infos
  file <- 'files/river_list.dat'
  riverInfos <- read.infos.rivers(file, grid_info)
  # (you will get some warnings here)
  
  # write new namelist
  write.river.netCDF(c('Warnow', 'Trave'), riverInfos, test.mom.daily, varmapping.hbm, 'out_dir', 2012, overwrite=FALSE)

 input vals: mol/kg
 output vals: mmol/m3
 output = input * 20^6

neumannd/riverdata.dirty documentation built on May 29, 2019, 7:15 a.m.