Closed Janewanguimugo closed 6 months ago
@Janewanguimugo Did you update APSIM? There are some problems with versions from 2023. I have no problems running the latest versions from 2022
The error occurred today, everything was alright before. How can I install an older version?
On Mon, 27 Feb 2023, 5:09 pm Fernando Miguez, @.***> wrote:
@Janewanguimugo https://github.com/Janewanguimugo Did you update APSIM? There are some problems with versions from 2023. I have no problems running the latest versions from 2022
— Reply to this email directly, view it on GitHub https://github.com/femiguez/apsimx/issues/117#issuecomment-1446387859, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYYCGN4HHHXMW4VBYTMZ7Z3WZSYTLANCNFSM6AAAAAAVJMQZD4 . You are receiving this because you were mentioned.Message ID: @.***>
From the APSIM download page select an older version of the software. You might need to increase the number of entries shown
Thank you it worked. On a different matter is there an issue with the soil download (get_isric_soil_profile())? I am trying to download soils for 800 points to do a spatial simulation. I get results of my simulation in some points and errors in others. eg. an issue with soil LL in one site and maybe soil SAT in another. Is there any way to get the correct soil without errors?
The version in github has an option 'fix' that will try to correct these errors before they are detected by APSIM. Set 'fix' to TRUE (default is FALSE). Let me know if that works
Which command do I use/add the fix = TRUE?
On Tue, 28 Feb 2023, 5:39 pm Fernando Miguez, @.***> wrote:
The version in github has an option 'fix' that will try to correct these errors before they are detected by APSIM. Set 'fix' to TRUE (default is FALSE). Let me know if that works
— Reply to this email directly, view it on GitHub https://github.com/femiguez/apsimx/issues/117#issuecomment-1448299461, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYYCGN4KEJMNCBQYAJ5ASU3WZYEYTANCNFSM6AAAAAAVJMQZD4 . You are receiving this because you were mentioned.Message ID: @.***>
When I used fix = TRUE, I am running potato simulations btw...I got results for approximately 500 locations, the others still have soil issues. Does it mean I now have to fix the unique issues one by one? Or is there any way to get the correct soil for the 800 points at once.
What does the error message look like? I could include code that addresses this issue before you run the simulations
It's a soil issue when I check in the GUI. I have attached the file for the location with an error...most locations have no issues. The error when running in R is the one below.
Error in read_apsimx(file = sub("apsimx$", "db", file), src.dir = src.dir, : No report tables found In addition: Warning message: In system(cmd, intern = intern, wait = wait | intern, show.output.on.console = wait, : running command 'C:\WINDOWS\system32\cmd.exe /c C:\PROGRA~1\APSIM2022.12.7129.0\bin\Models.exe .\PotatoFactorialFebMAr.apsimx' had status 1
The problem is that LL can't be lower than AirDry. I have made this change to my 'fix' function, but it is not public yet. You can try using it
fix_apsimx_soil_profile <- function(x, soil.var = c("SAT", "BD"), particle.density = 2.65, verbose = TRUE){
if(!inherits(x, "soil_profile"))
stop("object should be of class 'soil_profile'", call. = FALSE)
## Heuristics for fixing soil profiles
soil.var <- match.arg(soil.var)
## Bulk density and saturation issue
max_bd <- (1 - x$soil$SAT) * 2.65
bd_diff <- max_bd - x$soil$BD
for(j in seq_along(max_bd)){
if(bd_diff[j] <= 0){
x$soil$SAT[j] <- 1 - x$soil$BD[j] / 2.65 - 0.001
if(verbose && soil.var == "SAT"){
cat("Saturation of:", x$soil$SAT[j], "in layer:", j, "was above acceptable value of:", 1 - x$soil$BD[j] / 2.65, ".",
"It was adjusted to:", 1 - x$soil$BD[j] / 2.65 - 0.001, "\n")
}
## Fixing LL and air dry issue
if(x$soil$LL15 < x$soil$AirDry){
if(verbose){
cat("LL15 cannot be lower than AirDry in layer:", j,".\n",
"It was adjusted to the value of AirDry.\n")
}
x$soil$LL15[j] <- x$soil$AirDry[j]
}
}
}
return(x)
}
Thank you, I shall give it a try
On Thu, 30 Mar 2023, 8:27 pm Fernando Miguez, @.***> wrote:
The problem is that LL can't be lower than AirDry. I have made this change to my 'fix' function, but it is not public yet. You can try using it
fix_apsimx_soil_profile <- function(x, soil.var = c("SAT", "BD"), particle.density = 2.65, verbose = TRUE){
if(!inherits(x, "soil_profile")) stop("object should be of class 'soil_profile'", call. = FALSE)
Heuristics for fixing soil profiles
soil.var <- match.arg(soil.var)
Bulk density and saturation issue
max_bd <- (1 - x$soil$SAT) * 2.65 bd_diff <- max_bd - x$soil$BD
for(j in seq_along(max_bd)){ if(bd_diff[j] <= 0){ x$soil$SAT[j] <- 1 - x$soil$BD[j] / 2.65 - 0.001 if(verbose && soil.var == "SAT"){ cat("Saturation of:", x$soil$SAT[j], "in layer:", j, "was above acceptable value of:", 1 - x$soil$BD[j] / 2.65, ".", "It was adjusted to:", 1 - x$soil$BD[j] / 2.65 - 0.001, "\n") }
Fixing LL and air dry issue
if(x$soil$LL15 < x$soil$AirDry){ if(verbose){ cat("LL15 cannot be lower than AirDry in layer:", j,".\n", "It was adjusted to the value of AirDry.\n") } x$soil$LL15[j] <- x$soil$AirDry[j] } }
} return(x) }
— Reply to this email directly, view it on GitHub https://github.com/femiguez/apsimx/issues/117#issuecomment-1490668761, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYYCGN6EEHHE4LXMPV4SRU3W6W7BTANCNFSM6AAAAAAVJMQZD4 . You are receiving this because you modified the open/close state.Message ID: @.***>
Hello, So I used the fix function and now I am encountering new issues. Kindly see the attached file, it is a soil issue as well. The issue keeps changing depending on the site.
@Janewanguimugo Have you been able to figure this out? There are some issues which pertain to APSIM Next Gen, which are not related to the apsimx R package. I know there is an issue with initial water. I'm going to close this to concentrate on other issues. Let me know if you still need help
I am no longer able to run any apsimx simulations even those that come with package. What could be the error? For example this returns an error extd.dir <- system.file("extdata", package = "apsimx") sim <- apsimx("Wheat.apsimx", src.dir = extd.dir, value = "report")
Error in read_apsimx(file = sub("apsimx$", "db", file), src.dir = src.dir, : There are no .db files in the specified directory to read. In addition: Warning message: In system(cmd, intern = intern, wait = wait | intern, show.output.on.console = wait, : running command 'C:\WINDOWS\system32\cmd.exe /c C:\PROGRA~1\APSIM2023.2.7166.0\bin\Models.exe C:\Users\Admin\AppData\Local\R\win-library\4.2\apsimx\extdata\Wheat.apsimx' had status 32908