From f3a2b338105ea8dc297be2ab5612d3482c590c5f Mon Sep 17 00:00:00 2001 From: Fedde Sijbrandij Date: Tue, 15 Dec 2020 16:28:19 +0100 Subject: [PATCH] update Blight --- FarmMapsBlight/BlightApplication.cs | 4 +- FarmMapsBlight/BlightService.cs | 6 +- FarmMapsBlight/FarmMapsBlight.csproj | 2 +- FarmmapsNbs/NitrogenInput.json | 230 +++++++++++++++++---------- 4 files changed, 149 insertions(+), 93 deletions(-) diff --git a/FarmMapsBlight/BlightApplication.cs b/FarmMapsBlight/BlightApplication.cs index 8267744..6b034d3 100644 --- a/FarmMapsBlight/BlightApplication.cs +++ b/FarmMapsBlight/BlightApplication.cs @@ -74,8 +74,8 @@ namespace FarmMapsBlight cropfieldItem = await _farmmapsApiService.GetItemAsync(_settings.CropfieldItemCode); } - DateTime adviceDate = DateTime.Now.Date; - DateTime plantingDate = new DateTime(2020, 3, 20); + DateTime adviceDate = new DateTime(2020, 7, 7);// DateTime.Now.Date; + DateTime plantingDate = new DateTime(2020, 4, 20); DateTime emergeDate = new DateTime(2020, 5, 20); var blightItem = await _blightService.CreateAdvice(cropfieldItem, adviceDate, plantingDate, emergeDate); diff --git a/FarmMapsBlight/BlightService.cs b/FarmMapsBlight/BlightService.cs index fb050fb..578a134 100644 --- a/FarmMapsBlight/BlightService.cs +++ b/FarmMapsBlight/BlightService.cs @@ -32,12 +32,12 @@ namespace FarmMapsBlight TaskType = "vnd.farmmaps.task.blight" }; - taskRequest.attributes["d"] = DateTime.Now.Date.ToString("o"); + taskRequest.attributes["d"] = adviceDate.ToUniversalTime().ToString("o"); taskRequest.attributes["plantingDate"] = plantingDate.ToUniversalTime().ToString("o"); taskRequest.attributes["emergeDate"] = emergeDate.ToUniversalTime().ToString("o"); List sprays = new List(); - sprays.Add(new Spray() { fungicideCode = "FLEX", SprayTime = new DateTime(2020, 9, 1), dose = 0.6, isVRA = false }); + sprays.Add(new Spray() { fungicideCode = "FLEX", SprayTime = new DateTime(2020, 7, 1), dose = 0.6, isVRA = false }); taskRequest.attributes["sprays"] = JsonConvert.SerializeObject(sprays); List irrigations = new List(); @@ -47,8 +47,8 @@ namespace FarmMapsBlight var taskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, taskRequest); await PollTask(TimeSpan.FromSeconds(3), async (tokenSource) => { - _logger.LogInformation("Checking blight task status"); var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, taskCode); + _logger.LogInformation($"Checking blight task status: { itemTaskStatus.State}"); if (itemTaskStatus.IsFinished) tokenSource.Cancel(); }); diff --git a/FarmMapsBlight/FarmMapsBlight.csproj b/FarmMapsBlight/FarmMapsBlight.csproj index 052b891..37ce34b 100644 --- a/FarmMapsBlight/FarmMapsBlight.csproj +++ b/FarmMapsBlight/FarmMapsBlight.csproj @@ -11,7 +11,7 @@ - Never + always diff --git a/FarmmapsNbs/NitrogenInput.json b/FarmmapsNbs/NitrogenInput.json index 7f69b17..ab9ebc6 100644 --- a/FarmmapsNbs/NitrogenInput.json +++ b/FarmmapsNbs/NitrogenInput.json @@ -1,98 +1,12 @@ [ { "file": "Scan_1_20190605.json", - "inputVariable": "irmi", + "inputVariable": "irmi", "outputFileName": "vranbs1", "plantingDate": "2019-04-18", "measurementDate": "2019-06-05", "potatoPurposeType": "consumption", "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 ] ] ] } - }, - { - "file": "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 ] - ] - ] - } - }, - { - "file": "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 ] - ] - ] - } - }, - { - "file": "Scan_1_20190605.zip", - "inputVariable": "irmi", - "outputFileName": "vranbs4", - "plantingDate": "2019-04-18", - "measurementDate": "2019-07-03", - "potatoPurposeType": "starch", - "targetYield": 45, "geometryJson": { "type": "Polygon", "coordinates": [ @@ -121,6 +35,148 @@ [ 3.40843828875524, 50.638966444680605 ] ] ] + //}, + //{ + //"file": "[...].json", + //"inputVariable": "wdvi", + //"outputFileName": "20201211_Mahindra", + //"plantingDate": "2020-11-25", + //"measurementDate": "2020-12-08", + //"potatoPurposeType": "consumption", + //"targetYield": 45, + //"geometryJson": { + // "type": "Polygon", + // "coordinates": [ + // [ + // [ 75.4652734163369, 31.26328617861426 ], + // [ 75.46527659380338, 31.26437743805827 ], + // [ 75.46494267602188, 31.26438166160194 ], + // [ 75.46493257618651, 31.26462192072676 ], + // [ 75.46438242791261, 31.26462132638865 ], + // [ 75.46438225728252, 31.26334267015003 ], + // [ 75.46448543502072, 31.26333463263533 ], + // [ 75.46448842093658, 31.26302891147988 ], + // [ 75.46507631089699, 31.26299589154944 ], + // [ 75.46509039016291, 31.26329023051392 ], + // [ 75.4652734163369, 31.26328617861426 ] + // ] + // ] + //} } + + //}, + //{ + // "file": "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 ] + // ] + // ] + // } + //}, + //{ + // "file": "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 ] + // ] + // ] + // } + //}, + //{ + // "file": "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 ] + // ] + // ] + // } } ] \ No newline at end of file