femiguez / apsimx

R package for APSIM-X

Home Page:https://femiguez.github.io/apsimx-docs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ISRIC soil water content

LenLon opened this issue · comments

Ello!

Considering that ISRIC "now" has volumetric water content, does the get_isric_soil_profile() function take that into account for reading in Initial soil water? Or is that still not possible considering the recent refactoring of those variables in APSIM-X?

The service is down. I will check this again when it works. I do not expect VMC to be a very important variable. The way we run APSIM is usually with an initial 'warm-up' period and the initial soil water content should not have a large impact when you do this.

@LenLon I'm starting to work on a solution for the InitialWater issue

Yeah with the spin-up period it's really a non-issue. Also see this issue on the ApsimX github.

@LenLon Thanks for pointing me to that issue. Have you run into the problem where APSIM complains that 'default is set to NULL' when changing InitialWater? The main reason why I'm adding this, as you suggest, is that when bringing in soils from SoilGrids the 'old' InitialValues for water could be greater than DUL or SAT and APSIM really does not like that. By changing these values (using wv1500) as you import using the 'get_isric_soil_profile' then we avoid that problem

@LenLon I have implemented something for InitialWater and I need to test it. Not sure if you need this, but it is possible to extract values from a simulation like this

dul <- as.vector(unlist(apsimx:::extract_values_apsimx("Maize.apsimx", src.dir = ".", parm.path = "$.Simulations.Simulation.Field.Soil.Physical.DUL")))
ev <- as.vector(unlist(apsimx:::extract_values_apsimx("Maize.apsimx", src.dir = ".", parm.path = "$.Simulations.Simulation.Field.Soil.Water.InitialValues")))
thcknss <- as.vector(unlist(apsimx:::extract_values_apsimx("Maize.apsimx", src.dir = ".", parm.path = "$.Simulations.Simulation.Field.Soil.Water.Thickness")))

In this way you could perform some ad hoc tests before running the simulations, so that you can catch errors beforehand.

The function 'extract_*' is not exported because it sometimes fails. There is some conflict when reading and writing to the database I think.

That looks very nice, this way you could extract anything you want, right?

Is there a way to edit anything you want then as well? :-)

The goal of the package is to be able to edit anything in the apsimx (JSON) file. However, APSIM does behave in strange ways, as you know. :)

I'm leaving this issue open until I have a more robust version of the 'get_isric_soil_profile' function.

@LenLon It is unfortunate that the SoilGrids rest api is still in beta version, because it is very convenient for building apsim soil profiles. At the moment it is working and with version 2.6.6 of the apsimx package this works well for me.

sp1 <- get_isric_soil_profile(lonlat = c(-93, 42), fix = TRUE, verbose = FALSE)
## Visualize
plot(sp1, property = "Carbon")
plot(sp1, property = "water")
plot(sp1, property = "initialwater")

I'm closing this but please open a new issue if something comes up.