added detailed output for KPI C1 effective organic matter supply

This commit is contained in:
tamara 2024-02-16 12:58:00 +01:00
parent 5d02370f56
commit 5399fd66df
3 changed files with 58 additions and 8 deletions

View File

@ -87,8 +87,8 @@ namespace FarmmapsKPI
TimeSpan tsRemaining;
TimeSpan tsTotalEstimated;
for (int i = 0; i < fieldsInputs.Count; i++)
//for (int i = 3; i < 4; i++)
//for (int i = 0; i < fieldsInputs.Count; i++)
for (int i = 3; i < 4; i++)
{
watch.Restart();
input = fieldsInputs[i];
@ -476,6 +476,48 @@ namespace FarmmapsKPI
sw.WriteLine(string.Join(",", dataList));
}
}
else if (kpio.id == "C1") //TtD
{
//Make a new dataList = new line to be written
dataList = new List<string> { };
//Fill the datalist with this kpi
dataList.Add(kpio.parentName);
dataList.Add(cropfieldItem.Code);
dataList.Add(kpio.data.area);
dataList.Add(kpio.data.cropTypeCode);
dataList.Add(kpio.data.cropTypeName);
dataList.Add(kpio.id);
dataList.Add(kpio.quantity); // in KPI output quantity is what we call KPIvariable in headerlist of csv file
dataList.Add(kpio.value);
dataList.Add(kpio.unit);
dataList.Add(kpio.targetValue);
dataList.Add(kpio.thresholdValue);
//Write the datalist to a line to the streamwrieter sw for the output csv file
sw.WriteLine(string.Join(",", dataList));
KPIelementsOfBalance kPIelementsOfBalance = kpio.data.values;
foreach (string elementName in kpio.C1elements)
{
// get C1element from the element called values
dataList = new List<string> { };
string elementValue = (string)kPIelementsOfBalance.GetType().GetProperty(elementName).GetValue(kPIelementsOfBalance, null);
dataList.Add(kpio.parentName);
dataList.Add(cropfieldItem.Code);
dataList.Add(kpio.data.area);
dataList.Add(kpio.data.cropTypeCode);
dataList.Add(kpio.data.cropTypeName);
dataList.Add(kpio.id);
dataList.Add(elementName); // specific output variable name for C1 element
dataList.Add(elementValue); // specific output value name for C1 element
dataList.Add(kpio.unit);
dataList.Add("");
dataList.Add("");
//Write the datalist to a line to the streamwrieter sw for the output csv file
sw.WriteLine(string.Join(",", dataList));
}
}
else if (kpio.id == "E1")
{
//for E1, environmentMeasureData is an array of elements with 1 per pesticide. Inside each element there are multiple mbp_KPIvariables to be written

View File

@ -19,10 +19,13 @@ namespace FarmmapsKPI.Models
public List<string> B1elements;
public List<string> B2elements;
public List<string> C1elements; //TtD
public KPIOutput()
{
this.B1elements = new List<string>() { "disposal", "nFixationNKgHa", "nDepositionNKgHa","nFertilizerNKgHa","sowPlantingNKgHa" }; //TODO Tamara: rename disposal to nHarvestedNKgHa
this.B2elements = new List<string>() { "disposal", "pFertillizerNKgHa", "sowPlantingNKgHa" }; //TODO Tamara: rename from pFertilizerNKgHa to pFertilizerPKgHa; rename disposal to pHarvestedPKgHa
this.C1elements = new List<string>() { "fertilizerEom", "greenManureEom", "cropLeftoversEom" }; //TtD
}
}
public class KPIOutputData
@ -47,7 +50,7 @@ namespace FarmmapsKPI.Models
}
public class KPIelementsOfBalance
{
public string disposal { get; set; }
public string disposal { get; set; } //TODO Tamara: rename this one
public string nFixationNKgHa { get; set; }
public string nDepositionNKgHa { get; set; }
public string nFertilizerNKgHa { get; set; }
@ -55,5 +58,10 @@ namespace FarmmapsKPI.Models
public string pFertillizerNKgHa { get; set; } //TODO Tamara: delete this one after renaming
public string pFertilizerPKgHa { get; set; }
public string sowPlantingPKgHa { get; set; }
public string fertilizerEom { get; set; } //TtD
public string greenManureEom { get; set; } //TtD
public string cropLeftoversEom { get; set; } //TtD
}
}

View File

@ -49,11 +49,11 @@ dataOperations: "status": "3":
"code": "860619", //PO20231004: so what does this code mean? Can we see the code list somewhere? NOT YET TESTED
KPIelementsOfBalance: Tamara
a. define elements for C1 organic matter supply
b. for nitrogen B1 rename disposal to nHarvestedNKgHa
c. for phosporous B2 rename disposal to pHarvestedPKgHa
d. for phosporous B2 rename from pFertilizerNKgHa to pFertilizerPKgHa
e. idem sowPlantingNKgHa
a. define elements for C1 organic matter supply DONE
b. for nitrogen B1 rename disposal to nHarvestedNKgHa PARTLY
c. for phosporous B2 rename disposal to pHarvestedPKgHa PARTLY
d. for phosporous B2 rename from pFertilizerNKgHa to pFertilizerPKgHa PARTLY
e. idem sowPlantingNKgHa PARTLY
f. add straw for N & P in output
g. add 2 examples in KPIinput.json: straw yes/no removed. Bijv. nStrawLeftInField EN nStrawRemoved
h. update KPIdefinitions.csv