private static void LoadConfigDataObjects(Sitplugin plugin, JToken dataConfig) { var parseClassifierSet = new Func <JToken, string>((t) => { return(String.Join(",", t.Select(a => (string)a))); }); foreach (var i in dataConfig["inventory"]) { plugin.AddInventory( classifierSet: parseClassifierSet(i["classifier_set"]), area: (double)i["area"], age: (int)i["age"], spatialReference: Unpack(i, "spatial_reference", -1), delay: Unpack(i, "delay", 0), unfcccLandClass: Unpack(i, "unfccc_land_class", 0), HistoricDisturbance: Unpack(i, "historic_disturbance", (string)null), MostRecentDisturbance: Unpack(i, "last_pass_disturbance", (string)null)); } foreach (var i in dataConfig["disturbance_events"]) { plugin.AddDisturbanceEvent( classifierSet: parseClassifierSet(i["classifier_set"]), disturbanceType: (string)i["disturbance_type"], timestep: (int)i["time_step"], target: (double)i["target"], targetType: (string)i["target_type"], sort: (string)i["sort"], spatialReference: Unpack(i, "spatial_reference", -1), ageMin: Unpack(i, "age_min", -1), ageMax: Unpack(i, "age_max", -1), efficiency: Unpack(i, "efficiency", 1.0), eligibility: i["eligibility"]?.Select(a => (double)a).ToArray()); } foreach (var i in dataConfig["yield"]) { plugin.AddYield( classifierSet: parseClassifierSet(i["classifier_set"]), leadingSpeciesClassifierValue: (string)i["leading_species_classifier_value"], values: i["values"].Select(a => (double)a).ToList()); } if (dataConfig["transition_rules"] != null) { foreach (var i in dataConfig["transition_rules"]) { plugin.AddTransitionRule( classifierSetSource: parseClassifierSet(i["classifier_set_source"]), classifierSetTarget: parseClassifierSet(i["classifier_set_target"]), disturbanceType: (string)i["disturbance_type"], percent: Unpack(i, "percent", 100.0), spatialReference: Unpack(i, "spatial_reference", -1), ageMin: Unpack(i, "age_min", -1), ageMax: Unpack(i, "age_max", -1), resetAge: Unpack(i, "reset_age", -1), regenDelay: Unpack(i, "regen_delay", 0)); } } }