changed nitrogen operation name to application.

This commit is contained in:
Mark van der Wal 2020-04-08 17:36:56 +02:00
parent 81218ec0d0
commit b6e65d2881
2 changed files with 5 additions and 4 deletions

View File

@ -52,6 +52,7 @@ namespace FarmmapsApi.Services
Item shapeItem = null; Item shapeItem = null;
await PollTask(TimeSpan.FromSeconds(3), async source => await PollTask(TimeSpan.FromSeconds(3), async source =>
{ {
_logger.LogInformation($"Searching for {itemName} item");
var uploadedFilesChildren = await _farmmapsApiService.GetItemChildrenAsync(root.Code); var uploadedFilesChildren = await _farmmapsApiService.GetItemChildrenAsync(root.Code);
var zipItems = uploadedFilesChildren.Where(i => i.Name.Contains(zipName)); var zipItems = uploadedFilesChildren.Where(i => i.Name.Contains(zipName));

View File

@ -80,7 +80,7 @@ namespace FarmmapsApiSamples
_logger.LogInformation("Calculating appliance map"); _logger.LogInformation("Calculating appliance map");
var applianceMapItem = var applianceMapItem =
await CalculateApplianceMap(cropfieldItem, isariaGeotiffItem, plantingDate, measurementDate, targetN); await CalculateApplicationMap(cropfieldItem, isariaGeotiffItem, plantingDate, measurementDate, targetN);
_logger.LogInformation("Downloading appliance map"); _logger.LogInformation("Downloading appliance map");
await _farmmapsApiService.DownloadItemAsync(applianceMapItem.Code, Path.Combine(downloadFolder, $"{applianceMapItem.Name}.zip")); await _farmmapsApiService.DownloadItemAsync(applianceMapItem.Code, Path.Combine(downloadFolder, $"{applianceMapItem.Name}.zip"));
@ -227,11 +227,11 @@ namespace FarmmapsApiSamples
/// <param name="measurementDate">The date the measurements are taken</param> /// <param name="measurementDate">The date the measurements are taken</param>
/// <param name="targetN">The target nitrogen to use for the calculations</param> /// <param name="targetN">The target nitrogen to use for the calculations</param>
/// <returns></returns> /// <returns></returns>
public async Task<Item> CalculateApplianceMap(Item cropfieldItem, Item inputItem, DateTime plantingDate, public async Task<Item> CalculateApplicationMap(Item cropfieldItem, Item inputItem, DateTime plantingDate,
DateTime measurementDate, double targetN) DateTime measurementDate, double targetN)
{ {
var nbsApplianceMapRequest = new TaskRequest {TaskType = VRANBS_TASK}; var nbsApplianceMapRequest = new TaskRequest {TaskType = VRANBS_TASK};
nbsApplianceMapRequest.attributes["operation"] = "nitrogen"; nbsApplianceMapRequest.attributes["operation"] = "application";
nbsApplianceMapRequest.attributes["inputCode"] = inputItem.Code; nbsApplianceMapRequest.attributes["inputCode"] = inputItem.Code;
nbsApplianceMapRequest.attributes["plantingDate"] = plantingDate.ToString(); nbsApplianceMapRequest.attributes["plantingDate"] = plantingDate.ToString();
nbsApplianceMapRequest.attributes["measurementDate"] = measurementDate.ToString(); nbsApplianceMapRequest.attributes["measurementDate"] = measurementDate.ToString();
@ -264,7 +264,7 @@ namespace FarmmapsApiSamples
var applianceMapItem = geotiffItems.SingleOrDefault(i => i.Name.Contains("nitrogen") && i.Updated >= itemTask.Finished); var applianceMapItem = geotiffItems.SingleOrDefault(i => i.Name.Contains("nitrogen") && i.Updated >= itemTask.Finished);
if (applianceMapItem == null) if (applianceMapItem == null)
{ {
_logger.LogError("Could not find the nitrogen geotiff child item under cropfield"); _logger.LogError("Could not find the application map geotiff child item under cropfield");
return null; return null;
} }