/// <summary> /// Produces an array of uncertainties for the request supplied /// </summary> /// <param name="request"></param> /// <returns></returns> public async Task <Array> EvaluateAsync(IRequestContext context) { var name = context.Request.EnvironmentVariableName; var stratched = RequestToBatchAdapter.Stratch(context.Request); var annotated = stratched.Select(c => new NameAnnotatedGeoCell(c, name)); var result = await component.EvaluateCellsBatchAsync(annotated); Array res = RequestToBatchAdapter.Fold(result, context.Request); return(res); }
/// <summary> /// Produces the mean values array for the request supplied, applying the optional boolean mask to the request /// </summary> /// <param name="request">A spatio-temporal region to produce a mean values for</param> /// <param name="mask">An optional boolean array (the same dimensions as a result array) containing false values for the nodes where the mean values calculation can be omitted</param> /// <returns></returns> public async Task <Array> AggregateAsync(IRequestContext context, Array mask = null) { IFetchRequest request = context.Request; var name = context.Request.EnvironmentVariableName; IEnumerable <IGeoCell> cells = RequestToBatchAdapter.Stratch(request, mask); IEnumerable <ICellRequest> requests = cells.Select(c => new NameAnnotatedGeoCell(c, name)); double[] strechedResults = await component.AggregateCellsBatchAsync(requests); Array res = RequestToBatchAdapter.Fold(strechedResults, request, mask); return(res); }