fix for fodder_maize
All checks were successful
FarmMaps.Develop/CarbonLib/pipeline/head This commit looks good
All checks were successful
FarmMaps.Develop/CarbonLib/pipeline/head This commit looks good
This commit is contained in:
@@ -568,9 +568,9 @@ namespace FarmMapsAPI.Carbon
|
|||||||
var valueList = new List<ColumnValue>();
|
var valueList = new List<ColumnValue>();
|
||||||
foreach (var stubbleKeyValue in stubbleC.Value)
|
foreach (var stubbleKeyValue in stubbleC.Value)
|
||||||
{
|
{
|
||||||
var dmYieldValue = dm_Yield_Field[stubbleC.Key].Single(s => s.Key == stubbleKeyValue.Key);
|
var dmYieldValue = dm_Yield_Field[stubbleC.Key].Single(s => s.Key.ToLower() == stubbleKeyValue.Key.ToLower());
|
||||||
var strawYieldValue = strawYield[stubbleC.Key].Single(s => s.Key == stubbleKeyValue.Key);
|
var strawYieldValue = strawYield[stubbleC.Key].Single(s => s.Key.ToLower() == stubbleKeyValue.Key.ToLower());
|
||||||
var dmContentStraw = cropSet.StrawCrops.Single(s => s.StrawCrop == stubbleKeyValue.Key);
|
var dmContentStraw = cropSet.StrawCrops.Single(s => s.StrawCrop.ToLower() == stubbleKeyValue.Key.ToLower());
|
||||||
|
|
||||||
var result = ((dmYieldValue.Value + ((stubbleKeyValue.Value + strawYieldValue.Value) * dmContentStraw.DM_Content)) * parameterSet.CarbonBiomass) / ((1 / parameterSet.FracBelowGroundCinput) - 1);
|
var result = ((dmYieldValue.Value + ((stubbleKeyValue.Value + strawYieldValue.Value) * dmContentStraw.DM_Content)) * parameterSet.CarbonBiomass) / ((1 / parameterSet.FracBelowGroundCinput) - 1);
|
||||||
valueList.Add(new ColumnValue(stubbleKeyValue.Key, result));
|
valueList.Add(new ColumnValue(stubbleKeyValue.Key, result));
|
||||||
@@ -613,7 +613,7 @@ namespace FarmMapsAPI.Carbon
|
|||||||
{
|
{
|
||||||
result = 12000;
|
result = 12000;
|
||||||
}
|
}
|
||||||
carbonInputs.AddValue((cropArea.Key.Item1, cropArea.Key.Item2, crop.Key), "CarbonResidues", result);
|
carbonInputs.AddOrUpdateValue((cropArea.Key.Item1, cropArea.Key.Item2, crop.Key), "CarbonResidues", result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,25 @@ namespace FarmMapsAPI.Carbon.Models
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddOrUpdateValue((string, int, string) key, string column, double value)
|
||||||
|
{
|
||||||
|
if (TrippleKeyParam.ContainsKey(key))
|
||||||
|
{
|
||||||
|
if (TrippleKeyParam[key].Any(x => x.Key == column))
|
||||||
|
{
|
||||||
|
TrippleKeyParam[key].Single(x => x.Key == column).Value = value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TrippleKeyParam[key].Add(new ColumnValue(column, value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TrippleKeyParam.Add(key, new List<ColumnValue> { new ColumnValue(column, value) });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void AddValueSkipIfColumnExists((string, int, string) key, string column, double value)
|
public void AddValueSkipIfColumnExists((string, int, string) key, string column, double value)
|
||||||
{
|
{
|
||||||
if (TrippleKeyParam.ContainsKey(key))
|
if (TrippleKeyParam.ContainsKey(key))
|
||||||
|
|||||||
@@ -4,6 +4,10 @@
|
|||||||
"StrawCrop": "Maize",
|
"StrawCrop": "Maize",
|
||||||
"DM_Content": 0.7
|
"DM_Content": 0.7
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"StrawCrop": "Fodder_maize",
|
||||||
|
"DM_Content": 0.85
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"StrawCrop": "Corn_cob_mix",
|
"StrawCrop": "Corn_cob_mix",
|
||||||
"DM_Content": 0.7
|
"DM_Content": 0.7
|
||||||
|
|||||||
Reference in New Issue
Block a user