Files
LeafWeb/Core/Entities/LeafInputData.cs
T

77 lines
2.8 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using LeafWeb.Core.Utility;
namespace LeafWeb.Core.Entities
{
/// <summary>
/// Descriptive information about the investigator,
/// contact information, the site,the sample leaf and its general environmental condition
/// </summary>
public class LeafInputData
{
[ForeignKey("LeafOutputFile")]
public int Id { get; set; }
public virtual LeafInputDataSite Site { get; set; }
public virtual LeafInputDataPhotosynthetic Photosynthetic { get; set; }
public virtual ICollection<LeafInputDataCurve> Data { get; set; }
/// <summary>
/// Leaf Input set this data belongs to
/// </summary>
public virtual LeafInput LeafInput { get; set; }
/// <summary>
/// Output file this data was parsed from - the cleaned input from Piscal
/// </summary>
public virtual LeafOutputFile LeafOutputFile { get; set; }
[ParseInfo(1, exampleValue: "First and last name")]
public string InvestigatorName { get; set; }
[ParseInfo(2, exampleValue: "Your email / mail addresses")]
public string ContactInformation { get; set; }
[ParseInfo(3, alternateTitle: "Site name in full", exampleValue: "Your site's identifier / name")]
public string SiteName { get; set; }
[ParseInfo(4, exampleValue: "Mixed forest / grasslands / croplands/ etc")]
public string VegetationType { get; set; }
[ParseInfo(5, exampleValue: "Soil type at your site")]
public string SoilType { get; set; }
[ParseInfo(6, exampleValue: "List of major species at the site")]
public string MajorSpecies { get; set; }
[ParseInfo(7,
alternateTitle: "Sample leaf light environment",
exampleValue: "The general light environment in which the leaf is in (e.g. heavily shaded from above)")]
public string SampleLeafLightEnv { get; set; }
[ParseInfo(8, exampleValue: "Indicate whether there is water stress at the time of sampling")]
public string WaterStressAssessment { get; set; }
[ParseInfo(9, exampleValue: "For example - Licor-6400")]
public string InstrumentUsed { get; set; }
[ParseInfo(10, exampleValue: "Any extra information you feel would be helpful to put the sampled leaf in context")]
public string ExtraInfo { get; set; }
/// <summary>
/// Utility method for calculating the range of values in the curves
/// </summary>
public static double? Range(
ICollection<LeafInputDataCurve> curves,
Func<LeafInputDataCurve, double?> param)
=> curves.Max(param) - curves.Min(param);
public double? CO2S_Range => Range(Data, curve => curve.CO2S);
public double? PARi_Range => Range(Data, curve => curve.PARi);
public double? Tleaf_Range => Range(Data, curve => curve.Tleaf);
public double? PhiPS2_Range => Range(Data, curve => curve.PhiPS2);
}
}