View source: R/output.operation.r
| output.operation | R Documentation |
Convert one LPJ output file by a user defined operation. Write out new data in LPJ output (clm) format.
output.operation(outfile, operation, newfile = paste(outfile[["path"]], "_new", sep = ""), VERBOSE = FALSE)
outfile |
the information list of LPJ output, see example. |
operation |
a user defined function/operation. Note: this function should have only one scalar/vector as an argument and return a scalar/vector value too. |
lpjoutfile<-list()
lpjoutfile[["path"]]="../tests/test_data/soilc.bin"
lpjoutfile[["nyears"]]=40
lpjoutfile[["nbands"]]=1
lpjoutfile[["ncells"]]=67420
lpjoutfile[["start_year"]]=1901
fun<-function(old){ # here identify the user operation
new <- old
new[old>0] <- old/1000
return((old/10000))
}
output.operation(lpjoutfile, fun, newfile="soilc_new.bin")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.