Compare commits
101 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b149eec39c | |||
|
|
8823db6340 | ||
|
|
94fc762de6 | ||
|
|
c1d200f1af | ||
|
|
09983e5d28 | ||
|
|
b42fa7f658 | ||
|
|
0b7e30d301 | ||
|
|
253a76e061 | ||
|
|
2ddd2e4b13 | ||
|
|
b5e0e049a2 | ||
|
|
00cad173c6 | ||
|
|
15656a964a | ||
|
|
bba50c65b1 | ||
|
|
3b5afbc5a9 | ||
|
|
cfacd6def4 | ||
|
|
34a94d858e | ||
|
|
0870637575 | ||
|
|
74eafbf3a3 | ||
|
|
4ce165ab9d | ||
|
|
0b2209a074 | ||
|
|
a37dab3540 | ||
|
|
03da80f6c0 | ||
|
|
83d955d027 | ||
|
|
bb4be25e43 | ||
| 095fa8d572 | |||
|
|
0e0c9a7539 | ||
|
|
1eca28a511 | ||
|
|
681329ffa5 | ||
|
|
e7408d3eb5 | ||
|
|
43d5916aff | ||
| fd0a3fa292 | |||
| 1641cd83e0 | |||
|
|
5355ff07a6 | ||
| 4c8105ef9a | |||
| 17ba32bda1 | |||
|
|
e9e236ff5b | ||
|
|
d32d334302 | ||
|
|
04cd57e4db | ||
|
|
be2efc3735 | ||
|
|
1248a4aa1d | ||
| f12a1c5a82 | |||
|
|
c73560db61 | ||
|
|
45bd471bdf | ||
|
|
8aceaf5fd2 | ||
|
|
97b42c09f3 | ||
| 5c40805a3b | |||
|
|
7cd8dd403b | ||
| e9f35daf03 | |||
|
|
19491f1077 | ||
| 8efa6558c6 | |||
|
|
dd993a3583 | ||
|
|
3034bae61e | ||
|
|
4c491bd581 | ||
|
|
90787a8fba | ||
|
|
aef26080ba | ||
|
|
800632d20d | ||
|
|
c209f011a0 | ||
|
|
5392ab24cc | ||
|
|
b18c7f73a9 | ||
| f745d4e660 | |||
| 1aa4400721 | |||
| c39096ce6f | |||
| b69027edf2 | |||
| 7f5f676fff | |||
|
|
4f21c4d0d8 | ||
| 51dee60e76 | |||
| 98db16fc7e | |||
| 0f24014de0 | |||
| bd2d025164 | |||
|
|
cc4cde76cb | ||
|
|
b6c0628682 | ||
|
|
4b9d2e6e05 | ||
|
|
e22878ccdb | ||
|
|
0142c17e2a | ||
|
|
a811e8eaf7 | ||
| 62145b9569 | |||
| 58c84bc13d | |||
|
|
dd44069132 | ||
|
|
c96d751e2e | ||
|
|
a8e55457a5 | ||
|
|
f0caa9e1db | ||
|
|
12923be93e | ||
|
|
046d681b25 | ||
|
|
34d0d86bd5 | ||
| 6e8e8db12e | |||
| f5ec4204fe | |||
| 2d5fb1a48a | |||
| c217195605 | |||
| 7aeff96eed | |||
| 96906d57cf | |||
|
|
1810b0005a | ||
| 53f79ce16a | |||
| e95e29a96a | |||
|
|
ea976842cd | ||
| f1342b118f | |||
| aa59a17a7c | |||
|
|
fb2b34d7ff | ||
|
|
a00353f464 | ||
| 7bfe3d1e50 | |||
| e8d328d6c2 | |||
| b0ac42a957 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -362,3 +362,4 @@ MigrationBackup/
|
|||||||
# Fody - auto-generated XML schema
|
# Fody - auto-generated XML schema
|
||||||
FodyWeavers.xsd
|
FodyWeavers.xsd
|
||||||
|
|
||||||
|
upstreamProjects/
|
||||||
@@ -139,11 +139,11 @@ namespace FarmMapsAPI.Carbon
|
|||||||
Area = cropField.Area,
|
Area = cropField.Area,
|
||||||
HistoricalCropData = mappedCropData,
|
HistoricalCropData = mappedCropData,
|
||||||
SoilType = MapSoil(cropField.SoilType),
|
SoilType = MapSoil(cropField.SoilType),
|
||||||
SoilProperty = new SoilProperty { Clay_Content = cropField.SoilProperty.Clay_Content, OM_Const = cropField.SoilProperty.OM_Const, Depth10 = cropField.SoilProperty.Depth10 },
|
SoilProperty = new SoilProperty { Clay_Content = cropField.SoilProperty.Clay_Content, OM_Const = cropField.SoilProperty.OM_Const, Depth10 = cropField.SoilProperty.Depth10, Depth = cropField.SoilProperty.Depth, OM_Choice = cropField.SoilProperty.OM_Choice },
|
||||||
GreenManures = greenManures
|
GreenManures = greenManures
|
||||||
});
|
});
|
||||||
foreach (var crops in cropField.HistoricalCropData)
|
foreach (var crops in cropField.HistoricalCropData)
|
||||||
{
|
{
|
||||||
foreach (var cropYear in crops.Crops)
|
foreach (var cropYear in crops.Crops)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(cropYear.MiterraCropName))
|
if (!string.IsNullOrEmpty(cropYear.MiterraCropName))
|
||||||
@@ -156,9 +156,10 @@ namespace FarmMapsAPI.Carbon
|
|||||||
Crop = cropYear.MiterraCropName,
|
Crop = cropYear.MiterraCropName,
|
||||||
CropRes = cropYear.CropRes,
|
CropRes = cropYear.CropRes,
|
||||||
OrganicManures =
|
OrganicManures =
|
||||||
cropYear.OrganicManures.Where(y=>y.Quantity > 0 && !string.IsNullOrEmpty(y.Type)).Select(x => new OrganicManureType { Type = x.Type, Quantity = x.Quantity }).ToList(),
|
cropYear.OrganicManures.Where(y=>y.Quantity > 0 && !string.IsNullOrEmpty(y.Type)).Select(x => new OrganicManureType { Type = x.Type, Quantity = x.Quantity.HasValue? x.Quantity.Value : 0 }).ToList(),
|
||||||
CropYield = cropYear.CropYield } }
|
CropYield = cropYear.CropYield,
|
||||||
});
|
Irrigation = crops.Irrigations} }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -170,9 +171,9 @@ namespace FarmMapsAPI.Carbon
|
|||||||
{
|
{
|
||||||
foreach (var manure in cropYear.OrganicManures)
|
foreach (var manure in cropYear.OrganicManures)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(manure.Type) && manure.Quantity > 0)
|
if (!string.IsNullOrEmpty(manure.Type) && manure.Quantity.HasValue && manure.Quantity > 0)
|
||||||
{
|
{
|
||||||
orgManure.Add(new OrganicManureType { Type = manure.Type, Quantity = manure.Quantity });
|
orgManure.Add(new OrganicManureType { Type = manure.Type, Quantity = manure.Quantity.HasValue ? manure.Quantity.Value : 0 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -214,12 +215,6 @@ namespace FarmMapsAPI.Carbon
|
|||||||
public double? GetCropYield(string cropCode, int year, int postalCode)
|
public double? GetCropYield(string cropCode, int year, int postalCode)
|
||||||
{
|
{
|
||||||
string provinceCode = GetProvinceCode(dataTransformationSet, postalCode);
|
string provinceCode = GetProvinceCode(dataTransformationSet, postalCode);
|
||||||
//var cropMapping = mappingCropFarmmapsMiterraRothC.FirstOrDefault(x => x.CropCode == cropCode);
|
|
||||||
//if (cropMapping == null)
|
|
||||||
//{
|
|
||||||
// return 0;
|
|
||||||
//}
|
|
||||||
//var crpYield = cropYieldConfig.SingleOrDefault(x => x.CropName.ToLower() == cropMapping.MiterraRothCCrop.ToLower());
|
|
||||||
var crpYield = cropYieldConfig.SingleOrDefault(x => x.CropName.ToLower() == cropCode.ToLower());
|
var crpYield = cropYieldConfig.SingleOrDefault(x => x.CropName.ToLower() == cropCode.ToLower());
|
||||||
var crpYieldProvince = crpYield.Yields.SingleOrDefault(x => x.ProvinceCode == provinceCode);
|
var crpYieldProvince = crpYield.Yields.SingleOrDefault(x => x.ProvinceCode == provinceCode);
|
||||||
var cropYield = crpYieldProvince.YearData.SingleOrDefault(x => x.Year == year)?.YieldValue;
|
var cropYield = crpYieldProvince.YearData.SingleOrDefault(x => x.Year == year)?.YieldValue;
|
||||||
@@ -244,6 +239,12 @@ namespace FarmMapsAPI.Carbon
|
|||||||
|
|
||||||
var year = GetYears(farmInputSet, farmInput);
|
var year = GetYears(farmInputSet, farmInput);
|
||||||
|
|
||||||
|
var carbon_organicmatter_factor = 0.54;
|
||||||
|
if (farmInput.CropFields[0].SoilProperty.OM_Choice == "c")
|
||||||
|
{
|
||||||
|
carbon_organicmatter_factor = 1;
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////
|
//////////////////////////////////////////////
|
||||||
// precalculations
|
// precalculations
|
||||||
//////////////////////////////////////////////
|
//////////////////////////////////////////////
|
||||||
@@ -264,7 +265,6 @@ namespace FarmMapsAPI.Carbon
|
|||||||
item.Value.OM_Corr = sumCorr;
|
item.Value.OM_Corr = sumCorr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//var oM_corr_SoilType = new Dictionary<string, List<ColumnValue>>();
|
|
||||||
var oM_corr_SoilType = new Dictionary<(string,string), double>();
|
var oM_corr_SoilType = new Dictionary<(string,string), double>();
|
||||||
foreach (var item in soilPropertiesField)
|
foreach (var item in soilPropertiesField)
|
||||||
{
|
{
|
||||||
@@ -272,6 +272,13 @@ namespace FarmMapsAPI.Carbon
|
|||||||
var initialSoilKey = historicalCropdata.Keys.FirstOrDefault(x => x.Item1 == item.Key && x.Item2 == year.First());
|
var initialSoilKey = historicalCropdata.Keys.FirstOrDefault(x => x.Item1 == item.Key && x.Item2 == year.First());
|
||||||
var initialSoil = historicalCropdata[initialSoilKey].FirstOrDefault();
|
var initialSoil = historicalCropdata[initialSoilKey].FirstOrDefault();
|
||||||
var soilPropertyDepth10 = item.Value.Depth10;
|
var soilPropertyDepth10 = item.Value.Depth10;
|
||||||
|
if (item.Value.Depth.HasValue && item.Value.Depth.Value == 10)
|
||||||
|
{
|
||||||
|
soilPropertyDepth10 = true;
|
||||||
|
}
|
||||||
|
// Different corrections for depth (10, 25, 30 cm)
|
||||||
|
// depth of 10cm has same result as previous checkbox (sample taken at 10cm)
|
||||||
|
parameterSet.LayerDepth = item.Value.Depth.HasValue? item.Value.Depth.Value : parameterSet.LayerDepth;
|
||||||
if (initialSoil == "Temp_gras" && soilPropertyDepth10)
|
if (initialSoil == "Temp_gras" && soilPropertyDepth10)
|
||||||
{
|
{
|
||||||
oM_corr_SoilType.Add((item.Key, soilOfItem), item.Value.OM_Cont * 0.97);
|
oM_corr_SoilType.Add((item.Key, soilOfItem), item.Value.OM_Cont * 0.97);
|
||||||
@@ -546,7 +553,7 @@ namespace FarmMapsAPI.Carbon
|
|||||||
newValue = 0.024 * item.Value + 0.228;
|
newValue = 0.024 * item.Value + 0.228;
|
||||||
valueList.Add(new ColumnValue(item.Key, newValue));
|
valueList.Add(new ColumnValue(item.Key, newValue));
|
||||||
break;
|
break;
|
||||||
case "Corn_Cob_mix":
|
case "Corn_cob_mix":
|
||||||
newValue = 0.024 * item.Value + 0.228;
|
newValue = 0.024 * item.Value + 0.228;
|
||||||
valueList.Add(new ColumnValue(item.Key, newValue));
|
valueList.Add(new ColumnValue(item.Key, newValue));
|
||||||
break;
|
break;
|
||||||
@@ -647,11 +654,7 @@ namespace FarmMapsAPI.Carbon
|
|||||||
foreach (var crop in cropArea.Value)
|
foreach (var crop in cropArea.Value)
|
||||||
{
|
{
|
||||||
var cInputCropRes = cropPropertyConfig.SingleOrDefault(s => s.Name.ToLower() == crop.Key.ToLower())?.C_input_CropRes ?? 0.0;
|
var cInputCropRes = cropPropertyConfig.SingleOrDefault(s => s.Name.ToLower() == crop.Key.ToLower())?.C_input_CropRes ?? 0.0;
|
||||||
if (cInputCropRes > 0)
|
carbonInputs.AddValue((cropArea.Key.Item1, cropArea.Key.Item2, crop.Key), "CarbonResidues", cInputCropRes);
|
||||||
{
|
|
||||||
carbonInputs.AddValue((cropArea.Key.Item1, cropArea.Key.Item2, crop.Key), "CarbonResidues", cInputCropRes);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cropSet.StrawCrops.Any(x => x.StrawCrop.ToLower() == crop.Key.ToLower()))
|
if (cropSet.StrawCrops.Any(x => x.StrawCrop.ToLower() == crop.Key.ToLower()))
|
||||||
{
|
{
|
||||||
@@ -753,7 +756,7 @@ namespace FarmMapsAPI.Carbon
|
|||||||
coverModFactor.Add(crpCover.CropName, valueList);
|
coverModFactor.Add(crpCover.CropName, valueList);
|
||||||
}
|
}
|
||||||
|
|
||||||
// SMDMax (kan buiten yearLoop)
|
// SMDMax
|
||||||
// field, crop
|
// field, crop
|
||||||
var smdMax = new Dictionary<string, double>();
|
var smdMax = new Dictionary<string, double>();
|
||||||
foreach (var soil in soilPropertiesField)
|
foreach (var soil in soilPropertiesField)
|
||||||
@@ -762,7 +765,7 @@ namespace FarmMapsAPI.Carbon
|
|||||||
smdMax.Add(soil.Key, result);
|
smdMax.Add(soil.Key, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// SMDaccMonthi (kan buiten yearLoop ??)
|
// SMDaccMonthi
|
||||||
var smdAccMonthi = new Dictionary<string, List<ColumnValue>>();
|
var smdAccMonthi = new Dictionary<string, List<ColumnValue>>();
|
||||||
|
|
||||||
foreach (var climateItem in climateVariable)
|
foreach (var climateItem in climateVariable)
|
||||||
@@ -772,16 +775,63 @@ namespace FarmMapsAPI.Carbon
|
|||||||
{
|
{
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
var result = climateItem.Value[i].Precipitation - climateItem.Value[i].Evapotranspiration;
|
|
||||||
|
/* smdMax met factor maand corrigeren
|
||||||
|
SMDmax(Field,Crop,AllMonths) = ifthen(CropCoverMonths(Crop,AllMonths)=1,
|
||||||
|
SMDmax(Field,Crop,AllMonths),SMDmax(Field,Crop,AllMonths)/1.8);
|
||||||
|
*/
|
||||||
|
var crop = cropAreaField1.SingleOrDefault(x => x.Key.Item2 == loopYear).Value[0].Key;
|
||||||
|
var cover = cropCoverMonthConfig.SingleOrDefault(x => x.CropName.ToLower() == crop.ToLower())?.CoverMonths;
|
||||||
|
var hasCover = cover.Any(x => x == $"M{i + 1}");
|
||||||
|
var smdMaxValue = smdMax[climateItem.Key];
|
||||||
|
if (!hasCover)
|
||||||
|
{
|
||||||
|
smdMaxValue = smdMax[climateItem.Key] / 1.8;
|
||||||
|
}
|
||||||
|
//fsa todo: add precipitation
|
||||||
|
var irrigation = 0;
|
||||||
|
var irrigations = farmInput.CropFields[0].HistoricalCropData.SingleOrDefault(x => x.Year == loopYear).Crops[0].Irrigation;
|
||||||
|
if (!string.IsNullOrEmpty(irrigations))
|
||||||
|
{
|
||||||
|
var irrigationArray = irrigations.Split(',');
|
||||||
|
if (irrigationArray.Length > i)
|
||||||
|
{
|
||||||
|
irrigation = string.IsNullOrEmpty(irrigationArray[i]) ? 0 : Convert.ToInt16(irrigationArray[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var result = climateItem.Value[i].Precipitation - climateItem.Value[i].Evapotranspiration + irrigation;
|
||||||
result = result < 0 ? result : 0;
|
result = result < 0 ? result : 0;
|
||||||
result = result < smdMax[climateItem.Key] ? smdMax[climateItem.Key] : result;
|
result = result < smdMaxValue ? smdMaxValue : result;
|
||||||
valueList.Add(new ColumnValue("M1", result));
|
valueList.Add(new ColumnValue("M1", result));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var result = climateItem.Value[i].Precipitation - climateItem.Value[i].Evapotranspiration + valueList.SingleOrDefault(x => x.Key == $"M{i}").Value;
|
/* smdMax met factor maand corrigeren
|
||||||
|
SMDmax(Field,Crop,AllMonths) = ifthen(CropCoverMonths(Crop,AllMonths)=1,
|
||||||
|
SMDmax(Field,Crop,AllMonths),SMDmax(Field,Crop,AllMonths)/1.8);
|
||||||
|
*/
|
||||||
|
var crop = cropAreaField1.SingleOrDefault(x => x.Key.Item2 == loopYear).Value[0].Key;
|
||||||
|
var cover = cropCoverMonthConfig.SingleOrDefault(x => x.CropName.ToLower() == crop.ToLower())?.CoverMonths;
|
||||||
|
var hasCover = cover.Any(x => x == $"M{i + 1}");
|
||||||
|
var smdMaxValue = smdMax[climateItem.Key];
|
||||||
|
if (!hasCover)
|
||||||
|
{
|
||||||
|
smdMaxValue = smdMax[climateItem.Key] / 1.8;
|
||||||
|
}
|
||||||
|
|
||||||
|
var irrigation = 0;
|
||||||
|
var irrigations = farmInput.CropFields[0].HistoricalCropData.SingleOrDefault(x => x.Year == loopYear).Crops[0].Irrigation;
|
||||||
|
if (!string.IsNullOrEmpty(irrigations))
|
||||||
|
{
|
||||||
|
var irrigationArray = irrigations.Split(',');
|
||||||
|
if (irrigationArray.Length > i)
|
||||||
|
{
|
||||||
|
irrigation = string.IsNullOrEmpty(irrigationArray[i]) ? 0 : Convert.ToInt16(irrigationArray[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var result = climateItem.Value[i].Precipitation - climateItem.Value[i].Evapotranspiration + valueList.SingleOrDefault(x => x.Key == $"M{i}").Value + irrigation;
|
||||||
result = result < 0 ? result : 0;
|
result = result < 0 ? result : 0;
|
||||||
result = result < smdMax[climateItem.Key] ? smdMax[climateItem.Key] : result;
|
result = result < smdMaxValue ? smdMaxValue : result;
|
||||||
valueList.Add(new ColumnValue($"M{i + 1}", result));
|
valueList.Add(new ColumnValue($"M{i + 1}", result));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -796,13 +846,26 @@ namespace FarmMapsAPI.Carbon
|
|||||||
var valueList = new List<ColumnValue>();
|
var valueList = new List<ColumnValue>();
|
||||||
foreach (var smdAccMonth in fieldSmdAccMonthi.Value)
|
foreach (var smdAccMonth in fieldSmdAccMonthi.Value)
|
||||||
{
|
{
|
||||||
if (smdAccMonth.Value > 0.444 * smdMax[fieldSmdAccMonthi.Key])
|
/* smdMax met factor maand corrigeren
|
||||||
|
SMDmax(Field,Crop,AllMonths) = ifthen(CropCoverMonths(Crop,AllMonths)=1,
|
||||||
|
SMDmax(Field,Crop,AllMonths),SMDmax(Field,Crop,AllMonths)/1.8);
|
||||||
|
*/
|
||||||
|
var crop = cropAreaField1.SingleOrDefault(x => x.Key.Item2 == loopYear).Value[0].Key;
|
||||||
|
var cover = cropCoverMonthConfig.SingleOrDefault(x => x.CropName.ToLower() == crop.ToLower())?.CoverMonths;
|
||||||
|
var hasCover = cover.Any(x => x == smdAccMonth.Key);
|
||||||
|
var smdMaxValue = smdMax[fieldSmdAccMonthi.Key];
|
||||||
|
if (!hasCover)
|
||||||
|
{
|
||||||
|
smdMaxValue = smdMax[fieldSmdAccMonthi.Key] / 1.8;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (smdAccMonth.Value > 0.444 * smdMaxValue)
|
||||||
{
|
{
|
||||||
valueList.Add(new ColumnValue(smdAccMonth.Key, 1));
|
valueList.Add(new ColumnValue(smdAccMonth.Key, 1));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var result = (0.2 + 0.8 * ((smdMax[fieldSmdAccMonthi.Key] - smdAccMonth.Value) / (smdMax[fieldSmdAccMonthi.Key] - 0.444 * smdMax[fieldSmdAccMonthi.Key])));
|
var result = (0.2 + 0.8 * ((smdMaxValue - smdAccMonth.Value) / (smdMaxValue - 0.444 * smdMaxValue)));
|
||||||
valueList.Add(new ColumnValue(smdAccMonth.Key, result));
|
valueList.Add(new ColumnValue(smdAccMonth.Key, result));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -841,7 +904,7 @@ namespace FarmMapsAPI.Carbon
|
|||||||
foreach (var field in cropAreaField1.Where(x => x.Key.Item2 == loopYear))
|
foreach (var field in cropAreaField1.Where(x => x.Key.Item2 == loopYear))
|
||||||
{
|
{
|
||||||
var valueList = new List<ColumnValue>();
|
var valueList = new List<ColumnValue>();
|
||||||
var result = parameterSet.LayerDepth * bulkDens[field.Key.Item1] * oM_Corr[field.Key.Item1] * 0.54;
|
var result = parameterSet.LayerDepth * bulkDens[field.Key.Item1] * oM_Corr[field.Key.Item1] * carbon_organicmatter_factor;// 0.54;
|
||||||
foreach (var crop in field.Value)
|
foreach (var crop in field.Value)
|
||||||
{
|
{
|
||||||
valueList.Add(new ColumnValue(crop.Key, result));
|
valueList.Add(new ColumnValue(crop.Key, result));
|
||||||
@@ -1650,7 +1713,7 @@ namespace FarmMapsAPI.Carbon
|
|||||||
var iniValue = item.Value.SingleOrDefault(x => x.Key == "IniCcontent")?.Value ?? 0;
|
var iniValue = item.Value.SingleOrDefault(x => x.Key == "IniCcontent")?.Value ?? 0;
|
||||||
var balanceValue = item.Value.SingleOrDefault(x => x.Key == "Balance")?.Value ?? 0;
|
var balanceValue = item.Value.SingleOrDefault(x => x.Key == "Balance")?.Value ?? 0;
|
||||||
|
|
||||||
var resultOmIni = iniValue / 0.54;
|
var resultOmIni = iniValue / carbon_organicmatter_factor;// 0.54;
|
||||||
var resultCo2 = balanceValue * (44.0 / 12.0);
|
var resultCo2 = balanceValue * (44.0 / 12.0);
|
||||||
|
|
||||||
item.Value.Add(new ColumnValue("OM_ini", resultOmIni));
|
item.Value.Add(new ColumnValue("OM_ini", resultOmIni));
|
||||||
@@ -1669,7 +1732,7 @@ namespace FarmMapsAPI.Carbon
|
|||||||
var greenManure = item.SOC_CarbonGreenManure;
|
var greenManure = item.SOC_CarbonGreenManure;
|
||||||
var compost = item.SOC_CarbonCompost;
|
var compost = item.SOC_CarbonCompost;
|
||||||
|
|
||||||
item.OM_ini = iniValue / 0.54;
|
item.OM_ini = iniValue / carbon_organicmatter_factor;// 0.54;
|
||||||
item.CO2seq = balanceValue * (44.0 / 12.0);
|
item.CO2seq = balanceValue * (44.0 / 12.0);
|
||||||
|
|
||||||
var emision = -1 * (manure + residues + greenManure + compost - balanceValue);
|
var emision = -1 * (manure + residues + greenManure + compost - balanceValue);
|
||||||
@@ -1680,11 +1743,9 @@ namespace FarmMapsAPI.Carbon
|
|||||||
|
|
||||||
// SOC_Summary_Farm
|
// SOC_Summary_Farm
|
||||||
var soc_Summary_Farm = new List<FarmYearSummary>();
|
var soc_Summary_Farm = new List<FarmYearSummary>();
|
||||||
//carbonSummary.FarmSummary = soc_Summary_Farm;
|
|
||||||
foreach (var item in cropAreaFarm)
|
foreach (var item in cropAreaFarm)
|
||||||
{
|
{
|
||||||
var sum = item.Value.Sum(x => x.Value);
|
var sum = item.Value.Sum(x => x.Value);
|
||||||
//soc_Summary_Farm.Add(item.Key, new List<ColumnValue> { new ColumnValue("Total_crop_area", sum) });
|
|
||||||
soc_Summary_Farm.Add(new FarmYearSummary { Year = item.Key.Item2, Total_crop_area = sum });
|
soc_Summary_Farm.Add(new FarmYearSummary { Year = item.Key.Item2, Total_crop_area = sum });
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1725,7 +1786,7 @@ namespace FarmMapsAPI.Carbon
|
|||||||
var resultBal = sumBal / farmArea.Total_crop_area;
|
var resultBal = sumBal / farmArea.Total_crop_area;
|
||||||
var resultIni = sumIni / farmArea.Total_crop_area;
|
var resultIni = sumIni / farmArea.Total_crop_area;
|
||||||
var resultiniCc = sumInicc / farmArea.Total_crop_area;
|
var resultiniCc = sumInicc / farmArea.Total_crop_area;
|
||||||
var resultOm_Ini = resultiniCc / 0.54;
|
var resultOm_Ini = resultiniCc / carbon_organicmatter_factor;// 0.54;
|
||||||
var resultCo2 = resultBal * (44.0 / 12.0);
|
var resultCo2 = resultBal * (44.0 / 12.0);
|
||||||
var resultCo2Tot = resultCo2 * farmArea.Total_crop_area;
|
var resultCo2Tot = resultCo2 * farmArea.Total_crop_area;
|
||||||
|
|
||||||
@@ -1772,7 +1833,7 @@ namespace FarmMapsAPI.Carbon
|
|||||||
var soilPropertiesField = new Dictionary<string, SoilPropertyType>();
|
var soilPropertiesField = new Dictionary<string, SoilPropertyType>();
|
||||||
foreach (var field in farmInput.CropFields)
|
foreach (var field in farmInput.CropFields)
|
||||||
{
|
{
|
||||||
soilPropertiesField.Add(field.Name, new SoilPropertyType { OM_Cont = field.SoilProperty.OM_Const.Value, Clay_Content = field.SoilProperty.Clay_Content.Value, OM_Corr = field.SoilProperty.OM_Const.Value <= 20 ? field.SoilProperty.OM_Const.Value : 0, Depth10 = field.SoilProperty.Depth10.Value });
|
soilPropertiesField.Add(field.Name, new SoilPropertyType { OM_Cont = field.SoilProperty.OM_Const.Value, Clay_Content = field.SoilProperty.Clay_Content.Value, OM_Corr = field.SoilProperty.OM_Const.Value <= 20 ? field.SoilProperty.OM_Const.Value : 0, Depth10 = field.SoilProperty.Depth10.Value, Depth = field.SoilProperty.Depth });
|
||||||
}
|
}
|
||||||
|
|
||||||
return soilPropertiesField;
|
return soilPropertiesField;
|
||||||
@@ -1882,7 +1943,7 @@ namespace FarmMapsAPI.Carbon
|
|||||||
var monthClimateList = new List<ClimateVariable>();
|
var monthClimateList = new List<ClimateVariable>();
|
||||||
foreach (var month in gisSoilSet.AllMonths)
|
foreach (var month in gisSoilSet.AllMonths)
|
||||||
{
|
{
|
||||||
var climateYear = loopYear > 2020 || loopYear < 2011 ? 2012 : loopYear;
|
var climateYear = loopYear > 2050 || loopYear < 2011 ? 2012 : loopYear;
|
||||||
var monthData = climate.Single(x => x.Key.Item1 == farmZone && x.Key.Item2 == month && x.Key.Item3 == climateYear).Value;
|
var monthData = climate.Single(x => x.Key.Item1 == farmZone && x.Key.Item2 == month && x.Key.Item3 == climateYear).Value;
|
||||||
var newMonthData = new ClimateVariable(monthData.Temperature, monthData.Precipitation, monthData.Evapotranspiration * 1.25);
|
var newMonthData = new ClimateVariable(monthData.Temperature, monthData.Precipitation, monthData.Evapotranspiration * 1.25);
|
||||||
monthClimateList.Add(newMonthData);
|
monthClimateList.Add(newMonthData);
|
||||||
@@ -1921,11 +1982,9 @@ namespace FarmMapsAPI.Carbon
|
|||||||
foreach (var manure in manures.GreenManureTypes)
|
foreach (var manure in manures.GreenManureTypes)
|
||||||
{
|
{
|
||||||
var manureQ = yieldGreenManureConfig.SingleOrDefault(x => x.ManureName.ToLower() == manure.Type.ToLower());
|
var manureQ = yieldGreenManureConfig.SingleOrDefault(x => x.ManureName.ToLower() == manure.Type.ToLower());
|
||||||
//double manureQuality = manure.Quality == "Goed" ? manureQ.GoodQuality : manure.Quality == "Matig" ? manureQ.AverageQuality : manure.Quality == "Slecht" ? manureQ.BadQuality : 0;
|
|
||||||
double manureQuality2 = manure.Quality == Quality.Good ? manureQ.GoodQuality : manure.Quality == Quality.Average ? manureQ.AverageQuality : manure.Quality == Quality.Bad ? manureQ.BadQuality : 0;
|
double manureQuality2 = manure.Quality == Quality.Good ? manureQ.GoodQuality : manure.Quality == Quality.Average ? manureQ.AverageQuality : manure.Quality == Quality.Bad ? manureQ.BadQuality : 0;
|
||||||
if (manureQuality2 > 0)
|
if (manureQuality2 > 0)
|
||||||
{
|
{
|
||||||
//var yieldGreenManureRow = yieldGreenManureSheet.Rows.SingleOrDefault(x => x.Cells[0] != null && x.Cells[0].Text.ToString() == manure.Type).Cells[qColumn].Value;
|
|
||||||
carbonInputGreenManure.Add((field.Name, manures.Year), new List<ColumnValue> { new ColumnValue(manure.Type, manureQuality2) });
|
carbonInputGreenManure.Add((field.Name, manures.Year), new List<ColumnValue> { new ColumnValue(manure.Type, manureQuality2) });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
165
CarbonLib.csproj
165
CarbonLib.csproj
@@ -1,83 +1,82 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>net6</TargetFramework>
|
||||||
<AssemblyName>CarbonLib</AssemblyName>
|
<AssemblyName>CarbonLib</AssemblyName>
|
||||||
<PackageId>CarbonLib</PackageId>
|
<PackageId>CarbonLib</PackageId>
|
||||||
<RuntimeIdentifiers>win10-x64;ubuntu.16.04-x64</RuntimeIdentifiers>
|
<RuntimeIdentifiers>win10-x64;ubuntu.16.04-x64</RuntimeIdentifiers>
|
||||||
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
|
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
|
||||||
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
|
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
|
||||||
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
|
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
|
||||||
<Version>1.1.5</Version>
|
<Version>4.7.0</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Base.Core.Common" Version="1.2.2.10" />
|
<PackageReference Include="Base.Core.Common.Geometry" Version="4.4.11" />
|
||||||
<PackageReference Include="Base.Core.Common.Geometry" Version="1.4.0" />
|
<PackageReference Include="NetTopologySuite" Version="2.5.0" />
|
||||||
<PackageReference Include="NetTopologySuite" Version="2.0.0" />
|
<PackageReference Include="NetTopologySuite.IO.GeoJSON" Version="3.0.0" />
|
||||||
<PackageReference Include="NetTopologySuite.IO.GeoJSON" Version="2.0.4" />
|
</ItemGroup>
|
||||||
</ItemGroup>
|
|
||||||
|
<ItemGroup>
|
||||||
<ItemGroup>
|
<None Update="config\CropCoverMonth.json">
|
||||||
<None Update="config\CropCoverMonth.json">
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
</None>
|
||||||
</None>
|
<None Update="config\CropProperties.json">
|
||||||
<None Update="config\CropProperties.json">
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
</None>
|
||||||
</None>
|
<None Update="config\CropSets.json">
|
||||||
<None Update="config\CropSets.json">
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
</None>
|
||||||
</None>
|
<None Update="config\CropYield.json">
|
||||||
<None Update="config\CropYield.json">
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
</None>
|
||||||
</None>
|
<None Update="config\CropYield.json.old">
|
||||||
<None Update="config\CropYield.json.old">
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
</None>
|
||||||
</None>
|
<None Update="config\Farm_input_sets.json">
|
||||||
<None Update="config\Farm_input_sets.json">
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
</None>
|
||||||
</None>
|
<None Update="config\GIS_Soil_Sets.json">
|
||||||
<None Update="config\GIS_Soil_Sets.json">
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
</None>
|
||||||
</None>
|
<None Update="config\KNMI_data.csv">
|
||||||
<None Update="config\KNMI_data.csv">
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
</None>
|
||||||
</None>
|
<None Update="config\ManCcont.json">
|
||||||
<None Update="config\ManCcont.json">
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
</None>
|
||||||
</None>
|
<None Update="config\Mapping\MappingCropsFarmmapsMiterraRothC.json">
|
||||||
<None Update="config\Mapping\MappingCropsFarmmapsMiterraRothC.json">
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
</None>
|
||||||
</None>
|
<None Update="config\Mapping\MappingGreenManureFarmmapsMiterraRothC.json">
|
||||||
<None Update="config\Mapping\MappingGreenManureFarmmapsMiterraRothC.json">
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
</None>
|
||||||
</None>
|
<None Update="config\ParametersRothC.json">
|
||||||
<None Update="config\ParametersRothC.json">
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
</None>
|
||||||
</None>
|
<None Update="config\PC4\PC4.cpg">
|
||||||
<None Update="config\PC4\PC4.cpg">
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
</None>
|
||||||
</None>
|
<None Update="config\PC4\PC4.dbf">
|
||||||
<None Update="config\PC4\PC4.dbf">
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
</None>
|
||||||
</None>
|
<None Update="config\PC4\PC4.prj">
|
||||||
<None Update="config\PC4\PC4.prj">
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
</None>
|
||||||
</None>
|
<None Update="config\PC4\PC4.shp">
|
||||||
<None Update="config\PC4\PC4.shp">
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
</None>
|
||||||
</None>
|
<None Update="config\PC4\PC4.shx">
|
||||||
<None Update="config\PC4\PC4.shx">
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
</None>
|
||||||
</None>
|
<None Update="config\RegionSets.json">
|
||||||
<None Update="config\RegionSets.json">
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
</None>
|
||||||
</None>
|
<None Update="config\SetsForDataTransformation.json">
|
||||||
<None Update="config\SetsForDataTransformation.json">
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
</None>
|
||||||
</None>
|
<None Update="config\YieldGreenManure.json">
|
||||||
<None Update="config\YieldGreenManure.json">
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
</None>
|
||||||
</None>
|
</ItemGroup>
|
||||||
</ItemGroup>
|
</Project>
|
||||||
</Project>
|
|
||||||
|
|||||||
50
Jenkinsfile
vendored
50
Jenkinsfile
vendored
@@ -1,42 +1,30 @@
|
|||||||
|
@Library('farmmaps-shared-library') _
|
||||||
|
|
||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
agent any;
|
||||||
environment {
|
options {
|
||||||
APP_VERSION_PREFIX=sh(script: ' cat *.csproj| xmlstarlet sel -t -m "/Project/PropertyGroup/Version" -v . -n|awk -v def="1.0.0" "{print} END { if(NR==0) {print def} }"', returnStdout: true).trim()
|
copyArtifactPermission projectNames: env.allProjectsArtifactPermission;
|
||||||
APP_NAME=sh(script: ' cat *.csproj| xmlstarlet sel -t -m "/Project/PropertyGroup/AssemblyName" -v . -n|awk -v def="App" "{print tolower(\\$0)} END { if(NR==0) {print def} }"', returnStdout: true).trim()
|
disableConcurrentBuilds();
|
||||||
APP_VERSION="${APP_VERSION_PREFIX}"
|
}
|
||||||
|
triggers {
|
||||||
|
upstream(
|
||||||
|
upstreamProjects: '/FarmMaps/Base.Core.Common.Geometry/master',
|
||||||
|
threshold: hudson.model.Result.SUCCESS
|
||||||
|
)
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
stage('Dotnet Restore') {
|
stage('BaseBuildAll') {
|
||||||
steps {
|
steps {
|
||||||
sh '''dotnet restore CarbonLib.csproj'''
|
stepBaseBuildAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Dotnet Build') {
|
}
|
||||||
steps {
|
|
||||||
sh '''dotnet build CarbonLib.csproj'''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Dotnet Package') {
|
|
||||||
steps {
|
|
||||||
sh '''rm -rf nuget
|
|
||||||
dotnet pack -c release -o nuget -p:PackageVersion=${APP_VERSION} CarbonLib.csproj'''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Dotnet Publish') {
|
|
||||||
steps {
|
|
||||||
sh '''dotnet nuget push nuget/*.nupkg -k 0c3e3afc-935b-3db1-b023-e0d4799e674d -s https://repository.akkerweb.nl/repository/nuget-hosted/'''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
post {
|
post {
|
||||||
|
success {
|
||||||
|
postSuccess();
|
||||||
|
}
|
||||||
always {
|
always {
|
||||||
emailext (
|
postAlways();
|
||||||
body: '${DEFAULT_CONTENT}',
|
|
||||||
mimeType: 'text/html',
|
|
||||||
replyTo: '${DEFAULT_REPLYTO}',
|
|
||||||
subject: '${DEFAULT_SUBJECT}',
|
|
||||||
to: emailextrecipients([[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']])
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,42 +1,30 @@
|
|||||||
|
@Library('farmmaps-shared-library') _
|
||||||
|
|
||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
agent any;
|
||||||
environment {
|
options {
|
||||||
APP_VERSION_PREFIX=sh(script: ' cat *.csproj| xmlstarlet sel -t -m "/Project/PropertyGroup/Version" -v . -n|awk -v def="1.0.0" "{print} END { if(NR==0) {print def} }"', returnStdout: true).trim()
|
copyArtifactPermission projectNames: env.allProjectsArtifactPermission;
|
||||||
APP_NAME=sh(script: ' cat *.csproj| xmlstarlet sel -t -m "/Project/PropertyGroup/AssemblyName" -v . -n|awk -v def="App" "{print tolower(\\$0)} END { if(NR==0) {print def} }"', returnStdout: true).trim()
|
disableConcurrentBuilds();
|
||||||
APP_VERSION="${APP_VERSION_PREFIX + '-prerelease.' + env.BUILD_NUMBER}"
|
}
|
||||||
|
triggers {
|
||||||
|
upstream(
|
||||||
|
upstreamProjects: '/FarmMaps.Develop/Base.Core.Common.Geometry/develop',
|
||||||
|
threshold: hudson.model.Result.SUCCESS
|
||||||
|
)
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
stage('Dotnet Restore') {
|
stage('BaseBuildAll') {
|
||||||
steps {
|
steps {
|
||||||
sh '''dotnet restore CarbonLib.csproj'''
|
stepBaseBuildAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Dotnet Build'){
|
}
|
||||||
steps {
|
|
||||||
sh '''dotnet build CarbonLib.csproj'''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Dotnet Package') {
|
|
||||||
steps {
|
|
||||||
sh '''rm -rf nuget
|
|
||||||
dotnet pack -c debug -o nuget -p:PackageVersion=${APP_VERSION} CarbonLib.csproj'''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Dotnet Publish') {
|
|
||||||
steps {
|
|
||||||
sh '''dotnet nuget push nuget/*.nupkg -k 0c3e3afc-935b-3db1-b023-e0d4799e674d -s https://repository.akkerweb.nl/repository/nuget-hosted/'''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
post {
|
post {
|
||||||
|
success {
|
||||||
|
postSuccess();
|
||||||
|
}
|
||||||
always {
|
always {
|
||||||
emailext (
|
postAlways();
|
||||||
body: '${DEFAULT_CONTENT}',
|
|
||||||
mimeType: 'text/html',
|
|
||||||
replyTo: '${DEFAULT_REPLYTO}',
|
|
||||||
subject: '${DEFAULT_SUBJECT}',
|
|
||||||
to: emailextrecipients([[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']])
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -16,7 +16,6 @@ namespace CarbonService.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public int PostalCode { get; set; }
|
public int PostalCode { get; set; }
|
||||||
public List<CropField> CropFields { get; set; }
|
public List<CropField> CropFields { get; set; }
|
||||||
//public List<OrgManureApplied> OrgManureApplied { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CropField
|
public class CropField
|
||||||
@@ -31,23 +30,28 @@ namespace CarbonService.Models
|
|||||||
public SoilProperty SoilProperty { get; set; }
|
public SoilProperty SoilProperty { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public List<HistoricalCropData> HistoricalCropData { get; set; }
|
public List<HistoricalCropData> HistoricalCropData { get; set; }
|
||||||
public List<GreenManure> GreenManures { get; set; }
|
public List<GreenManure> GreenManures { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SoilProperty
|
public class SoilProperty
|
||||||
{
|
{
|
||||||
public double? OM_Const { get; set; }
|
public double? OM_Const { get; set; }
|
||||||
|
public string OM_Choice { get; set; }
|
||||||
public double? Clay_Content { get; set; }
|
public double? Clay_Content { get; set; }
|
||||||
public bool? Depth10 { get; set; }
|
public bool? Depth10 { get; set; }
|
||||||
|
public int? Depth { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class OrgManureApplied
|
public class OrgManureApplied
|
||||||
{
|
{
|
||||||
|
double? yield;
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public string Crop { get; set; }
|
public string Crop { get; set; }
|
||||||
public List<OrganicManureType> OrganicManures { get; set; }
|
public List<OrganicManureType> OrganicManures { get; set; }
|
||||||
public int? CropYield { get; set; }
|
public double? CropYield { get { return (int?)yield; } set { yield = value; } }
|
||||||
public bool CropRes { get; set; }
|
public bool CropRes { get; set; }
|
||||||
|
public string Irrigation { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class OrganicManureType
|
public class OrganicManureType
|
||||||
@@ -62,8 +66,6 @@ namespace CarbonService.Models
|
|||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
public int Year { get; set; }
|
public int Year { get; set; }
|
||||||
//[Required]
|
|
||||||
//public List<string> Crops { get; set; }
|
|
||||||
[Required]
|
[Required]
|
||||||
public List<OrgManureApplied> Crops { get; set; }
|
public List<OrgManureApplied> Crops { get; set; }
|
||||||
}
|
}
|
||||||
@@ -81,7 +83,6 @@ namespace CarbonService.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public string Type { get; set; }
|
public string Type { get; set; }
|
||||||
|
|
||||||
//public string Quality { get; set; }
|
|
||||||
[JsonConverter(typeof(StringEnumConverter))]
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
public Quality Quality { get; set; }
|
public Quality Quality { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ namespace FarmMapsAPI.Carbon.Models
|
|||||||
{
|
{
|
||||||
[JsonProperty("cropField")]
|
[JsonProperty("cropField")]
|
||||||
public List<CropFieldSummary> CropField { get; set; }
|
public List<CropFieldSummary> CropField { get; set; }
|
||||||
//[JsonProperty("farmSummary")]
|
|
||||||
//public List<FarmYearSummary> FarmSummary { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CropFieldSummary
|
public class CropFieldSummary
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ namespace FarmMapsAPI.Carbon.Models
|
|||||||
public List<CropData> Crops { get; set; }
|
public List<CropData> Crops { get; set; }
|
||||||
public List<GreenManureTypeFarmMaps> GreenManures { get; set; }
|
public List<GreenManureTypeFarmMaps> GreenManures { get; set; }
|
||||||
public bool Rotation { get; set; }
|
public bool Rotation { get; set; }
|
||||||
|
public string Irrigations { get; set; }
|
||||||
|
|
||||||
public HistoricalCropDataFarmMaps DeepCopy()
|
public HistoricalCropDataFarmMaps DeepCopy()
|
||||||
{
|
{
|
||||||
@@ -54,11 +55,13 @@ namespace FarmMapsAPI.Carbon.Models
|
|||||||
|
|
||||||
public class CropData
|
public class CropData
|
||||||
{
|
{
|
||||||
|
double? yield;
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public string CropCode { get; set; }
|
public string CropCode { get; set; }
|
||||||
public string MiterraCropName { get; set; }
|
public string MiterraCropName { get; set; }
|
||||||
public List<OrganicManureFarmMaps> OrganicManures { get; set; }
|
public List<OrganicManureFarmMaps> OrganicManures { get; set; }
|
||||||
public int? CropYield { get; set; }
|
public double? CropYield { get { return (int?)yield; } set { yield = value; } }
|
||||||
public bool CropRes { get; set; }
|
public bool CropRes { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,14 +70,16 @@ namespace FarmMapsAPI.Carbon.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public string Type { get; set; }
|
public string Type { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public double Quantity { get; set; }
|
public double? Quantity { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SoilPropertyFarmMaps
|
public class SoilPropertyFarmMaps
|
||||||
{
|
{
|
||||||
public double? OM_Const { get; set; }
|
public double? OM_Const { get; set; }
|
||||||
|
public string OM_Choice { get; set; }
|
||||||
public double? Clay_Content { get; set; }
|
public double? Clay_Content { get; set; }
|
||||||
public bool Depth10 { get; set; }
|
public bool Depth10 { get; set; }
|
||||||
|
public int? Depth { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GreenManureTypeFarmMaps
|
public class GreenManureTypeFarmMaps
|
||||||
|
|||||||
@@ -74,7 +74,6 @@ namespace FarmMapsAPI.Carbon.Models
|
|||||||
|
|
||||||
public List<(string, int, string)> KeysWhereCropKeyExists(int year, string crop)
|
public List<(string, int, string)> KeysWhereCropKeyExists(int year, string crop)
|
||||||
{
|
{
|
||||||
//return TrippleKeyParam.Where(x => x.Value.Any(y => y.Key == column)).Select(s=>s.Key).ToList();
|
|
||||||
return TrippleKeyParam.Where(x => x.Key.Item2 == year && x.Key.Item3.ToLower() == crop.ToLower()).Select(s=>s.Key).ToList();
|
return TrippleKeyParam.Where(x => x.Key.Item2 == year && x.Key.Item3.ToLower() == crop.ToLower()).Select(s=>s.Key).ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace FarmMapsAPI.Carbon.Models
|
|||||||
public double OM_Corr { get; set; }
|
public double OM_Corr { get; set; }
|
||||||
public double Bulk_Density { get; set; }
|
public double Bulk_Density { get; set; }
|
||||||
public double Clay_Content { get; set; }
|
public double Clay_Content { get; set; }
|
||||||
public double Depth { get; set; }
|
public int? Depth { get; set; }
|
||||||
public bool Depth10 { get; set; }
|
public bool Depth10 { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
5040
config/KNMI_data.csv
5040
config/KNMI_data.csv
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user