Description Usage Arguments Value See Also Examples
View source: R/mkForcingSpatialAdjFiles.R
MkFrcAdjFromLdasin
Takes an list (see examples) and creates at netcdf file
with a specified name which can be used to perturb WRF-Hydro forcing variables.
1 | MkFrcAdjFromLdasin(frcAdjL, file)
|
frcAdjL |
List, the variable list. See structure in examples. |
file |
character, the path/filename.nc of the netcdf file to be written. |
Returns the filename invisibly, if successful.
Other ncdf: GetNcdfFile
,
MkNcdf
, ncdump
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 | ## Not run:
# Example 1 - 1 variable
theFile <- '/glade/p/work/jamesmcc/WRF_Hydro/domains/tuolumne/FORCING/2007100100.LDASIN_DOMAIN1'
## Note: I've Abandoned compression with scale factor and add offset for the time being.
frcAdjList <-
list(LDASIN=theFile,
RAINRATE=list(variable='RAINRATE',
operator=tolower('x'),
data=2, ## could be an array
##scale_factor=.001, ## discouraged due to model uncompression issues
##add_offset=4.0, ## " "
upperBound=0.014, ## the limit imposed in the model = 500mm/hr = .1388889
lowerBound=0.0
)
)
## Notes: high rain rates crash the model. 500mm/hr is the limit in the model
## but uniform rain of lesser magnitudes can crash the model.
OpTransform <- c(`+`='.add', `x`='.mult')
outFile <- paste0('/glade/p/work/jamesmcc/forcing_spatial_adj/test.frcAdj/',
'frcAdj',
OpTransform[frcAdjList$RAINRATE$operator],
'.data.', frcAdjList$RAINRATE$data,
'.scale.',frcAdjList$RAINRATE$scale_factor,
'.add.', frcAdjList$RAINRATE$add_offset,
'.upBnd.', frcAdjList$RAINRATE$upperBound,
'.loBnd.', frcAdjList$RAINRATE$lowerBound,
'.nc')
unlink(outFile)
zz <- MkFrcAdjFromLdasin(frcAdjList, outFile)
theData <- GetNcdfFile(zz)
summary(as.vector(theData[[1]]))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.