kevinwolz / hisafer

An R toolbox for the Hi-sAFe biophysical agroforestry model
6 stars 4 forks source link

possible problem with version 3.5 of R #124

Closed mariegosme closed 5 years ago

mariegosme commented 5 years ago

message received from an hisafer user: Hi Marie, some time has passed. I don't know if you are still the right person to write to about support for hisafer. But I hope you can help, or direct me to somebody who can. I found the required weather data and am now ready to do the comparison between the observed data and the model predictions. However, while I have not been using hi-sAFe/hisafer in the meantime, a new wierd error has appeared. I am following the hisafer vignette, just to get the model working again. I can get hisafer to do all of the following:

Define the hip.
hip <- define_hisafe(path = "C:/Users/John/Documents/R/win-library/3.5/hisafer/extdata/example_exp",
profiles = c("plot", "trees", "climate", "monthCells", "cells", "voxels"),
template = "agroforestry",
exp.name = "agroforestry")
Build the simulation folders.
build_hisafe(hip=hip)
Run the model.
run_hisafe(path = "C:/Users/John/Documents/R/win-library/3.5/hisafer/extdata/example_exp",
simu.names="Sim_1",
parallel = FALSE,
capsis.path = "C:/Users/Public/Capsis42/")

But when I try to read the output with hop <- read_hisafe(path = "C:/Users/John/Documents/R/win-library/3.5/hisafer/extdata/lue5", profiles = c("plot", "trees", "climate", "monthCells", "cells", "voxels")) I get the error: "object of type 'builtin' is not subsettable"

Earlier, I got the error "no requested profiles were found for the following simulations: Sim_1, Sim_2"

I have found the vignette for hisafer 1.0.0 on the web. I know I have been using 1.5.0 earlier. However, when i type vignette("hisafer-vignette") in R, I get the error

vignette 'hisafer-vignette' not found

R has been updated to version 3.5.3 after I last used it. I wonder if the problems I am having arise because of this? Can you guys help me?

Kind regards from Jens

I sent him the vignette of hisafer 1.5.0, and asked him to follow this vignette and get back to us here on github if the problem persists. Marie

mariegosme commented 5 years ago

answer I gave him: Dear Jens,

here is the vignette for hisafe 1.5.0

My first reaction when looking at your code, is that you are overwriting the folders of the package, which means that the package will work only the first time you use it...

so when you want to run your own simulations, you need to build the folder structure in your own folder, not in the package folder. So you should first delete the folder C:/Users/John/Documents/R/win-library/3.5/hisafer (but first, save what you have created there). And then you should use

hipJens <- define_hisafe(path = "C:/Users/John/Documents/JensHisafeSimulations", #or whatever folder you want to keep your simulations in profiles = c("plot", "trees", "climate", "monthCells", "cells", "voxels"), template = "agroforestry", exp.name = "agroforestry")

My second remark is that you are trying to read a simulation that is different from the simulation you ran (folders example_exp or lue5, the first one has only one simulation: sim_1 and apparently the second one has 2 simulations: sim_1 and sim_2). The beauty of hisafer is that if you do everything from hisafer (define, build, run and read), you don't have to bother with remembering the paths : everything is kept tidy thanks to the hip, which keeps all the information.

so after defining the hip as above, you don't need to give the paths again:

build_hisafe(hip = hipJens)

run_hisafe(hip = hipJens, capsis.path = "C:/Users/Public/Capsis42/")

hopJens <- read_hisafe(hip = hipJens)

If the problem persists, please ue github (https://github.com/kevinwolz/hisafer/) to file a bug report.

Best regards

Marie Gosme