davcam / basfor Goto Github PK
View Code? Open in Web Editor NEWThe BASic FORest model, BASFOR, is a process-based model for forest biogeochemistry which simulates the C-, N- and water-cycles.
The BASic FORest model, BASFOR, is a process-based model for forest biogeochemistry which simulates the C-, N- and water-cycles.
Hi David,
first of all, thank you very much for making BASFOR available as R-Package!
Now the issue:
I installed the BASFOR package on a windows machine and ran it after the quickstart guidelines.
#testBASFOR-package.r
library(devtools)
install_github("davcam/BASFOR", ref = "master", build_vignettes = FALSE)
library(BASFOR)
init <- initialise()
FORTYPE <- as.integer(1)
year_start <- as.integer(1900)
doy_start <- as.integer(1)
NDAYS <- as.integer(40543)
head(weather_CONIFEROUS_1)
df_weather <- weather_CONIFEROUS_1
matrix_weather <- weather_BASFOR( year_start, doy_start, NDAYS, df_weather )
row.names(df_params)
df_params <- df_params
parcol <- 1
params <- df_params[,parcol]
init$calendar_Ndep [ 1, ] <- c( 1700,200, 3.0 / (365 * 10000) )
init$calendar_Ndep [ 2, ] <- c( 1900,200, 3.0 / (365 * 10000) )
init$calendar_Ndep [ 3, ] <- c( 1910,200, 4.7 / (365 * 10000) )
init$calendar_Ndep [ 4, ] <- c( 1920,200, 6.4 / (365 * 10000) )
init$calendar_Ndep [ 5, ] <- c( 1930,200, 8.9 / (365 * 10000) )
init$calendar_Ndep [ 6, ] <- c( 1940,200, 12.4 / (365 * 10000) )
init$calendar_Ndep [ 7, ] <- c( 1950,200, 17.2 / (365 * 10000) )
init$calendar_Ndep [ 8, ] <- c( 1960,200, 23.9 / (365 * 10000) )
init$calendar_Ndep [ 9, ] <- c( 1970,200, 30.9 / (365 * 10000) )
init$calendar_Ndep [10, ] <- c( 1980,200, 35.0 / (365 * 10000) )
init$calendar_Ndep [11, ] <- c( 1990,200, 32.2 / (365 * 10000) )
init$calendar_Ndep [12, ] <- c( 2000,200, 25.1 / (365 * 10000) )
init$calendar_Ndep [13, ] <- c( 2010,200, 21.2 / (365 * 10000) )
init$calendar_Ndep [14, ] <- c( 2100,200, 21.2 / (365 * 10000) )
init$calendar_thinT[ 1, ] <- c( 1925, 1, 0.400 )
init$calendar_thinT[ 2, ] <- c( 1935, 1, 0.250 )
init$calendar_thinT[ 3, ] <- c( 1945, 1, 0.250 )
init$calendar_thinT[ 4, ] <- c( 1955, 1, 0.200 )
init$calendar_thinT[ 5, ] <- c( 1965, 1, 0.150 )
init$calendar_thinT[ 6, ] <- c( 1975, 1, 0.400 )
init$calendar_thinT[ 7, ] <- c( 2006, 1, 0.887 )
output <- run_model()
output[1:4,]
plot_output()
Everything seems to work, but the output doesn't make sense.
Thanks in advance for any advice!
Cheers,
Andreas (Ibrom)
R version 3.3.0 (2016-05-03)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C LC_TIME=English_United Kingdom.1252
attached base packages:
[1] graphics grDevices utils datasets stats methods base
other attached packages:
[1] BASFOR_0.0.0.9000 devtools_1.12.0 TinnRcom_1.0.18 formatR_1.4 svSocket_0.9-57 utils.anib_1.0 caTools_1.17.1 smatr_3.4-3
[9] plyr_1.8.3 lmtest_0.9-34 zoo_1.7-13 chron_2.3-47
loaded via a namespace (and not attached):
[1] Rcpp_0.12.9 lattice_0.20-33 withr_1.0.2 digest_0.6.9 bitops_1.0-6 R6_2.1.2 grid_3.3.0 git2r_0.15.0 httr_1.2.1
[10] curl_1.1 svMisc_0.9-70 tools_3.3.0 memoise_1.0.0 tcltk_3.3.0 knitr_1.13
Hi David,
when installing under 64 bit systems, we get these floating point warnings. Also reading on #1, I wonder if this is a problem.
Does BASFOR strictly require either 32 or 64 bit? Thanks!
* installing to library 'C:/Users/FlorianHartig/Documents/R/win-library/3.4'
* installing *source* package 'BASFOR' ...
** libs
c:/Rtools/mingw_64/bin/gfortran -O2 -mtune=core2 -c parameters.f90 -o parameters.o
c:/Rtools/mingw_64/bin/gfortran -O2 -mtune=core2 -c environment.f90 -o environment.o
c:/Rtools/mingw_64/bin/gfortran -O2 -mtune=core2 -c management.f90 -o management.o
c:/Rtools/mingw_64/bin/gfortran -O2 -mtune=core2 -c tree.f90 -o tree.o
c:/Rtools/mingw_64/bin/gfortran -O2 -mtune=core2 -c belowgroundres.f90 -o belowgroundres.o
c:/Rtools/mingw_64/bin/gfortran -O2 -mtune=core2 -c soil.f90 -o soil.o
c:/Rtools/mingw_64/bin/gfortran -O2 -mtune=core2 -c BASFOR.f90 -o BASFOR.o
BASFOR.f90:166.18:
if (CL < 1.E-100) then
1
Warning: Real constant underflows its kind at (1)
c:/Rtools/mingw_64/bin/gfortran -O2 -mtune=core2 -c set_params.f90 -o set_params.o
c:/Rtools/mingw_64/bin/gfortran -shared -s -static-libgcc -o BASFOR.dll tmp.def BASFOR.o belowgroundres.o environment.o management.o parameters.o set_params.o soil.o tree.o -Ld:/Compiler/gcc-4.9.3/local330/lib/x64 -Ld:/Compiler/gcc-4.9.3/local330/lib -LC:/PROGRA~1/R/R-34~1.0/bin/x64 -lR
installing to C:/Users/FlorianHartig/Documents/R/win-library/3.4/BASFOR/libs/x64
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (BASFOR)
Hi David,
we have been encountering a number of issues running modified BASFOR code in parallel, and have come to the conclusion that the code is currently probably not thread-safe, due to the global variables to which functions write.
Did you think about this / encounter any issues with parallelisation?
Best,
Florian
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.