removed references to isaria

master
Frits van Evert 2020-04-28 16:35:14 +02:00
parent 56193b1b39
commit 262bd641a8
4 changed files with 113 additions and 24 deletions

View File

@ -5,7 +5,8 @@ namespace FarmmapsNbs.Models
{
public class NitrogenInput
{
public string IsariaZipFile { get; set; }
public string ZippedShapeFile { get; set; }
public string InputVariable { get; set; }
public string OutputFileName { get; set; }
public DateTime PlantingDate { get; set; }
public DateTime MeasurementDate { get; set; }

View File

@ -77,20 +77,20 @@ namespace FarmmapsNbs
var cropfieldItem = await _generalService.CreateCropfieldItemAsync(myDriveRoot.Code,
$"VRA NBS cropfield {input.OutputFileName}", plantingDate.Year, input.GeometryJson.ToString(Formatting.None));
var dataPath = Path.Combine("Data", input.IsariaZipFile);
var isariaShapeItem =
await _generalService.UploadZipWithShapeAsync(uploadedRoot, dataPath, Path.GetFileNameWithoutExtension(input.IsariaZipFile));
if (isariaShapeItem == null)
var dataPath = Path.Combine("Data", input.ZippedShapeFile);
var shapeItem =
await _generalService.UploadZipWithShapeAsync(uploadedRoot, dataPath, Path.GetFileNameWithoutExtension(input.ZippedShapeFile));
if (shapeItem == null)
{
_logger.LogError("Could not find isaria shape item");
_logger.LogError("Could not find shape item");
return;
}
_logger.LogInformation($"Converting shape to geotiff");
var isariaGeotiffItem = await _generalService.ShapeToGeotiff(isariaShapeItem);
if (isariaGeotiffItem == null)
var geotiffItem = await _generalService.ShapeToGeotiff(shapeItem);
if (geotiffItem == null)
{
_logger.LogError("Something went wrong with isaria shape to geotiff transformation");
_logger.LogError("Something went wrong with shape to geotiff transformation");
return;
}
@ -112,20 +112,20 @@ namespace FarmmapsNbs
_logger.LogInformation("Calculating uptake map");
var uptakeMapItem =
await _nitrogenService.CalculateUptakeMap(cropfieldItem, isariaGeotiffItem, plantingDate,
measurementDate);
await _nitrogenService.CalculateUptakeMap(cropfieldItem, geotiffItem, plantingDate,
measurementDate, input.InputVariable);
_logger.LogInformation("Downloading uptake map");
await _farmmapsApiService.DownloadItemAsync(uptakeMapItem.Code,
Path.Combine(DownloadFolder, $"{input.OutputFileName}.uptake.zip"));
_logger.LogInformation("Calculating appliance map");
_logger.LogInformation("Calculating application map");
var applianceMapItem =
await _nitrogenService.CalculateApplicationMap(cropfieldItem, isariaGeotiffItem, plantingDate,
await _nitrogenService.CalculateApplicationMap(cropfieldItem, geotiffItem, plantingDate,
measurementDate,
"irmi", targetNData.TargetN);
input.InputVariable, targetNData.TargetN);
_logger.LogInformation("Downloading appliance map");
_logger.LogInformation("Downloading application map");
await _farmmapsApiService.DownloadItemAsync(applianceMapItem.Code,
Path.Combine(DownloadFolder, $"{input.OutputFileName}.application.zip"));
}

View File

@ -1,6 +1,7 @@
[
{
"isariaZipFile": "Scan_1_20190605.zip",
"zippedShapeFile": "Scan_1_20190605.zip",
"inputVariable": "irmi",
"outputFileName": "vranbs1",
"plantingDate": "2019-04-18",
"measurementDate": "2019-06-05",
@ -9,30 +10,117 @@
"geometryJson": { "type": "Polygon", "coordinates": [ [ [ 3.40843828875524, 50.638966444680605 ], [ 3.408953272886064, 50.639197789621612 ], [ 3.409242951459603, 50.639469958681836 ], [ 3.409328782148028, 50.639612846807708 ], [ 3.409457528180712, 50.639789755314411 ], [ 3.409639918393741, 50.640014292074966 ], [ 3.409833037442765, 50.640211611372706 ], [ 3.410069071836049, 50.640395321698435 ], [ 3.410380208081761, 50.640572227259661 ], [ 3.410605513638958, 50.640715112034222 ], [ 3.411925160474145, 50.641177783561204 ], [ 3.411935889310142, 50.640728720085136 ], [ 3.412590348309737, 50.63948356709389 ], [ 3.413244807309242, 50.638224772339846 ], [ 3.413400375432099, 50.637901562841307 ], [ 3.413539850300779, 50.637449065809889 ], [ 3.413475477284437, 50.637418445552932 ], [ 3.40999396998362, 50.637449065810451 ], [ 3.409940325803365, 50.638102293212661 ], [ 3.409575545377398, 50.638483338338325 ], [ 3.409060561246574, 50.638707881340494 ], [ 3.40843828875524, 50.638966444680605 ] ] ] }
},
{
"isariaZipFile": "Scan_1_20190605.zip",
"zippedShapeFile": "Scan_1_20190605.zip",
"inputVariable": "irmi",
"outputFileName": "vranbs2",
"plantingDate": "2019-04-18",
"measurementDate": "2019-06-05",
"potatoPurposeType": "starch",
"targetYield": 45,
"geometryJson": { "type": "Polygon", "coordinates": [ [ [ 3.40843828875524, 50.638966444680605 ], [ 3.408953272886064, 50.639197789621612 ], [ 3.409242951459603, 50.639469958681836 ], [ 3.409328782148028, 50.639612846807708 ], [ 3.409457528180712, 50.639789755314411 ], [ 3.409639918393741, 50.640014292074966 ], [ 3.409833037442765, 50.640211611372706 ], [ 3.410069071836049, 50.640395321698435 ], [ 3.410380208081761, 50.640572227259661 ], [ 3.410605513638958, 50.640715112034222 ], [ 3.411925160474145, 50.641177783561204 ], [ 3.411935889310142, 50.640728720085136 ], [ 3.412590348309737, 50.63948356709389 ], [ 3.413244807309242, 50.638224772339846 ], [ 3.413400375432099, 50.637901562841307 ], [ 3.413539850300779, 50.637449065809889 ], [ 3.413475477284437, 50.637418445552932 ], [ 3.40999396998362, 50.637449065810451 ], [ 3.409940325803365, 50.638102293212661 ], [ 3.409575545377398, 50.638483338338325 ], [ 3.409060561246574, 50.638707881340494 ], [ 3.40843828875524, 50.638966444680605 ] ] ] }
"geometryJson": {
"type": "Polygon",
"coordinates": [
[
[ 3.40843828875524, 50.638966444680605 ],
[ 3.408953272886064, 50.639197789621612 ],
[ 3.409242951459603, 50.639469958681836 ],
[ 3.409328782148028, 50.639612846807708 ],
[ 3.409457528180712, 50.639789755314411 ],
[ 3.409639918393741, 50.640014292074966 ],
[ 3.409833037442765, 50.640211611372706 ],
[ 3.410069071836049, 50.640395321698435 ],
[ 3.410380208081761, 50.640572227259661 ],
[ 3.410605513638958, 50.640715112034222 ],
[ 3.411925160474145, 50.641177783561204 ],
[ 3.411935889310142, 50.640728720085136 ],
[ 3.412590348309737, 50.63948356709389 ],
[ 3.413244807309242, 50.638224772339846 ],
[ 3.413400375432099, 50.637901562841307 ],
[ 3.413539850300779, 50.637449065809889 ],
[ 3.413475477284437, 50.637418445552932 ],
[ 3.40999396998362, 50.637449065810451 ],
[ 3.409940325803365, 50.638102293212661 ],
[ 3.409575545377398, 50.638483338338325 ],
[ 3.409060561246574, 50.638707881340494 ],
[ 3.40843828875524, 50.638966444680605 ]
]
]
}
},
{
"isariaZipFile": "Scan_1_20190605.zip",
"zippedShapeFile": "Scan_1_20190605.zip",
"inputVariable": "irmi",
"outputFileName": "vranbs3",
"plantingDate": "2019-04-18",
"measurementDate": "2019-06-20",
"potatoPurposeType": "starch",
"targetYield": 45,
"geometryJson": { "type": "Polygon", "coordinates": [ [ [ 3.40843828875524, 50.638966444680605 ], [ 3.408953272886064, 50.639197789621612 ], [ 3.409242951459603, 50.639469958681836 ], [ 3.409328782148028, 50.639612846807708 ], [ 3.409457528180712, 50.639789755314411 ], [ 3.409639918393741, 50.640014292074966 ], [ 3.409833037442765, 50.640211611372706 ], [ 3.410069071836049, 50.640395321698435 ], [ 3.410380208081761, 50.640572227259661 ], [ 3.410605513638958, 50.640715112034222 ], [ 3.411925160474145, 50.641177783561204 ], [ 3.411935889310142, 50.640728720085136 ], [ 3.412590348309737, 50.63948356709389 ], [ 3.413244807309242, 50.638224772339846 ], [ 3.413400375432099, 50.637901562841307 ], [ 3.413539850300779, 50.637449065809889 ], [ 3.413475477284437, 50.637418445552932 ], [ 3.40999396998362, 50.637449065810451 ], [ 3.409940325803365, 50.638102293212661 ], [ 3.409575545377398, 50.638483338338325 ], [ 3.409060561246574, 50.638707881340494 ], [ 3.40843828875524, 50.638966444680605 ] ] ] }
"geometryJson": {
"type": "Polygon",
"coordinates": [
[
[ 3.40843828875524, 50.638966444680605 ],
[ 3.408953272886064, 50.639197789621612 ],
[ 3.409242951459603, 50.639469958681836 ],
[ 3.409328782148028, 50.639612846807708 ],
[ 3.409457528180712, 50.639789755314411 ],
[ 3.409639918393741, 50.640014292074966 ],
[ 3.409833037442765, 50.640211611372706 ],
[ 3.410069071836049, 50.640395321698435 ],
[ 3.410380208081761, 50.640572227259661 ],
[ 3.410605513638958, 50.640715112034222 ],
[ 3.411925160474145, 50.641177783561204 ],
[ 3.411935889310142, 50.640728720085136 ],
[ 3.412590348309737, 50.63948356709389 ],
[ 3.413244807309242, 50.638224772339846 ],
[ 3.413400375432099, 50.637901562841307 ],
[ 3.413539850300779, 50.637449065809889 ],
[ 3.413475477284437, 50.637418445552932 ],
[ 3.40999396998362, 50.637449065810451 ],
[ 3.409940325803365, 50.638102293212661 ],
[ 3.409575545377398, 50.638483338338325 ],
[ 3.409060561246574, 50.638707881340494 ],
[ 3.40843828875524, 50.638966444680605 ]
]
]
}
},
{
"isariaZipFile": "Scan_1_20190605.zip",
"zippedShapeFile": "Scan_1_20190605.zip",
"inputVariable": "irmi",
"outputFileName": "vranbs4",
"plantingDate": "2019-04-18",
"measurementDate": "2019-07-03",
"potatoPurposeType": "starch",
"targetYield": 45,
"geometryJson": { "type": "Polygon", "coordinates": [ [ [ 3.40843828875524, 50.638966444680605 ], [ 3.408953272886064, 50.639197789621612 ], [ 3.409242951459603, 50.639469958681836 ], [ 3.409328782148028, 50.639612846807708 ], [ 3.409457528180712, 50.639789755314411 ], [ 3.409639918393741, 50.640014292074966 ], [ 3.409833037442765, 50.640211611372706 ], [ 3.410069071836049, 50.640395321698435 ], [ 3.410380208081761, 50.640572227259661 ], [ 3.410605513638958, 50.640715112034222 ], [ 3.411925160474145, 50.641177783561204 ], [ 3.411935889310142, 50.640728720085136 ], [ 3.412590348309737, 50.63948356709389 ], [ 3.413244807309242, 50.638224772339846 ], [ 3.413400375432099, 50.637901562841307 ], [ 3.413539850300779, 50.637449065809889 ], [ 3.413475477284437, 50.637418445552932 ], [ 3.40999396998362, 50.637449065810451 ], [ 3.409940325803365, 50.638102293212661 ], [ 3.409575545377398, 50.638483338338325 ], [ 3.409060561246574, 50.638707881340494 ], [ 3.40843828875524, 50.638966444680605 ] ] ] }
"geometryJson": {
"type": "Polygon",
"coordinates": [
[
[ 3.40843828875524, 50.638966444680605 ],
[ 3.408953272886064, 50.639197789621612 ],
[ 3.409242951459603, 50.639469958681836 ],
[ 3.409328782148028, 50.639612846807708 ],
[ 3.409457528180712, 50.639789755314411 ],
[ 3.409639918393741, 50.640014292074966 ],
[ 3.409833037442765, 50.640211611372706 ],
[ 3.410069071836049, 50.640395321698435 ],
[ 3.410380208081761, 50.640572227259661 ],
[ 3.410605513638958, 50.640715112034222 ],
[ 3.411925160474145, 50.641177783561204 ],
[ 3.411935889310142, 50.640728720085136 ],
[ 3.412590348309737, 50.63948356709389 ],
[ 3.413244807309242, 50.638224772339846 ],
[ 3.413400375432099, 50.637901562841307 ],
[ 3.413539850300779, 50.637449065809889 ],
[ 3.413475477284437, 50.637418445552932 ],
[ 3.40999396998362, 50.637449065810451 ],
[ 3.409940325803365, 50.638102293212661 ],
[ 3.409575545377398, 50.638483338338325 ],
[ 3.409060561246574, 50.638707881340494 ],
[ 3.40843828875524, 50.638966444680605 ]
]
]
}
}
]

View File

@ -84,7 +84,7 @@ namespace FarmmapsNbs
/// <param name="measurementDate">The date the measurements are taken</param>
/// <returns></returns>
public async Task<Item> CalculateUptakeMap(Item cropfieldItem, Item inputItem, DateTime plantingDate,
DateTime measurementDate, string inputType = "irmi")
DateTime measurementDate, string inputType)
{
var nbsUptakeMapRequest = new TaskRequest {TaskType = VRANBS_TASK};
nbsUptakeMapRequest.attributes["operation"] = "uptake";
@ -135,7 +135,7 @@ namespace FarmmapsNbs
/// <param name="targetN">The target nitrogen to use for the calculations</param>
/// <returns></returns>
public async Task<Item> CalculateApplicationMap(Item cropfieldItem, Item inputItem, DateTime plantingDate,
DateTime measurementDate, string inputType = "irmi", double targetN = 60.0)
DateTime measurementDate, string inputType, double targetN)
{
var nbsApplianceMapRequest = new TaskRequest {TaskType = VRANBS_TASK};
nbsApplianceMapRequest.attributes["operation"] = "application";