//--------------------------------------------------------------------- /// <summary> /// Writes an output map of prescriptions that harvested each active site. /// </summary> private void WritePrescriptionMap(int timestep) { string path = MapNames.ReplaceTemplateVars(nameTemplate, timestep); ModelCore.UI.WriteLine(" Writing prescription map to {0} ...", path); using (IOutputRaster <ShortPixel> outputRaster = modelCore.CreateRaster <ShortPixel>(path, modelCore.Landscape.Dimensions)) { ShortPixel pixel = outputRaster.BufferPixel; foreach (Site site in modelCore.Landscape.AllSites) { if (site.IsActive) { Prescription prescription = HarvestMgmtLib.SiteVars.Prescription[site]; if (prescription == null) { pixel.MapCode.Value = 1; } else { pixel.MapCode.Value = (short)(prescription.Number + 1); } } else { // Inactive site pixel.MapCode.Value = 0; } outputRaster.WriteBufferPixel(); } } }
//--------------------------------------------------------------------- /// <summary> /// Writes an output map of biomass removed from each active site. /// </summary> /// <param name="timestep"> /// Timestep to use in the map's name. /// </param> public void WriteMap(int timestep) { string path = MapNames.ReplaceTemplateVars(nameTemplate, timestep); PlugIn.ModelCore.UI.WriteLine(" Writing biomass-removed map to {0} ...", path); using (IOutputRaster <IntPixel> outputRaster = PlugIn.ModelCore.CreateRaster <IntPixel>(path, PlugIn.ModelCore.Landscape.Dimensions)) { IntPixel pixel = outputRaster.BufferPixel; foreach (Site site in PlugIn.ModelCore.Landscape.AllSites) { pixel.MapCode.Value = (int)Math.Round(SiteVars.BiomassRemoved[site]); outputRaster.WriteBufferPixel(); } } }