APSIMInitiative / ApsimX

ApsimX is the next generation of APSIM
http://www.apsim.info
Other
134 stars 162 forks source link

Modifying soil layers #5442

Closed iMarang closed 4 years ago

iMarang commented 4 years ago

I have soil test data for a site that doesn't conform to default depths, but when I modify it in the GUI I'm getting strange InitialWater values and the number of increments always reverts back to 7.

Default depths 0-15, 15-30, 30-60, 60-90, 90-120, 120-150, 150-180

Site depths 0-10, 10-30, 30-60, 60-90, 90-120, 120-150

I assume this is just marked as Read Only so I need to add a replacement node for the soil profile? Do I add this at the Simulation level (with the Wheat module I've added to allow genetic coefficient calibration)? Or is it something else? Thanks

hol430 commented 4 years ago

Hi @iMarang - which version of apsim are you using? I made a fix in this area a week or 2 ago which may affect this. Also would you be able to upload your .apsimx file?

iMarang commented 4 years ago

Hi Drew, thanks for getting back so quick :) I downloaded this back in Jan this year, though must confess I'm not sure how to check the version number ... I'm on a mac so suspect the GUI is a little different through Mono. The "Version" number listed at the start of the .apsimx is 73 Berwicks_template_HIGH.apsimx.zip

hol430 commented 4 years ago

Hi Ian, yeah apsim struggles sometimes when there are more than 1 empty rows at the bottom of the profile grid:

image

In the older version, you can remove an empty row/layer by selecting the entire row at once and hitting delete ( you can shift-click to select multiple cells). In a more recent version, deleting any cell in an empty row will cause the entire row to be removed.

iMarang commented 4 years ago

Makes sense, thanks Drew. I've tried deleting the empty row, but 2 issues: (1) on the mac GUI the "depth" column is separated from any values columns so all can't selected at once, and (2) there are layers listed for Physical, Physical.WheatSoil, SoilWater, Organic, Chemical and InitialN and when I shift to a different module after deleting a depth cell (and seeing the graph depiction change accordingly), it reverts to including the extra row. If I just reinstall it with a fresh git clone, will that fix it?

BTW python integration for the calibration is working nicely, though even with parallel processing it takes a while. Still not sure about how to incorporate the data assimilation on LAI, (maybe you remember the email chain from last year) ... I may need to pick your brain again soon as I suspect it may require a complete re-work of my design.

iMarang commented 4 years ago

I downloaded and rebuilt ApsimNG and can now delete the soil layers, awesome.

Now though I'm getting an error when I run the simulation:

System.Exception: ERROR in file: /Users/IanM/Documents/project/Crop/APSIM/Berwicks/ensemble_Manning/Berwicks_template_HIGH.apsimx Simulation name: Simulation System.Exception: Duplicate Names in Wheat has duplicate cultivar names Gladius,Mace,Ruby,Ventura,Yitpi,Young at Models.PMF.Plant.OnSimulationCommencing (System.Object sender, System.EventArgs e) [0x0011b] in /Users/IanM/Documents/project/Crop/APSIM/ApsimX-master/Models/Plant/Plant.cs:304 at (wrapper delegate-invoke) .invoke_void_object_EventArgs(object,System.EventArgs) at Models.Core.Simulation.Run (System.Threading.CancellationTokenSource cancelToken) [0x00188] in /Users/IanM/Documents/project/Crop/APSIM/ApsimX-master/Models/Core/Simulation.cs:263 ---> System.Exception: Duplicate Names in Wheat has duplicate cultivar names Gladius,Mace,Ruby,Ventura,Yitpi,Young at Models.PMF.Plant.OnSimulationCommencing (System.Object sender, System.EventArgs e) [0x0011b] in /Users/IanM/Documents/project/Crop/APSIM/ApsimX-master/Models/Plant/Plant.cs:304 at (wrapper delegate-invoke) .invoke_void_object_EventArgs(object,System.EventArgs) at Models.Core.Simulation.Run (System.Threading.CancellationTokenSource cancelToken) [0x00188] in /Users/IanM/Documents/project/Crop/APSIM/ApsimX-master/Models/Core/Simulation.cs:263 --- End of inner exception stack trace --- at Models.Core.Simulation.Run (System.Threading.CancellationTokenSource cancelToken) [0x00229] in /Users/IanM/Documents/project/Crop/APSIM/ApsimX-master/Models/Core/Simulation.cs:278 at Models.Core.Run.SimulationDescription.Run (System.Threading.CancellationTokenSource cancelToken) [0x0000e] in /Users/IanM/Documents/project/Crop/APSIM/ApsimX-master/Models/Core/Run/SimulationDescription.cs:111 at APSIM.Shared.JobRunning.JobRunner.RunActualJob (APSIM.Shared.JobRunning.IRunnable job, APSIM.Shared.JobRunning.IJobManager jobManager) [0x0004b] in /Users/IanM/Documents/project/Crop/APSIM/ApsimX-master/APSIM.Shared/JobRunning/JobRunner.cs:173

(My added bold as this is the msg in GUI.) This is probably from having the replacement node for Wheat in there? Strange that it only affects those cultivars though.

Also, when I built it I got a warning. Seems to run anyway so probably not critical.

/Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(5,5): Warning MSB3276: Found conflicts between different versions of the same dependent assembly. Please set the "AutoGenerateBindingRedirects" property to true in the project file. For more information, see http://go.microsoft.com/fwlink/?LinkId=294190. (MSB3276) (Models)

hol430 commented 4 years ago

Have you added any aliases for cultivars? Looking at the wheat model under replacements in your file, it has a cultivar called Gladius (in the Australia folder) and it also has a cultivar called Hartog, and one of Hartog's aliases is "Gladius". This is what's causing the error (there are a few other duplicates as well - mace, ruby, ...).

If you haven't added any cultivars/aliases, then I have no idea how they ended up here - best option would probably be to delete the wheat model from replacements, and add in a fresh one (right click replacements -> add model -> choose wheat inside the PMF folder).

If you've made some changes to the wheat model which you need to keep, you should be able to

  1. Delete cultivar folder from under wheat
  2. Add in a second wheat model via the above steps
  3. Copy cultivar folder from second (new) wheat model onto the first wheat model
  4. Delete second wheat model

As for the binding redirect error - I get them too on my linux builds. It would be good to fix them at some point but for now you can probably just ignore it.

iMarang commented 4 years ago

No, I haven't added any aliases. I removed Hartog, but still got the duplicate errors on Mace, Ruby, Ventura and Young so I deleted those also and it seems to run fine now. Thanks for your help, I'll follow up in a few weeks when I'm ready to run the initial runs of the data assimilation framework.