39 Commits

Author SHA1 Message Date
98db16fc7e Merge branch 'develop'
All checks were successful
FarmMaps/CarbonLib/pipeline/head This commit looks good
FarmMaps.Develop/CarbonLib/pipeline/head This commit looks good
2023-10-11 10:44:47 +02:00
0f24014de0 Update CarbonLib.csproj
All checks were successful
FarmMaps.Develop/CarbonLib/pipeline/head This commit looks good
++version
2023-10-11 08:42:44 +00:00
bd2d025164 Update CarbonLib.csproj
All checks were successful
FarmMaps/CarbonLib/pipeline/head This commit looks good
2023-10-11 08:42:12 +00:00
jenkins
cc4cde76cb [ci skip] Changed by Jenkins: 23
All checks were successful
FarmMaps/CarbonLib/pipeline/head This commit looks good
2023-08-04 14:42:39 +00:00
jenkins
b6c0628682 [ci skip] Changed by Jenkins: 56
All checks were successful
FarmMaps.Develop/CarbonLib/pipeline/head This commit looks good
2023-08-04 14:32:12 +00:00
jenkins
4b9d2e6e05 [ci skip] Changed by Jenkins: 55
Some checks reported warnings
FarmMaps.Develop/CarbonLib/pipeline/head This commit is unstable
2023-08-04 14:25:42 +00:00
jenkins
e22878ccdb [ci skip] Changed by Jenkins: 53
Some checks reported warnings
FarmMaps.Develop/CarbonLib/pipeline/head This commit is unstable
2023-07-31 08:38:50 +00:00
jenkins
0142c17e2a [ci skip] Changed by Jenkins: 19
Some checks reported warnings
FarmMaps/CarbonLib/pipeline/head This commit is unstable
2023-07-30 12:34:12 +00:00
jenkins
a811e8eaf7 [ci skip] Changed by Jenkins: 49
Some checks reported warnings
FarmMaps/CarbonLib/pipeline/head This commit is unstable
FarmMaps.Develop/CarbonLib/pipeline/head This commit is unstable
2023-07-30 09:03:18 +00:00
62145b9569 AW-5371 Release 2023.08 libraries
Some checks reported warnings
FarmMaps.Develop/CarbonLib/pipeline/head This commit is unstable
2023-07-30 10:48:46 +02:00
58c84bc13d Merge branch 'master' into develop
# Conflicts:
#	CarbonLib.csproj
2023-07-30 10:48:02 +02:00
jenkins
dd44069132 [ci skip] Changed by Jenkins: 47
Some checks reported errors
FarmMaps.Develop/CarbonLib/pipeline/head Something is wrong with the build of this commit
2023-07-30 08:06:15 +00:00
jenkins
c96d751e2e [ci skip] Changed by Jenkins: 45
Some checks reported warnings
FarmMaps.Develop/CarbonLib/pipeline/head This commit is unstable
2023-07-30 07:59:26 +00:00
jenkins
a8e55457a5 [ci skip] Changed by Jenkins: 43
Some checks reported warnings
FarmMaps.Develop/CarbonLib/pipeline/head This commit is unstable
2023-07-28 12:22:51 +00:00
jenkins
f0caa9e1db [ci skip] Changed by Jenkins: 41
Some checks reported warnings
FarmMaps.Develop/CarbonLib/pipeline/head This commit is unstable
2023-07-28 12:03:25 +00:00
jenkins
12923be93e [ci skip] Changed by Jenkins: 38
Some checks failed
FarmMaps.Develop/CarbonLib/pipeline/head There was a failure building this commit
2023-07-28 10:09:53 +00:00
jenkins
046d681b25 [ci skip] Changed by Jenkins: 37
All checks were successful
FarmMaps.Develop/CarbonLib/pipeline/head This commit looks good
2023-07-28 09:32:16 +00:00
jenkins
34d0d86bd5 [ci skip] Changed by Jenkins: 12
All checks were successful
FarmMaps/CarbonLib/pipeline/head This commit looks good
2023-07-26 14:55:54 +00:00
6e8e8db12e jenkins
All checks were successful
FarmMaps/CarbonLib/pipeline/head This commit looks good
2023-07-26 16:55:18 +02:00
f5ec4204fe aw5277: restore previous libs
All checks were successful
FarmMaps/CarbonLib/pipeline/head This commit looks good
2023-06-27 08:32:38 +02:00
2d5fb1a48a Merge branch 'develop' of https://git.akkerweb.nl/FarmMaps/CarbonLib into develop
All checks were successful
FarmMaps/CarbonLib/pipeline/head This commit looks good
FarmMaps.Develop/CarbonLib/pipeline/head This commit looks good
2023-06-26 20:54:00 +02:00
c217195605 aw5277: new weather csv 2023-06-26 20:53:25 +02:00
7aeff96eed Merge branch 'develop' of https://git.akkerweb.nl/FarmMaps/CarbonLib into develop
All checks were successful
FarmMaps.Develop/CarbonLib/pipeline/head This commit looks good
2023-06-26 16:53:53 +02:00
96906d57cf Fix jenkins 2023-06-26 16:53:40 +02:00
jenkins
1810b0005a [ci skip] Changed by Jenkins: 33
Some checks failed
FarmMaps.Develop/CarbonLib/pipeline/head There was a failure building this commit
2023-06-26 14:49:31 +00:00
53f79ce16a Merge branch 'develop' of https://git.akkerweb.nl/FarmMaps/CarbonLib into develop
Some checks failed
FarmMaps.Develop/CarbonLib/pipeline/head There was a failure building this commit
2023-06-26 16:48:54 +02:00
e95e29a96a jenkins 2023-06-26 16:48:44 +02:00
Willem Dantuma
ea976842cd Update libs
All checks were successful
FarmMaps.Develop/CarbonLib/pipeline/head This commit looks good
FarmMaps/CarbonLib/pipeline/head This commit looks good
2023-06-12 12:15:31 +02:00
f1342b118f AW-5037 Acl migration
All checks were successful
FarmMaps.Develop/CarbonLib/pipeline/head This commit looks good
2023-05-10 15:10:38 +02:00
aa59a17a7c aw5006: upgrade to .net6
All checks were successful
FarmMaps.Develop/CarbonLib/pipeline/head This commit looks good
2023-04-26 14:17:50 +02:00
Willem Dantuma
fb2b34d7ff Update libs
All checks were successful
FarmMaps/CarbonLib/pipeline/head This commit looks good
FarmMaps.Develop/CarbonLib/pipeline/head This commit looks good
2022-08-25 15:53:48 +02:00
Willem Dantuma
a00353f464 Update libs kick version
All checks were successful
FarmMaps.Develop/CarbonLib/pipeline/head This commit looks good
FarmMaps/CarbonLib/pipeline/head This commit looks good
2022-07-27 09:53:03 +02:00
7bfe3d1e50 aw3843: fix correction
All checks were successful
FarmMaps.Develop/CarbonLib/pipeline/head This commit looks good
FarmMaps/CarbonLib/pipeline/head This commit looks good
2022-06-03 12:58:19 +02:00
e8d328d6c2 aw3843: correction on SMDMax
All checks were successful
FarmMaps.Develop/CarbonLib/pipeline/head This commit looks good
2022-06-03 11:25:01 +02:00
b0ac42a957 aw3831: fix yield with decimal
All checks were successful
FarmMaps.Develop/CarbonLib/pipeline/head This commit looks good
2022-05-26 10:24:43 +02:00
Willem Dantuma
6cc39e3482 Update libs
All checks were successful
FarmMaps.Develop/CarbonLib/pipeline/head This commit looks good
FarmMaps/CarbonLib/pipeline/head This commit looks good
2022-04-21 10:16:32 +02:00
31c8a4e250 updated wrong vegetable values
All checks were successful
FarmMaps.Develop/CarbonLib/pipeline/head This commit looks good
2022-03-07 10:56:18 +01:00
a98374129c version
All checks were successful
FarmMaps.Develop/CarbonLib/pipeline/head This commit looks good
FarmMaps/CarbonLib/pipeline/head This commit looks good
2022-02-25 11:43:00 +01:00
597f42001b aw3567: added 10cm depth measurement
All checks were successful
FarmMaps.Develop/CarbonLib/pipeline/head This commit looks good
2022-02-25 11:41:32 +01:00
15 changed files with 5307 additions and 194 deletions

1
.gitignore vendored
View File

@@ -362,3 +362,4 @@ MigrationBackup/
# Fody - auto-generated XML schema
FodyWeavers.xsd
upstreamProjects/

View File

@@ -139,7 +139,7 @@ namespace FarmMapsAPI.Carbon
Area = cropField.Area,
HistoricalCropData = mappedCropData,
SoilType = MapSoil(cropField.SoilType),
SoilProperty = new SoilProperty { Clay_Content = cropField.SoilProperty.Clay_Content, OM_Const = cropField.SoilProperty.OM_Const },
SoilProperty = new SoilProperty { Clay_Content = cropField.SoilProperty.Clay_Content, OM_Const = cropField.SoilProperty.OM_Const, Depth10 = cropField.SoilProperty.Depth10 },
GreenManures = greenManures
});
foreach (var crops in cropField.HistoricalCropData)
@@ -214,12 +214,6 @@ namespace FarmMapsAPI.Carbon
public double? GetCropYield(string cropCode, int year, int 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 crpYieldProvince = crpYield.Yields.SingleOrDefault(x => x.ProvinceCode == provinceCode);
var cropYield = crpYieldProvince.YearData.SingleOrDefault(x => x.Year == year)?.YieldValue;
@@ -242,6 +236,7 @@ namespace FarmMapsAPI.Carbon
// cropAreaSheet (external input)
var cropAreaField = GetCropAreaField(farmInput);
var year = GetYears(farmInputSet, farmInput);
//////////////////////////////////////////////
// precalculations
@@ -251,7 +246,7 @@ namespace FarmMapsAPI.Carbon
//soilPropSoilType
var soilPropSoilType = GetSoilPropSoilType(soilTypeData, soilPropertiesField);
//soilPropertiesField (again)
//soilPropertiesField (again) --> remove this
foreach (var item in soilPropertiesField)
{
var soilProps = soilPropSoilType.Keys.Where(x => x.Item1 == item.Key).ToList();
@@ -263,21 +258,63 @@ namespace FarmMapsAPI.Carbon
item.Value.OM_Corr = sumCorr;
}
var oM_corr_SoilType = new Dictionary<(string,string), double>();
foreach (var item in soilPropertiesField)
{
var soilOfItem = soilTypeData[item.Key].FirstOrDefault();
var initialSoilKey = historicalCropdata.Keys.FirstOrDefault(x => x.Item1 == item.Key && x.Item2 == year.First());
var initialSoil = historicalCropdata[initialSoilKey].FirstOrDefault();
var soilPropertyDepth10 = item.Value.Depth10;
if (initialSoil == "Temp_gras" && soilPropertyDepth10)
{
oM_corr_SoilType.Add((item.Key, soilOfItem), item.Value.OM_Cont * 0.97);
}
else if (cropSet.Grass_nat.Contains(initialSoil) && soilPropertyDepth10 && (soilOfItem == "Klei" || soilOfItem == "Zand"))
{
if (soilOfItem == "Klei")
{
oM_corr_SoilType.Add((item.Key, soilOfItem), item.Value.OM_Cont * 0.67);
}
else
{
oM_corr_SoilType.Add((item.Key, soilOfItem), item.Value.OM_Cont * 0.81);
}
}
else
{
oM_corr_SoilType.Add((item.Key, soilOfItem), item.Value.OM_Cont);
}
}
var oM_Corr = new Dictionary<string, double>();
foreach (var item in oM_corr_SoilType)
{
oM_Corr.Add(item.Key.Item1, item.Value);
}
// soilBulkDensities
Dictionary<string, SoilBulkDensityType> soilBulkDensities = GetSoilBulkDensities(soilPropertiesField, soilTypeData, soilPropSoilType);
Dictionary<string, SoilBulkDensityType> soilBulkDensities = GetSoilBulkDensities(soilPropertiesField, soilTypeData, soilPropSoilType, oM_corr_SoilType);
foreach (var soilBulkDensity in soilBulkDensities)
{
if (soilPropSoilType.ContainsKey((soilBulkDensity.Key, "Klei")))
{
soilPropSoilType[(soilBulkDensity.Key, "Klei")].Bulk_Density = (1.0 / soilBulkDensity.Value.Clay);
soilBulkDensity.Value.Clay = (1.0 / soilBulkDensity.Value.Clay);
}
if (soilPropSoilType.ContainsKey((soilBulkDensity.Key, "Zand")))
{
soilPropSoilType[(soilBulkDensity.Key, "Zand")].Bulk_Density = (1.0 / soilBulkDensity.Value.Sand);
soilBulkDensity.Value.Sand = (1.0 / soilBulkDensity.Value.Sand);
}
}
var bulkDens = new Dictionary<string, double>();
foreach (var soilBulkDensity in soilBulkDensities)
{
bulkDens.Add(soilBulkDensity.Key, (soilBulkDensity.Value.Clay + soilBulkDensity.Value.Sand));
}
foreach (var item in soilPropertiesField)
{
var soilProps = soilPropSoilType.Keys.Where(x => x.Item1 == item.Key).ToList();
@@ -296,7 +333,6 @@ namespace FarmMapsAPI.Carbon
//////////////////////////////////////////
var soc_Field = new Dictionary<string, List<YearColumnValue>>();
var year = GetYears(farmInputSet, farmInput);
var cropAreaField1 = new Dictionary<(string, int), List<ColumnValue>>();
var carbonInputs = new GamsThreeKeyParameter();
@@ -710,7 +746,7 @@ namespace FarmMapsAPI.Carbon
coverModFactor.Add(crpCover.CropName, valueList);
}
// SMDMax (kan buiten yearLoop)
// SMDMax
// field, crop
var smdMax = new Dictionary<string, double>();
foreach (var soil in soilPropertiesField)
@@ -719,7 +755,7 @@ namespace FarmMapsAPI.Carbon
smdMax.Add(soil.Key, result);
}
// SMDaccMonthi (kan buiten yearLoop ??)
// SMDaccMonthi
var smdAccMonthi = new Dictionary<string, List<ColumnValue>>();
foreach (var climateItem in climateVariable)
@@ -729,16 +765,43 @@ namespace FarmMapsAPI.Carbon
{
if (i == 0)
{
/* 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 result = climateItem.Value[i].Precipitation - climateItem.Value[i].Evapotranspiration;
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));
}
else
{
/* 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 result = climateItem.Value[i].Precipitation - climateItem.Value[i].Evapotranspiration + valueList.SingleOrDefault(x => x.Key == $"M{i}").Value;
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));
}
}
@@ -753,13 +816,26 @@ namespace FarmMapsAPI.Carbon
var valueList = new List<ColumnValue>();
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));
}
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));
}
}
@@ -798,7 +874,7 @@ namespace FarmMapsAPI.Carbon
foreach (var field in cropAreaField1.Where(x => x.Key.Item2 == loopYear))
{
var valueList = new List<ColumnValue>();
var result = parameterSet.LayerDepth * soilPropertiesField[field.Key.Item1].Bulk_Density * soilPropertiesField[field.Key.Item1].OM_Corr * 0.54;
var result = parameterSet.LayerDepth * bulkDens[field.Key.Item1] * oM_Corr[field.Key.Item1] * 0.54;
foreach (var crop in field.Value)
{
valueList.Add(new ColumnValue(crop.Key, result));
@@ -1544,18 +1620,18 @@ namespace FarmMapsAPI.Carbon
summary.Initial = sum;
}
foreach (var item in soilPropertiesField)
foreach(var item in bulkDens)
{
var result = item.Value.Bulk_Density;
var result = item.Value;
foreach (var lYear in allYears)
{
soc_Summary[(item.Key, lYear)].Add(new ColumnValue("Bulk_Density", result));
}
}
foreach (var item in soilPropertiesField)
foreach (var item in bulkDens)
{
var result = item.Value.Bulk_Density;
var result = item.Value;
foreach (var lYear in allYears)
{
var summaries = cropFieldSummary.Single(x => x.Name == item.Key);
@@ -1637,11 +1713,9 @@ namespace FarmMapsAPI.Carbon
// SOC_Summary_Farm
var soc_Summary_Farm = new List<FarmYearSummary>();
//carbonSummary.FarmSummary = soc_Summary_Farm;
foreach (var item in cropAreaFarm)
{
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 });
}
@@ -1729,7 +1803,7 @@ namespace FarmMapsAPI.Carbon
var soilPropertiesField = new Dictionary<string, SoilPropertyType>();
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 });
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 });
}
return soilPropertiesField;
@@ -1772,7 +1846,7 @@ namespace FarmMapsAPI.Carbon
return cropAreaField;
}
private Dictionary<string, SoilBulkDensityType> GetSoilBulkDensities(Dictionary<string, SoilPropertyType> soilPropertiesField, Dictionary<string, List<string>> soilTypeData, Dictionary<(string, string), SoilPropertyType> soilPropSoilType)
private Dictionary<string, SoilBulkDensityType> GetSoilBulkDensities(Dictionary<string, SoilPropertyType> soilPropertiesField, Dictionary<string, List<string>> soilTypeData, Dictionary<(string, string), SoilPropertyType> soilPropSoilType, Dictionary<(string, string), double> oM_corr_SoilType)
{
var soilBulkDensities = new Dictionary<string, SoilBulkDensityType>();
foreach (var item in soilPropertiesField)
@@ -1781,15 +1855,17 @@ namespace FarmMapsAPI.Carbon
if (soilTypeData[item.Key].Any(x => x == "Klei"))
{
var soilBulkDensityKey = soilPropSoilType.Keys.Single(x => x.Item1 == item.Key && x.Item2 == "Klei");
var clay = (0.6117 + (0.003601 * item.Value.Clay_Content)) +
(0.002172 * soilPropSoilType[soilBulkDensityKey].OM_Corr * soilPropSoilType[soilBulkDensityKey].OM_Corr) +
(0.01715 * Math.Log(soilPropSoilType[soilBulkDensityKey].OM_Corr));
(0.002172 * oM_corr_SoilType[(item.Key, "Klei")] * oM_corr_SoilType[(item.Key, "Klei")]) +
(0.01715 * Math.Log(oM_corr_SoilType[(item.Key, "Klei")]));
soilBulkDensities[item.Key].Clay = clay;
}
if (soilTypeData[item.Key].Any(x => x == "Zand"))
{
var soilBulkDensityKey = soilPropSoilType.Keys.Single(x => x.Item1 == item.Key && x.Item2 == "Zand");
soilBulkDensities[item.Key].Sand = 0.667 + (0.021 * soilPropSoilType[soilBulkDensityKey].OM_Corr);
soilBulkDensities[item.Key].Sand = 0.667 + (0.021 * oM_corr_SoilType[(item.Key, "Zand")]);
}
}
return soilBulkDensities;
@@ -1837,7 +1913,7 @@ namespace FarmMapsAPI.Carbon
var monthClimateList = new List<ClimateVariable>();
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 newMonthData = new ClimateVariable(monthData.Temperature, monthData.Precipitation, monthData.Evapotranspiration * 1.25);
monthClimateList.Add(newMonthData);
@@ -1876,11 +1952,9 @@ namespace FarmMapsAPI.Carbon
foreach (var manure in manures.GreenManureTypes)
{
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;
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) });
}
}

View File

@@ -1,21 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6</TargetFramework>
<AssemblyName>CarbonLib</AssemblyName>
<PackageId>CarbonLib</PackageId>
<RuntimeIdentifiers>win10-x64;ubuntu.16.04-x64</RuntimeIdentifiers>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<Version>1.1.3</Version>
<Version>2.2.0</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Base.Core.Common" Version="1.0.5.33-prerelease" />
<PackageReference Include="Base.Core.Common.Geometry" Version="1.0.12.2000-prerelease" />
<PackageReference Include="NetTopologySuite" Version="2.0.0" />
<PackageReference Include="NetTopologySuite.IO.GeoJSON" Version="2.0.4" />
<PackageReference Include="Base.Core.Common" Version="2.3.0" />
<PackageReference Include="Base.Core.Common.Geometry" Version="2.3.0" />
<PackageReference Include="NetTopologySuite" Version="2.5.0" />
<PackageReference Include="NetTopologySuite.IO.GeoJSON" Version="3.0.0" />
</ItemGroup>
<ItemGroup>

48
Jenkinsfile vendored
View File

@@ -1,42 +1,30 @@
@Library('farmmaps-shared-library') _
pipeline {
agent any
environment {
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()
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()
APP_VERSION="${APP_VERSION_PREFIX}"
agent any;
options {
copyArtifactPermission projectNames: env.allProjectsArtifactPermission;
disableConcurrentBuilds abortPrevious: true;
}
triggers {
upstream(
upstreamProjects: '/FarmMaps/Base.Core.Common.Geometry/master',
threshold: hudson.model.Result.SUCCESS
)
}
stages {
stage('Dotnet Restore') {
stage('BaseBuildAll') {
steps {
sh '''dotnet restore CarbonLib.csproj'''
}
}
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/'''
stepBaseBuildAll();
}
}
}
post {
success {
postSuccess();
}
always {
emailext (
body: '${DEFAULT_CONTENT}',
mimeType: 'text/html',
replyTo: '${DEFAULT_REPLYTO}',
subject: '${DEFAULT_SUBJECT}',
to: emailextrecipients([[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']])
)
postAlways();
}
}
}

View File

@@ -1,42 +1,30 @@
@Library('farmmaps-shared-library') _
pipeline {
agent any
environment {
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()
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()
APP_VERSION="${APP_VERSION_PREFIX + '-prerelease.' + env.BUILD_NUMBER}"
agent any;
options {
copyArtifactPermission projectNames: env.allProjectsArtifactPermission;
disableConcurrentBuilds abortPrevious: true;
}
triggers {
upstream(
upstreamProjects: '/FarmMaps.Develop/Base.Core.Common.Geometry/develop',
threshold: hudson.model.Result.SUCCESS
)
}
stages {
stage('Dotnet Restore') {
stage('BaseBuildAll') {
steps {
sh '''dotnet restore CarbonLib.csproj'''
}
}
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/'''
stepBaseBuildAll();
}
}
}
post {
success {
postSuccess();
}
always {
emailext (
body: '${DEFAULT_CONTENT}',
mimeType: 'text/html',
replyTo: '${DEFAULT_REPLYTO}',
subject: '${DEFAULT_SUBJECT}',
to: emailextrecipients([[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']])
)
postAlways();
}
}
}

View File

@@ -16,7 +16,6 @@ namespace CarbonService.Models
[Required]
public int PostalCode { get; set; }
public List<CropField> CropFields { get; set; }
//public List<OrgManureApplied> OrgManureApplied { get; set; }
}
public class CropField
@@ -38,14 +37,17 @@ namespace CarbonService.Models
{
public double? OM_Const { get; set; }
public double? Clay_Content { get; set; }
public bool? Depth10 { get; set; }
}
public class OrgManureApplied
{
double? yield;
[Required]
public string Crop { 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; }
}
@@ -61,8 +63,6 @@ namespace CarbonService.Models
{
[Required]
public int Year { get; set; }
//[Required]
//public List<string> Crops { get; set; }
[Required]
public List<OrgManureApplied> Crops { get; set; }
}
@@ -80,7 +80,6 @@ namespace CarbonService.Models
[Required]
public string Type { get; set; }
//public string Quality { get; set; }
[JsonConverter(typeof(StringEnumConverter))]
public Quality Quality { get; set; }
}

View File

@@ -9,8 +9,6 @@ namespace FarmMapsAPI.Carbon.Models
{
[JsonProperty("cropField")]
public List<CropFieldSummary> CropField { get; set; }
//[JsonProperty("farmSummary")]
//public List<FarmYearSummary> FarmSummary { get; set; }
}
public class CropFieldSummary

View File

@@ -15,5 +15,6 @@ namespace FarmMapsAPI.Carbon.Models
public List<StrawCrp> StrawCrops { get; set; }
public List<string> GreenManureType { get; set; }
public List<string> Perennial { get; set; }
public List<string> Grass_nat { get; set; }
}
}

View File

@@ -54,11 +54,13 @@ namespace FarmMapsAPI.Carbon.Models
public class CropData
{
double? yield;
[Required]
public string CropCode { get; set; }
public string MiterraCropName { 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; }
}
@@ -74,6 +76,7 @@ namespace FarmMapsAPI.Carbon.Models
{
public double? OM_Const { get; set; }
public double? Clay_Content { get; set; }
public bool Depth10 { get; set; }
}
public class GreenManureTypeFarmMaps

View File

@@ -74,7 +74,6 @@ namespace FarmMapsAPI.Carbon.Models
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();
}
}

View File

@@ -11,6 +11,7 @@ namespace FarmMapsAPI.Carbon.Models
public double Bulk_Density { get; set; }
public double Clay_Content { get; set; }
public double Depth { get; set; }
public bool Depth10 { get; set; }
}
struct SoilTypePropertyKey

View File

@@ -122,56 +122,56 @@
"Name": "Vegetables_root",
"DM_content": 0.099,
"FracR": 0.0,
"C_input_CropRes": 9.92567356324928,
"C_input_CropRes": 1.61648275862069,
"HarvestIndex": 0.627333333333333
},
{
"Name": "Vegetables_leaf",
"DM_content": 0.04575,
"FracR": 0.0,
"C_input_CropRes": 1.68445934694249,
"C_input_CropRes": 0.704347826086956,
"HarvestIndex": 0.56125
},
{
"Name": "Vegetables_cabbage",
"DM_content": 0.0837058823529412,
"FracR": 0.0,
"C_input_CropRes": 5.214,
"C_input_CropRes": 2.75625,
"HarvestIndex": 0.472941176470588
},
{
"Name": "Vegetables_stem",
"DM_content": 0.0752,
"FracR": 0.0,
"C_input_CropRes": 2.55076183390058,
"C_input_CropRes": 0.704347826086956,
"HarvestIndex": 0.602
},
{
"Name": "Pumpkin",
"DM_content": 0.183,
"FracR": 0.0,
"C_input_CropRes": 7.02589285714286,
"C_input_CropRes": 0.704347826086956,
"HarvestIndex": 0.56
},
{
"Name": "Chicory",
"DM_content": 0.233,
"FracR": 0.0,
"C_input_CropRes": 5.52344767793542,
"C_input_CropRes": 1.40869565217391,
"HarvestIndex": 0.6
},
{
"Name": "Courgette",
"DM_content": 0.048,
"FracR": 0.0,
"C_input_CropRes": 6.17457329509681,
"C_input_CropRes": 0.704347826086956,
"HarvestIndex": 0.40
},
{
"Name": "Other_veg",
"DM_content": 0.10967,
"FracR": 0.0,
"C_input_CropRes": 5.44269,
"C_input_CropRes": 1.22840281644892,
"HarvestIndex": 0.54622
},
{

View File

@@ -69,5 +69,10 @@
"Miscanthus",
"Switchgrass",
"Willow"
],
"Grass_nat": [
"Perm_gras",
"Nat_gras",
"Gras"
]
}

View File

@@ -36,6 +36,22 @@
"ManureSource_liv": "DIGEST",
"Description": "Digestaat"
},
{
"ManureSource_liv": "CHAMPOST",
"Description": "Champost"
},
{
"ManureSource_liv": "SCHA_GEIT",
"Description": "Schapen/geitenmest"
},
{
"ManureSource_liv": "VMPIG",
"Description": "Vaste varkensmest"
},
{
"ManureSource_liv": "DM_ZEUG",
"Description": "Zeugendrijfmest"
},
{
"ManureSource_liv": "OVERIG",
"Description": "Overig"

File diff suppressed because it is too large Load Diff