Description Usage Arguments Value Author(s) See Also Examples
View source: R/write.river.append2NML.R
An existing Fortran namelist file is used. The two namelists 'DIMENSIONS' and 'RIVERS' are modified. In 'DIMENSIONS', the variable 'NRIVERS' is incremented by the number of new rivers. In 'RIVERS', some information is added to the variables 'KRQI' and 'RWQI'. 'KRQI' contains the x- and y-coordinates of the grid cells, in which the rivers enter the sea. 'RWQI' contains the actual inflow data of each river.
1 2 | write.river.append2NML(riverNames, riverInfos, riverData, grids, dIn, dOt, year,
overwrite = TRUE, warn = TRUE)
|
riverNames |
character array with river names |
riverInfos |
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 |
grids |
character array with grid names |
dIn |
character; directory containing the input file (to which data should be appended) |
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 |
file written
Daniel Neumann, daniel.neumann@io-warnemuende.de
write.river.append2Inflow, write.river.newNML
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 | # 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.annual$Warnow <- mean.river.mom(test.mom.monthly$Warnow, to = 'annual')
test.mom.annual$Trave <- mean.river.mom(test.mom.monthly$Trave, to = 'annual')
# 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.append2NML(c('Warnow', 'Trave'), riverInfos, test.mom.annual, grid_info, 'files', 'out_dir', 2012, overwrite=FALSE)
## NAMELIST example: data_GRID_RIVER.nml
# &DIMENSIONS
# EW=630, NS=387, LAYERS=25, NZBND=858, NUBND=0, NVBND=0, NRIVERS=8, NUDAMS=0, NVDAMS=0, NWEIRS=0
# /
# &RIVERS
# KRQI=0, 0, 341, 606, 376, 82, 386, 169, 364, 302, 263, 193, 84, 579, 26, 477, 65, 159, RWQI=0.000000000000000000E+00, 522.000000000000000, 100.000000000000000, 450.000000000000000, 90
# 0.000000000000000, 37.0000000000000000, 48.0000000000000000, 21.0000000000000000, 125.000000000000000
# /
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.