APSIMInitiative / ApsimX

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

No genotype parameters for Sugarcane #9155

Closed daSilva5 closed 1 month ago

daSilva5 commented 1 month ago

What happened?

Hi, Following examples of how to access genotype parameters for wheat https://www.youtube.com/watch?v=N5HGqRO5Krc by right clicking the Plant Model and asking for showing Model Structure. When you right click Sugarcane plant module, this option is already selected and there is nothing there.

Kind regards, Isis

What Operating System are you on?

Windows

BrianCollinss commented 1 month ago

See https://github.com/APSIMInitiative/ApsimX/issues/8397 and https://github.com/APSIMInitiative/ApsimX/issues/8259

daSilva5 commented 1 month ago

Thanks I will continue the discussion there.

par456 commented 1 month ago

The script that was provided in that previous issue wasn't working anymore, so I've re-written it and added it to the management toolbox so it doesn't get lost.

Once that's merged in, you should be able to add that script to your project and modify the parameters you want.

hol353 commented 1 month ago

Rather than a manager script, a better way is to add a cultivar to the sugar cane model, name it whatever you want and then specify the parameters that you want to change. You can then sow that cultivar.

par456 commented 1 month ago

Having a look into the sugarcane model, it uses a system called "CultivarConstants" that holds the values that it refers to as the simulation is running, instead of doing overrides like the normal Cultivar system does. So Cultivar is not really compatible with how sugarcane works.

I could write some code to convert a Cultivar model into a CultivarConstants, however because the parameters are referenced directly, you can't just change one value, every value of the cultivar has to be defined. That's why the script I wrote above modified an existing cultivar, it needs a set of default values to set everything to before applying the changes.

daSilva5 commented 1 month ago

Having a look into the sugarcane model, it uses a system called "CultivarConstants" that holds the values that it refers to as the simulation is running, instead of doing overrides like the normal Cultivar system does. So Cultivar is not really compatible with how sugarcane works.

I could write some code to convert a Cultivar model into a CultivarConstants, however because the parameters are referenced directly, you can't just change one value, every value of the cultivar has to be defined. That's why the script I wrote above modified an existing cultivar, it needs a set of default values to set everything to before applying the changes.

But the way I see this, is that I would copy an existing variety, change the name and just change the parameters of interest, keeping all other constant in the xml file. Therefore it would have all other constants, right? Or not?

About changing constants, is it safe to alter, for example lodge_redn_photo, from the constants above in the xml script for plant crop and ratoon?

Also, if I change the xml script, it does take effect while running the models in R using the apsimx package, right? Because it is using the installed structure from APSIM new gen.

Ok, maybe I am going too far, but if it is something I can only edit in the xml script, could I pull different xml scripts into APSIM using R, just to run multiple simulations with different parameters?

par456 commented 1 month ago

After talking with Dean about this, we are going to actually improve sugarcane so that it can use the cultivar system like he described above. That'll make it much easier to modify the parameters you are looking to change in a way that apsim is designed to support, instead of hacking it with a manager script.