public static void InitializeMetadata(int Timestep, string MapFileName, ICore mCore) { ScenarioReplicationMetadata scenRep = new ScenarioReplicationMetadata() { RasterOutCellArea = PlugIn.ModelCore.CellArea, TimeMin = PlugIn.ModelCore.StartTime, TimeMax = PlugIn.ModelCore.EndTime//, //ProjectionFilePath = "Projection.?" }; Extension = new ExtensionMetadata(mCore){ Name = PlugIn.ExtensionName, TimeInterval = Timestep, ScenarioReplicationMetadata = scenRep }; //--------------------------------------- // table outputs: //--------------------------------------- PlugIn.eventLog = new MetadataTable<EventsLog>("wind-events-log.csv"); OutputMetadata tblOut_events = new OutputMetadata() { Type = OutputType.Table, Name = "WindLog", FilePath = PlugIn.eventLog.FilePath, Visualize = false, }; tblOut_events.RetriveFields(typeof(EventsLog)); Extension.OutputMetadatas.Add(tblOut_events); //--------------------------------------- // map outputs: //--------------------------------------- OutputMetadata mapOut_Severity = new OutputMetadata() { Type = OutputType.Map, Name = "severity", FilePath = @MapFileName, Map_DataType = MapDataType.Ordinal, Map_Unit = FieldUnits.Severity_Rank, Visualize = true, }; Extension.OutputMetadatas.Add(mapOut_Severity); //--------------------------------------- MetadataProvider mp = new MetadataProvider(Extension); mp.WriteMetadataToXMLFile("Metadata", Extension.Name, Extension.Name); }
public static void InitializeMetadata(int timestep, ICore mCore) { ScenarioReplicationMetadata scenRep = new ScenarioReplicationMetadata() { RasterOutCellArea = Climate.ModelCore.CellArea, TimeMin = Climate.ModelCore.StartTime, TimeMax = Climate.ModelCore.EndTime, }; Extension = new ExtensionMetadata(mCore){ Name = "Climate-Library", TimeInterval = timestep, ScenarioReplicationMetadata = scenRep }; //--------------------------------------- // table outputs: //--------------------------------------- Climate.PdsiLog = new MetadataTable<PDSI_Log>("Climate-PDSI-log.csv"); Climate.MonthlyLog = new MetadataTable<MonthlyLog>("Climate-monthly-log.csv"); OutputMetadata tblOut_monthly = new OutputMetadata() { Type = OutputType.Table, Name = "MonthlyLog", FilePath = Climate.MonthlyLog.FilePath, Visualize = true, }; tblOut_monthly.RetriveFields(typeof(MonthlyLog)); Extension.OutputMetadatas.Add(tblOut_monthly); OutputMetadata tblOut_pdsi = new OutputMetadata() { Type = OutputType.Table, Name = "PDSILog", FilePath = Climate.PdsiLog.FilePath, Visualize = false, }; tblOut_pdsi.RetriveFields(typeof(PDSI_Log)); Extension.OutputMetadatas.Add(tblOut_pdsi); //--------------------------------------- // map outputs: //--------------------------------------- // NONE //--------------------------------------- MetadataProvider mp = new MetadataProvider(Extension); mp.WriteMetadataToXMLFile("Metadata", Extension.Name, Extension.Name); }
public static void InitializeMetadata(int Timestep, string MapFileName, IEnumerable<IModelDefinition> modelDefs, ICore mCore) { ScenarioReplicationMetadata scenRep = new ScenarioReplicationMetadata() { RasterOutCellArea = PlugIn.ModelCore.CellArea, TimeMin = PlugIn.ModelCore.StartTime, TimeMax = PlugIn.ModelCore.EndTime//, //ProjectionFilePath = "Projection.?" }; Extension = new ExtensionMetadata(mCore){ Name = PlugIn.PlugInName, TimeInterval = Timestep, ScenarioReplicationMetadata = scenRep }; //--------------------------------------- // table outputs: //--------------------------------------- // NO LOG FILE PlugIn.eventLog = new MetadataTable<EventsLog>("wind-events-log.csv"); //OutputMetadata tblOut_events = new OutputMetadata() //{ // Type = OutputType.Table, // Name = "WindLog", // FilePath = PlugIn.eventLog.FilePath, // Visualize = false, //}; //tblOut_events.RetriveFields(typeof(EventsLog)); //Extension.OutputMetadatas.Add(tblOut_events); //--------------------------------------- // map outputs: //--------------------------------------- foreach (ModelDefinition sppModel in modelDefs) { string sppMapPath = MapFileNames.ReplaceTemplateVars(MapFileName, sppModel.Name); OutputMetadata mapOut_Birds = new OutputMetadata() { Type = OutputType.Map, Name = ("Bird Species Map: " + sppModel.Name), FilePath = @MapFileName, Map_DataType = MapDataType.Continuous, //Map_Unit = FieldUnits.Severity_Rank, Visualize = true, }; Extension.OutputMetadatas.Add(mapOut_Birds); } //--------------------------------------- MetadataProvider mp = new MetadataProvider(Extension); mp.WriteMetadataToXMLFile("Metadata", Extension.Name, Extension.Name); }
public static void InitializeMetadata(int Timestep, string MapFileName, IEnumerable<IModelDefinition> modelDefs, ICore mCore, string LogFileName) { ScenarioReplicationMetadata scenRep = new ScenarioReplicationMetadata() { RasterOutCellArea = PlugIn.ModelCore.CellArea, TimeMin = PlugIn.ModelCore.StartTime, TimeMax = PlugIn.ModelCore.EndTime//, //ProjectionFilePath = "Projection.?" }; Extension = new ExtensionMetadata(mCore){ Name = PlugIn.PlugInName, TimeInterval = Timestep, ScenarioReplicationMetadata = scenRep }; /* //--------------------------------------- // table outputs: //--------------------------------------- PlugIn.habitatLog = new MetadataTable<SpeciesHabitatLog>(LogFileName); OutputMetadata tblOut_events = new OutputMetadata() { Type = OutputType.Table, Name = "SppHabitatLog", FilePath = PlugIn.habitatLog.FilePath, Visualize = true, }; tblOut_events.RetriveFields(typeof(SpeciesHabitatLog)); Extension.OutputMetadatas.Add(tblOut_events); */ //--------------------------------------- // map outputs: //--------------------------------------- foreach (ModelDefinition sppModel in modelDefs) { OutputMetadata mapOut_Birds = new OutputMetadata() { Type = OutputType.Map, Name = sppModel.Name, FilePath = @MapFileName, Map_DataType = MapDataType.Continuous, //Map_Unit = FieldUnits.Severity_Rank, Visualize = true, }; Extension.OutputMetadatas.Add(mapOut_Birds); } //--------------------------------------- MetadataProvider mp = new MetadataProvider(Extension); mp.WriteMetadataToXMLFile("Metadata", Extension.Name, Extension.Name); }
public static void InitializeMetadata(int timestep, ICore mCore) { ScenarioReplicationMetadata scenRep = new ScenarioReplicationMetadata() { RasterOutCellArea = Climate.ModelCore.CellArea, TimeMin = Climate.ModelCore.StartTime, TimeMax = Climate.ModelCore.EndTime, }; Extension = new ExtensionMetadata(mCore){ Name = "Climate-Library", TimeInterval = timestep, ScenarioReplicationMetadata = scenRep }; //--------------------------------------- // table outputs: //--------------------------------------- //Climate.PdsiLog = new MetadataTable<PDSI_Log>("Climate-PDSI-log.csv"); Climate.SpinupInputLog = new MetadataTable<InputLog>("Climate-spinup-input-log.csv"); Climate.FutureInputLog = new MetadataTable<InputLog>("Climate-future-input-log.csv"); Climate.AnnualLog = new MetadataTable<AnnualLog>("Climate-annual-log.csv"); OutputMetadata tblOut_spinupInput = new OutputMetadata() { Type = OutputType.Table, Name = "Spinup-Input-Log", FilePath = Climate.SpinupInputLog.FilePath, Visualize = false, }; tblOut_spinupInput.RetriveFields(typeof(InputLog)); Extension.OutputMetadatas.Add(tblOut_spinupInput); OutputMetadata tblOut_futureInput = new OutputMetadata() { Type = OutputType.Table, Name = "Future-Input-Log", FilePath = Climate.FutureInputLog.FilePath, Visualize = false, }; tblOut_futureInput.RetriveFields(typeof(InputLog)); Extension.OutputMetadatas.Add(tblOut_futureInput); OutputMetadata tblOut_annual = new OutputMetadata() { Type = OutputType.Table, Name = "Annual-Log", FilePath = Climate.AnnualLog.FilePath, Visualize = false, }; tblOut_annual.RetriveFields(typeof(AnnualLog)); Extension.OutputMetadatas.Add(tblOut_annual); //--------------------------------------- // map outputs: //--------------------------------------- // NONE //--------------------------------------- MetadataProvider mp = new MetadataProvider(Extension); mp.WriteMetadataToXMLFile("Metadata", Extension.Name, Extension.Name); }
public static void InitializeMetadata(int Timestep, string SpeciesMapFileName, IEnumerable<IModelDefinition> modelDefs, ICore mCore, string LogFileName, string SpeciesLogFileNames) { ScenarioReplicationMetadata scenRep = new ScenarioReplicationMetadata() { RasterOutCellArea = PlugIn.ModelCore.CellArea, TimeMin = PlugIn.ModelCore.StartTime, TimeMax = PlugIn.ModelCore.EndTime//, //ProjectionFilePath = "Projection.?" }; Extension = new ExtensionMetadata(mCore){ Name = PlugIn.PlugInName, TimeInterval = Timestep, ScenarioReplicationMetadata = scenRep }; //--------------------------------------- // table outputs: //--------------------------------------- if (LogFileName != null) { System.IO.Directory.CreateDirectory(Path.GetDirectoryName(LogFileName)); PlugIn.habitatLog = new MetadataTable<SpeciesHabitatLog>(LogFileName); OutputMetadata tblOut_events = new OutputMetadata() { Type = OutputType.Table, Name = "SppHabitatLog", FilePath = PlugIn.habitatLog.FilePath, Visualize = true, }; tblOut_events.RetriveFields(typeof(SpeciesHabitatLog)); Extension.OutputMetadatas.Add(tblOut_events); } if (SpeciesLogFileNames != null) { PlugIn.sppLogs = new MetadataTable<IndividualSpeciesHabitatLog>[50]; int selectModelCount = 0; foreach (ModelDefinition sppModel in modelDefs) { string sppLogPath = BirdHabitat.SpeciesLogFileNames.ReplaceTemplateVars(SpeciesLogFileNames, sppModel.Name); System.IO.Directory.CreateDirectory(Path.GetDirectoryName(sppLogPath)); PlugIn.sppLogs[selectModelCount] = new MetadataTable<IndividualSpeciesHabitatLog>(sppLogPath); selectModelCount++; OutputMetadata tblOut_events = new OutputMetadata() { Type = OutputType.Table, Name = ("SpeciesLog_" + sppModel.Name), FilePath = sppLogPath, Visualize = true, }; tblOut_events.RetriveFields(typeof(IndividualSpeciesHabitatLog)); Extension.OutputMetadatas.Add(tblOut_events); } } //--------------------------------------- // map outputs: //--------------------------------------- foreach (ModelDefinition sppModel in modelDefs) { string sppMapPath = SpeciesMapFileNames.ReplaceTemplateVars(SpeciesMapFileName, sppModel.Name); OutputMetadata mapOut_Birds = new OutputMetadata() { Type = OutputType.Map, Name = ("Species Habitat Map: " + sppModel.Name), //sppModel.Name, FilePath = @sppMapPath, Map_DataType = MapDataType.Continuous, Map_Unit = "Index of Abundance", Visualize = true, }; Extension.OutputMetadatas.Add(mapOut_Birds); } //--------------------------------------- MetadataProvider mp = new MetadataProvider(Extension); mp.WriteMetadataToXMLFile("Metadata", Extension.Name, Extension.Name); }
public static void InitializeMetadata(int Timestep, string severityMapFileName, string srdMapFileName, string nrdMapFileName, string logFileName, IEnumerable<IAgent> manyAgentParameters, ICore mCore) { ScenarioReplicationMetadata scenRep = new ScenarioReplicationMetadata() { //String outputFolder = OutputPath.ReplaceTemplateVars("", FINISH ME LATER); //FolderName = System.IO.Directory.GetCurrentDirectory().Split("\\".ToCharArray()).Last(), RasterOutCellArea = PlugIn.ModelCore.CellArea, TimeMin = PlugIn.ModelCore.StartTime, TimeMax = PlugIn.ModelCore.EndTime, //ProjectionFilePath = "Projection.?" //How do we get projections??? }; Extension = new ExtensionMetadata(mCore){ Name = PlugIn.ExtensionName, TimeInterval = Timestep, //change this to PlugIn.TimeStep for other extensions ScenarioReplicationMetadata = scenRep }; //--------------------------------------- // table outputs: //--------------------------------------- //PlugIn.EventLog = new MetadataTable<EventsLog>(logFileName); PlugIn.EventLog = new MetadataTable<EventsLog>("bda-log.csv"); OutputMetadata tblOut_events = new OutputMetadata() { Type = OutputType.Table, Name = "EventLog", FilePath = PlugIn.EventLog.FilePath, Visualize = false, }; tblOut_events.RetriveFields(typeof(EventsLog)); Extension.OutputMetadatas.Add(tblOut_events); //PlugIn.PDSILog = new MetadataTable<PDSI_Log>("PDSI_log.csv"); //OutputMetadata tblOut_PDSI = new OutputMetadata() //{ // Type = OutputType.Table, // Name = "PDSILog", // FilePath = PlugIn.PDSILog.FilePath //}; //tblOut_events.RetriveFields(typeof(PDSI_Log)); //Extension.OutputMetadatas.Add(tblOut_PDSI); //--------------------------------------- // map outputs: //--------------------------------------- foreach (IAgent activeAgent in manyAgentParameters) { string mapTypePath = MapNames.ReplaceTemplateVarsMetadata(severityMapFileName, activeAgent.AgentName); OutputMetadata mapOut_Severity = new OutputMetadata() { Type = OutputType.Map, Name = System.String.Format(activeAgent.AgentName + " Outbreak Severity"), FilePath = @mapTypePath, Map_DataType = MapDataType.Ordinal, Map_Unit = FieldUnits.Severity_Rank, Visualize = true, }; Extension.OutputMetadatas.Add(mapOut_Severity); if (srdMapFileName != null) { mapTypePath = MapNames.ReplaceTemplateVarsMetadata(srdMapFileName, activeAgent.AgentName); OutputMetadata mapOut_SRD = new OutputMetadata() { Type = OutputType.Map, Name = "Site Resource Dominance", FilePath = @mapTypePath, Map_DataType = MapDataType.Continuous, Map_Unit = FieldUnits.Percentage, Visualize = false, }; Extension.OutputMetadatas.Add(mapOut_SRD); } if (nrdMapFileName != null) { mapTypePath = MapNames.ReplaceTemplateVarsMetadata(nrdMapFileName, activeAgent.AgentName); OutputMetadata mapOut_NRD = new OutputMetadata() { Type = OutputType.Map, Name = "Neighborhood Resource Dominance", FilePath = @mapTypePath, Map_DataType = MapDataType.Continuous, Map_Unit = FieldUnits.Percentage, Visualize = false, }; Extension.OutputMetadatas.Add(mapOut_NRD); } } //--------------------------------------- MetadataProvider mp = new MetadataProvider(Extension); mp.WriteMetadataToXMLFile("Metadata", Extension.Name, Extension.Name); }
public static void InitializeMetadata(int Timestep, string MapFileName, string eventLogName, string summaryLogName) { ScenarioReplicationMetadata scenRep = new ScenarioReplicationMetadata() { RasterOutCellArea = PlugIn.ModelCore.CellArea, TimeMin = PlugIn.ModelCore.StartTime, TimeMax = PlugIn.ModelCore.EndTime, }; Extension = new ExtensionMetadata(PlugIn.ModelCore) //Extension = new ExtensionMetadata() { Name = PlugIn.ExtensionName, TimeInterval = Timestep, //change this to PlugIn.TimeStep for other extensions ScenarioReplicationMetadata = scenRep }; //--------------------------------------- // table outputs: //--------------------------------------- CreateDirectory(eventLogName); CreateDirectory(summaryLogName); PlugIn.eventLog = new MetadataTable<EventsLog>(eventLogName); PlugIn.summaryLog = new MetadataTable<SummaryLog>(summaryLogName); //PlugIn.eventLog = new MetadataTable<EventsLog>("Harvest-event-log.csv"); //PlugIn.summaryLog = new MetadataTable<SummaryLog>("Harvest-summary-log.csv"); PlugIn.ModelCore.UI.WriteLine(" Generating event table..."); OutputMetadata tblOut_events = new OutputMetadata() { Type = OutputType.Table, Name = "EventLog", FilePath = PlugIn.eventLog.FilePath, Visualize = false, }; tblOut_events.RetriveFields(typeof(EventsLog)); Extension.OutputMetadatas.Add(tblOut_events); PlugIn.ModelCore.UI.WriteLine(" Generating summary table..."); OutputMetadata tblOut_summary = new OutputMetadata() { Type = OutputType.Table, Name = "SummaryLog", FilePath = PlugIn.summaryLog.FilePath, Visualize = true, }; tblOut_summary.RetriveFields(typeof(SummaryLog)); Extension.OutputMetadatas.Add(tblOut_summary); //--------------------------------------- // map outputs: //--------------------------------------- //OutputMetadata mapOut_BiomassRemoved = new OutputMetadata() //{ // Type = OutputType.Map, // Name = "biomass removed", // FilePath = @HarvestMapName, // Map_DataType = MapDataType.Continuous, // Map_Unit = FieldUnits.Mg_ha, // Visualize = true, //}; //Extension.OutputMetadatas.Add(mapOut_BiomassRemoved); OutputMetadata mapOut_Prescription = new OutputMetadata() { Type = OutputType.Map, Name = "prescription", FilePath = @MapFileName, Map_DataType = MapDataType.Nominal, Visualize = true, //Map_Unit = "categorical", }; Extension.OutputMetadatas.Add(mapOut_Prescription); //--------------------------------------- MetadataProvider mp = new MetadataProvider(Extension); mp.WriteMetadataToXMLFile("Metadata", Extension.Name, Extension.Name); }
public static void InitializeMetadata(int Timestep, IEnumerable<IMapDefinition> mapDefs, string mapNameTemplate) { ScenarioReplicationMetadata scenRep = new ScenarioReplicationMetadata() { RasterOutCellArea = PlugIn.ModelCore.CellArea, TimeMin = PlugIn.ModelCore.StartTime, TimeMax = PlugIn.ModelCore.EndTime, }; Extension = new ExtensionMetadata(PlugIn.ModelCore){ Name = PlugIn.ExtensionName, TimeInterval = Timestep, ScenarioReplicationMetadata = scenRep }; //--------------------------------------- // table outputs: //--------------------------------------- //PlugIn.individualForestTypeLog = new MetadataTable<ForestTypeLog>[50]; //foreach (IMapDefinition map in mapDefs) //{ // int forestTypesCnt = 0; // List<IForestType> forestTypes = map.ForestTypes; // foreach (IForestType ftype in forestTypes) // { // string forestTypeLogName = ("output-leaf-biomass-reclass/" + ftype.Name + "-forest-type-log.csv"); // CreateDirectory(forestTypeLogName); // PlugIn.individualForestTypeLog[forestTypesCnt] = new MetadataTable<ForestTypeLog>(forestTypeLogName); // OutputMetadata tblOut_events = new OutputMetadata() // { // Type = OutputType.Table, // Name = "ForestTypeCountLog", // FilePath = PlugIn.individualForestTypeLog[forestTypesCnt].FilePath, // Visualize = true // }; // tblOut_events.RetriveFields(typeof(ForestTypeLog)); // Extension.OutputMetadatas.Add(tblOut_events); // forestTypesCnt++; // } // break; // only the first one. //} // RMS 03/2016: Added dynamic column names. PlugIn.individualMapDefLog = new MetadataTable<MapDefLog>[50]; int mapDefCnt = 0; foreach (IMapDefinition map in mapDefs) { int forestTypeCnt = 0; List<string> forestTypeNames = new List<string>(); foreach (IForestType ftype in map.ForestTypes) { forestTypeNames.Add(ftype.Name); forestTypeCnt++; } PlugIn.forestTypeNames[mapDefCnt] = forestTypeNames; ExtensionMetadata.ColumnNames = PlugIn.forestTypeNames[mapDefCnt]; string forestTypeLogName = ("output-leaf-biomass-reclass/" + map.Name + "-forest-type-log.csv"); CreateDirectory(forestTypeLogName); PlugIn.individualMapDefLog[mapDefCnt] = new MetadataTable<MapDefLog>(forestTypeLogName); OutputMetadata tblOut_events = new OutputMetadata() { Type = OutputType.Table, Name = "ForestTypeCountLog", FilePath = PlugIn.individualMapDefLog[mapDefCnt].FilePath, Visualize = true }; tblOut_events.RetriveFields(typeof(MapDefLog)); Extension.OutputMetadatas.Add(tblOut_events); mapDefCnt++; } //--------------------------------------- // map outputs: //--------------------------------------- //PlugIn.ModelCore.UI.WriteLine(" Writing biomass maps ..."); foreach (IMapDefinition map in mapDefs) { string mapTypePath = MapFileNames.ReplaceTemplateVarsMetadata(mapNameTemplate, map.Name); OutputMetadata mapOut_ForestType = new OutputMetadata() { Type = OutputType.Map, Name = (map.Name + " Forest Type Map"), FilePath = @mapTypePath, Map_DataType = MapDataType.Nominal, Visualize = true//, }; Extension.OutputMetadatas.Add(mapOut_ForestType); } //--------------------------------------- MetadataProvider mp = new MetadataProvider(Extension); mp.WriteMetadataToXMLFile("Metadata", Extension.Name, Extension.Name); }
public static void InitializeMetadata(int timestep, ICore mCore, string SoilCarbonMapNames, string SoilNitrogenMapNames, string ANPPMapNames, string ANEEMapNames, string TotalCMapNames) { ScenarioReplicationMetadata scenRep = new ScenarioReplicationMetadata() { RasterOutCellArea = PlugIn.ModelCore.CellArea, TimeMin = PlugIn.ModelCore.StartTime, TimeMax = PlugIn.ModelCore.EndTime, }; Extension = new ExtensionMetadata(mCore){ Name = "NECN-Succession", TimeInterval = timestep, ScenarioReplicationMetadata = scenRep }; //--------------------------------------- // table outputs: //--------------------------------------- Outputs.primaryLog = new MetadataTable<PrimaryLog>("NECN-succession-log.csv"); Outputs.primaryLogShort = new MetadataTable<PrimaryLogShort>("NECN-succession-log-short.csv"); Outputs.monthlyLog = new MetadataTable<MonthlyLog>("NECN-succession-monthly-log.csv"); OutputMetadata tblOut_monthly = new OutputMetadata() { Type = OutputType.Table, Name = "MonthlyLog", FilePath = Outputs.monthlyLog.FilePath, Visualize = true, }; tblOut_monthly.RetriveFields(typeof(MonthlyLog)); Extension.OutputMetadatas.Add(tblOut_monthly); OutputMetadata tblOut_primary = new OutputMetadata() { Type = OutputType.Table, Name = "PrimaryLog", FilePath = Outputs.primaryLog.FilePath, Visualize = false, }; tblOut_primary.RetriveFields(typeof(PrimaryLog)); Extension.OutputMetadatas.Add(tblOut_primary); OutputMetadata tblOut_primaryShort = new OutputMetadata() { Type = OutputType.Table, Name = "PrimaryLogShort", FilePath = Outputs.primaryLogShort.FilePath, Visualize = true, }; tblOut_primaryShort.RetriveFields(typeof(PrimaryLogShort)); Extension.OutputMetadatas.Add(tblOut_primaryShort); //--------------------------------------- // map outputs: //--------------------------------------- if (ANPPMapNames != null) { OutputMetadata mapOut_ANPP = new OutputMetadata() { Type = OutputType.Map, Name = "Aboveground Net Primary Production", FilePath = @"NECN\AG_NPP-{timestep}.gis", //century Map_DataType = MapDataType.Continuous, Map_Unit = FieldUnits.g_C_m2, Visualize = true, }; Extension.OutputMetadatas.Add(mapOut_ANPP); } if (ANEEMapNames != null) { OutputMetadata mapOut_Nee = new OutputMetadata() { Type = OutputType.Map, Name = "Net Ecosystem Exchange", FilePath = @"NECN\NEE-{timestep}.gis", //century Map_DataType = MapDataType.Continuous, Map_Unit = FieldUnits.g_C_m2, Visualize = true, }; Extension.OutputMetadatas.Add(mapOut_Nee); } if (SoilCarbonMapNames != null) { OutputMetadata mapOut_SOC = new OutputMetadata() { Type = OutputType.Map, Name = "Soil Organic Carbon", FilePath = @"NECN\SOC-{timestep}.gis", //century Map_DataType = MapDataType.Continuous, Map_Unit = FieldUnits.g_C_m2, Visualize = true, }; Extension.OutputMetadatas.Add(mapOut_SOC); } if (SoilNitrogenMapNames != null) { OutputMetadata mapOut_SON = new OutputMetadata() { Type = OutputType.Map, Name = "Soil Organic Nitrogen", FilePath = @"NECN\SON-{timestep}.gis", //century Map_DataType = MapDataType.Continuous, Map_Unit = FieldUnits.g_N_m2, Visualize = true, }; Extension.OutputMetadatas.Add(mapOut_SON); } if (TotalCMapNames != null) { OutputMetadata mapOut_TotalC = new OutputMetadata() { Type = OutputType.Map, Name = "Total Carbon", FilePath = @"NECN\TotalC-{timestep}.gis", //century Map_DataType = MapDataType.Continuous, Map_Unit = FieldUnits.g_C_m2, Visualize = true, }; Extension.OutputMetadatas.Add(mapOut_TotalC); } //--------------------------------------- MetadataProvider mp = new MetadataProvider(Extension); mp.WriteMetadataToXMLFile("Metadata", Extension.Name, Extension.Name); }
public static void InitializeMetadata(int Timestep, string MapFileName, string logFileName, IEnumerable<IInsect> insects, ICore mCore) { ScenarioReplicationMetadata scenRep = new ScenarioReplicationMetadata() { RasterOutCellArea = PlugIn.ModelCore.CellArea, TimeMin = PlugIn.ModelCore.StartTime, TimeMax = PlugIn.ModelCore.EndTime, }; Extension = new ExtensionMetadata(mCore){ Name = PlugIn.ExtensionName, TimeInterval = 1, //Timestep, //change this to PlugIn.TimeStep for other extensions ScenarioReplicationMetadata = scenRep }; //--------------------------------------- // table outputs: //--------------------------------------- PlugIn.eventLog = new MetadataTable<EventsLog>("insects-log.csv"); OutputMetadata tblOut_events = new OutputMetadata() { Type = OutputType.Table, Name = "EventsLog", FilePath = PlugIn.eventLog.FilePath, Visualize = false, }; tblOut_events.RetriveFields(typeof(EventsLog)); Extension.OutputMetadatas.Add(tblOut_events); //--------------------------------------- // map outputs: //--------------------------------------- foreach (IInsect insect in insects) { string mapPath = MapNames.ReplaceTemplateVarsMetadata(MapFileName, insect.Name); OutputMetadata mapOut_GrowthReduction = new OutputMetadata() { Type = OutputType.Map, Name = "Growth Reduction", FilePath = @mapPath, Map_DataType = MapDataType.Continuous, Map_Unit = FieldUnits.Percentage, Visualize = false, }; Extension.OutputMetadatas.Add(mapOut_GrowthReduction); mapPath = MapNames.ReplaceTemplateVarsMetadata(MapFileName, ("InitialPatchMap-" + insect.Name)); OutputMetadata mapOut_InitialPatchProb = new OutputMetadata() { Type = OutputType.Map, Name = "Initial Outbreak Probabilities", FilePath = @mapPath, Map_DataType = MapDataType.Continuous, Map_Unit = FieldUnits.Percentage, Visualize = false, }; Extension.OutputMetadatas.Add(mapOut_InitialPatchProb); mapPath = MapNames.ReplaceTemplateVarsMetadata(MapFileName, ("BiomassRemoved-" + insect.Name)); OutputMetadata mapOut_BiomassRemoved = new OutputMetadata() { Type = OutputType.Map, Name = System.String.Format(insect.Name + " Biomass Mortality"), FilePath = @mapPath, Map_DataType = MapDataType.Continuous, Map_Unit = FieldUnits.Mg_ha, Visualize = true, }; Extension.OutputMetadatas.Add(mapOut_BiomassRemoved); } //--------------------------------------- MetadataProvider mp = new MetadataProvider(Extension); mp.WriteMetadataToXMLFile("Metadata", Extension.Name, Extension.Name); }
public static void InitializeMetadata(int Timestep, IEnumerable<ISpecies> selectedSpecies, string sppMapNames, ICore mCore) { ScenarioReplicationMetadata scenRep = new ScenarioReplicationMetadata() { RasterOutCellArea = PlugIn.ModelCore.CellArea, TimeMin = PlugIn.ModelCore.StartTime, TimeMax = PlugIn.ModelCore.EndTime }; Extension = new ExtensionMetadata(mCore){ Name = PlugIn.ExtensionName, TimeInterval = Timestep, ScenarioReplicationMetadata = scenRep }; //--------------------------------------- // table outputs: //--------------------------------------- string sppBiomassLog = ("output-leaf-biomass/spp-biomass-log.csv"); CreateDirectory(sppBiomassLog); PlugIn.sppBiomassLog = new MetadataTable<SppBiomassLog>(sppBiomassLog); OutputMetadata tblOut_events = new OutputMetadata() { Type = OutputType.Table, Name = "SppBiomassLog", FilePath = PlugIn.sppBiomassLog.FilePath, Visualize = true }; tblOut_events.RetriveFields(typeof(SppBiomassLog)); Extension.OutputMetadatas.Add(tblOut_events); //PlugIn.individualBiomassLog = new MetadataTable<SppBiomassLog>[50]; //int selectSppCnt = 0; //foreach (ISpecies species in selectedSpecies) //{ // string individualBiomassLog = ("output-leaf-biomass/" + species.Name + "-biomass-log.csv"); // CreateDirectory(individualBiomassLog); // PlugIn.individualBiomassLog[selectSppCnt] = new MetadataTable<SppBiomassLog>(individualBiomassLog); // selectSppCnt++; // tblOut_events = new OutputMetadata() // { // Type = OutputType.Table, // Name = (species.Name + "BiomassLog"), // FilePath = PlugIn.sppBiomassLog.FilePath, // Visualize = false // }; // tblOut_events.RetriveFields(typeof(SppBiomassLog)); // Extension.OutputMetadatas.Add(tblOut_events); //} //int selectSppCnt = 0; //PlugIn.sppBiomassLogLandscape = new MetadataTable<SppBiomassLogLandscape>; //foreach (ISpecies species in selectedSpecies) //{ string sppBiomassLogLandscape = ("output-leaf-biomass/biomass-log-landscape.csv"); CreateDirectory(sppBiomassLogLandscape); PlugIn.sppBiomassLogLandscape = new MetadataTable<SppBiomassLogLandscape>(sppBiomassLogLandscape); //selectSppCnt++; tblOut_events = new OutputMetadata() { Type = OutputType.Table, Name = ("BiomassLogLandscape"), FilePath = PlugIn.sppBiomassLogLandscape.FilePath, Visualize = true }; tblOut_events.RetriveFields(typeof(SppBiomassLogLandscape)); Extension.OutputMetadatas.Add(tblOut_events); //} //--------------------------------------- // map outputs: //--------------------------------------- if (PlugIn.MakeMaps) { foreach (ISpecies species in selectedSpecies) { string sppMapPath = MapNames.ReplaceTemplateVars(sppMapNames, species.Name); OutputMetadata mapOut_SppBiomass = new OutputMetadata() { Type = OutputType.Map, Name = ("Species Biomass Map: " + species.Name), FilePath = @sppMapPath, Map_DataType = MapDataType.Continuous, Map_Unit = FieldUnits.g_B_m2, Visualize = true }; Extension.OutputMetadatas.Add(mapOut_SppBiomass); } } string totalBioMapPath = MapNames.ReplaceTemplateVars(sppMapNames, "TotalBiomass"); OutputMetadata mapOut_TotalBiomass = new OutputMetadata() { Type = OutputType.Map, Name = ("Total Biomass Map"), FilePath = @totalBioMapPath, Map_DataType = MapDataType.Continuous, Map_Unit = FieldUnits.g_B_m2, Visualize = true }; Extension.OutputMetadatas.Add(mapOut_TotalBiomass); //--------------------------------------- MetadataProvider mp = new MetadataProvider(Extension); mp.WriteMetadataToXMLFile("Metadata", Extension.Name, Extension.Name); }