/// <summary> /// Changes GsMax to Gsmax350 in all models that implement ICanopy. /// </summary> /// <param name="root">The root JSON token.</param> /// <param name="fileName">The name of the apsimx file.</param> private static void UpgradeToVersion51(JObject root, string fileName) { // Create a list of models that might have gsmax. // Might need to add in other models that implement ICanopy // e.g. OilPalm, AgPastureSpecies, SimpleTree, Sugarcane var models = new List <JObject>(); models.AddRange(JsonUtilities.ChildrenOfType(root, "Leaf")); models.AddRange(JsonUtilities.ChildrenOfType(root, "SimpleLeaf")); models.AddRange(JsonUtilities.ChildrenOfType(root, "PerennialLeaf")); models.AddRange(JsonUtilities.ChildrenOfType(root, "SorghumLeaf")); // Loop through all models and rename Gsmax to Gsmax350. foreach (var model in models) { JsonUtilities.RenameProperty(model, "Gsmax", "Gsmax350"); JsonUtilities.AddConstantFunctionIfNotExists(model, "StomatalConductanceCO2Modifier", "1.0"); } }