public static async Task <BRAZILmodelDataSource> CreateAsync(IStorageContext dataContext) { var storageDefinition = dataContext.StorageDefinition; var latIntegratorTask = LinearIntegratorsFactory.SmartConstructAsync(dataContext, IntegratorsFactoryHelpers.AutodetectLatName(storageDefinition)); var lonIntegratorTask = LinearIntegratorsFactory.SmartConstructAsync(dataContext, IntegratorsFactoryHelpers.AutodetectLonName(storageDefinition)); var timeAxis = Enumerable.Range(0, 47).ToArray(); var timeIntegrator = new TimeAxisAvgProcessing.TimeAxisAvgFacade( timeAxis, new TimeAxisProjections.ContinousYears(referenceYear), new WeightProviders.StepFunctionInterpolation(), new DataCoverageEvaluators.ContinousMeansCoverageEvaluator()); var latIntegrator = await latIntegratorTask; var lonIntegrator = await lonIntegratorTask; var baseNodeUncertainty = new NoBaseUncertaintyProvider(); var temporalVarianceCalculaator = new LinearCombination1DVarianceCalc(new StorageContextMetadataTimeVarianceExtractor(storageDefinition), timeIntegrator); var spatialVarianceCalculator = new LinearCombinationOnSphereVarianceCalculator(new StorageContextMetadataSpatialVarianceExtractor(storageDefinition), latIntegrator, lonIntegrator); var gaussianFieldUncertaintyEvaluator = new SequentialTimeSpatialUncertaintyEvaluatorFacade(timeIntegrator, latIntegrator, lonIntegrator, temporalVarianceCalculaator, spatialVarianceCalculator, baseNodeUncertainty); var coverageCheckUncertaintyEvaluator = new GridUncertaintyConventionsDecorator(gaussianFieldUncertaintyEvaluator, latIntegrator, lonIntegrator, timeIntegrator); var variablePresenceCheckEvaluator = new VariablePresenceCheckDecorator(dataContext.StorageDefinition, coverageCheckUncertaintyEvaluator); var gridAggregator = new GridMeanAggregator(dataContext, timeIntegrator, latIntegrator, lonIntegrator, true); var clusteringAggregator = new GridClusteringDecorator(dataContext.StorageDefinition, gridAggregator, timeIntegrator, latIntegrator, lonIntegrator); var scaledAggregator = new Microsoft.Research.Science.FetchClimate2.ValueAggregators.LinearTransformDecorator(dataContext, clusteringAggregator); gridAggregator.SetMissingValue("RoadDensityData", -9999.0); gridAggregator.SetMissingValue("Deforestation", -9999.0); return(new BRAZILmodelDataSource(dataContext, variablePresenceCheckEvaluator, scaledAggregator)); }
public static async Task <CruCl20DataHandler> CreateAsync(IStorageContext dataContext) { var storageDefinition = dataContext.StorageDefinition; var latIntegratorTask = LinearIntegratorsFactory.SmartConstructAsync(dataContext, IntegratorsFactoryHelpers.AutodetectLatName(storageDefinition)); var lonIntegratorTask = LinearIntegratorsFactory.SmartConstructAsync(dataContext, IntegratorsFactoryHelpers.AutodetectLonName(storageDefinition)); var timeIntegrator = new TimeAxisAvgProcessing.MonthlyMeansOverExactYearsStepIntegratorFacade(1961, 1990); var latIntegrator = await latIntegratorTask; var lonIntegrator = await lonIntegratorTask; var thinningLatIntegrator = new SpatGridIntegatorThinningDecorator(latIntegrator); var thinningLonIntegrator = new SpatGridIntegatorThinningDecorator(lonIntegrator); var baseNodeUncertainty = new CruBaseNodeUnceratinty(); var temporalVarianceCalculaator = new LinearCombination1DVarianceCalc(new StorageContextMetadataTimeVarianceExtractor(storageDefinition, 12.0), timeIntegrator); var spatialVarianceCalculator = new LinearCombinationOnSphereVarianceCalculator(new StorageContextMetadataSpatialVarianceExtractor(storageDefinition), latIntegrator, lonIntegrator); var bitMaskProvider = new EmbeddedResourceBitMaskProvider(typeof(CruCl20DataHandler), "Microsoft.Research.Science.FetchClimate2.CruDataMask.bf"); var gaussianFieldUncertaintyEvaluator = new SequentialTimeSpatialUncertaintyEvaluatorFacade(timeIntegrator, latIntegrator, lonIntegrator, temporalVarianceCalculaator, spatialVarianceCalculator, baseNodeUncertainty); var coverageCheckUncertaintyEvaluator = new GridUncertaintyConventionsDecorator(gaussianFieldUncertaintyEvaluator, latIntegrator, lonIntegrator, timeIntegrator); var landMaskEnabledUncertaintyEvaluator = new GridBitmaskDecorator(coverageCheckUncertaintyEvaluator, bitMaskProvider); var variablePresenceCheckEvaluator = new VariablePresenceCheckDecorator(dataContext.StorageDefinition, landMaskEnabledUncertaintyEvaluator); var gridAggregator = new GridMeanAggregator(dataContext, timeIntegrator, latIntegrator, lonIntegrator, true); var clusteringAggregator = new GridClusteringDecorator(dataContext.StorageDefinition, gridAggregator, timeIntegrator, latIntegrator, lonIntegrator); return(new CruCl20DataHandler(dataContext, variablePresenceCheckEvaluator, clusteringAggregator)); }
public static async Task <ETOPO1DataHandler> CreateAsync(IStorageContext dataContext) { var storageDefinition = dataContext.StorageDefinition; var latIntegratorTask = LinearIntegratorsFactory.SmartConstructAsync(dataContext, IntegratorsFactoryHelpers.AutodetectLatName(storageDefinition)); var lonIntegratorTask = LinearIntegratorsFactory.SmartConstructAsync(dataContext, IntegratorsFactoryHelpers.AutodetectLonName(storageDefinition)); var timeIntegrator = new NoTimeAvgProcessing(); var latIntegrator = await latIntegratorTask; var lonIntegrator = await lonIntegratorTask; var thinningLatIntegrator = new SpatGridIntegatorThinningDecorator(latIntegrator); var thinningLonIntegrator = new SpatGridIntegatorThinningDecorator(lonIntegrator); var baseNodeUncertainty = new Etopo1BaseUnceratinty(); var temporalVarianceCalculaator = new ReducedDemensionLinearCombVarianceCalc(); var spatialVarianceCalculator = new LinearCombinationOnSphereVarianceCalculator(new StorageContextMetadataSpatialVarianceExtractor(storageDefinition), latIntegrator, lonIntegrator); var gaussianFieldUncertaintyEvaluator = new SequentialTimeSpatialUncertaintyEvaluatorFacade(timeIntegrator, thinningLatIntegrator, thinningLonIntegrator, temporalVarianceCalculaator, spatialVarianceCalculator, baseNodeUncertainty); var coverageCheckUncertaintyEvaluator = new GridUncertaintyConventionsDecorator(gaussianFieldUncertaintyEvaluator, latIntegrator, lonIntegrator, timeIntegrator); var variablePresenceCheckEvaluator = new VariablePresenceCheckDecorator(dataContext.StorageDefinition, coverageCheckUncertaintyEvaluator); var gridAggregator = new GridMeanAggregator(dataContext, timeIntegrator, latIntegrator, lonIntegrator, false); var clusteringAggregator = new GridClusteringDecorator(dataContext.StorageDefinition, gridAggregator, timeIntegrator, latIntegrator, lonIntegrator); return(new ETOPO1DataHandler(dataContext, variablePresenceCheckEvaluator, clusteringAggregator)); }
public static async Task <CpcDataHandler> CreateAsync(IStorageContext dataContext) { var storageDefinition = dataContext.StorageDefinition; var timeAxis = await dataContext.GetDataAsync("time"); var timeIntegrator = new TimeAxisAvgProcessing.TimeAxisAvgFacade( timeAxis, new TimeAxisProjections.ContinuousDays(new DateTime(1948, 1, 1)), new WeightProviders.StepFunctionInterpolation(), new DataCoverageEvaluators.ContinousMeansCoverageEvaluator() ); var latIntegratorTask = LinearIntegratorsFactory.SmartConstructAsync(dataContext, IntegratorsFactoryHelpers.AutodetectLatName(storageDefinition)); var lonIntegratorTask = LinearIntegratorsFactory.SmartConstructAsync(dataContext, IntegratorsFactoryHelpers.AutodetectLonName(storageDefinition)); var latIntegrator = await latIntegratorTask; var lonIntegrator = await lonIntegratorTask; var baseNodeUncertainty = new CpcBaseUnceratinty(); var temporalVarianceCalculaator = new LinearCombination1DVarianceCalc(new StorageContextMetadataTimeVarianceExtractor(storageDefinition), timeIntegrator); var spatialVarianceCalculator = new LinearCombinationOnSphereVarianceCalculator(new StorageContextMetadataSpatialVarianceExtractor(storageDefinition), latIntegrator, lonIntegrator); var gaussianFieldUncertaintyEvaluator = new SequentialTimeSpatialUncertaintyEvaluatorFacade(timeIntegrator, latIntegrator, lonIntegrator, temporalVarianceCalculaator, spatialVarianceCalculator, baseNodeUncertainty); var coverageCheckUncertaintyEvaluator = new GridUncertaintyConventionsDecorator(gaussianFieldUncertaintyEvaluator, latIntegrator, lonIntegrator, timeIntegrator); var variablePresenceCheckEvaluator = new VariablePresenceCheckDecorator(dataContext.StorageDefinition, coverageCheckUncertaintyEvaluator); var gridAggregator = new GridMeanAggregator(dataContext, timeIntegrator, latIntegrator, lonIntegrator, true); var clusteringAggregator = new GridClusteringDecorator(dataContext.StorageDefinition, gridAggregator, timeIntegrator, latIntegrator, lonIntegrator); var scaledAggregator = new Microsoft.Research.Science.FetchClimate2.ValueAggregators.LinearTransformDecorator(dataContext, clusteringAggregator); return(new CpcDataHandler(dataContext, variablePresenceCheckEvaluator, scaledAggregator)); }
public static async Task <WorldClim14DataSource> CreateAsync(IStorageContext dataContext) { var storageDefinition = dataContext.StorageDefinition; var latIntegratorTask = LinearIntegratorsFactory.SmartConstructAsync(dataContext, IntegratorsFactoryHelpers.AutodetectLatName(storageDefinition)); var lonIntegratorTask = LinearIntegratorsFactory.SmartConstructAsync(dataContext, IntegratorsFactoryHelpers.AutodetectLonName(storageDefinition)); var timeIntegrator = new TimeAxisAvgProcessing.MonthlyMeansOverEnoughYearsStepIntegratorFacade(50); // http://www.worldclim.org/methods says: "in most cases these records will represent the 1950-2000" var latIntegrator = await latIntegratorTask; var lonIntegrator = await lonIntegratorTask; var thinningLatIntegrator = new SpatGridIntegatorThinningDecorator(latIntegrator); var thinningLonIntegrator = new SpatGridIntegatorThinningDecorator(lonIntegrator); var baseNodeUncertainty = new WorldClimBaseNodeUnceratinty(); var temporalVarianceCalculaator = new LinearCombination1DVarianceCalc(new StorageContextMetadataTimeVarianceExtractor(storageDefinition, 12.0), timeIntegrator); var spatialVarianceCalculator = new LinearCombinationOnSphereVarianceCalculator(new StorageContextMetadataSpatialVarianceExtractor(storageDefinition), latIntegrator, lonIntegrator); var bitMaskProvider = new EmbeddedResourceBitMaskProvider(typeof(WorldClim14DataSource), "Microsoft.Research.Science.FetchClimate2.WcDataMask.bf"); var gaussianFieldUncertaintyEvaluator = new SequentialTimeSpatialUncertaintyEvaluatorFacade(timeIntegrator, thinningLatIntegrator, thinningLonIntegrator, temporalVarianceCalculaator, spatialVarianceCalculator, baseNodeUncertainty); var coverageCheckUncertaintyEvaluator = new GridUncertaintyConventionsDecorator(gaussianFieldUncertaintyEvaluator, latIntegrator, lonIntegrator, timeIntegrator); var landMaskEnabledUncertaintyEvaluator = new GridBitmaskDecorator(coverageCheckUncertaintyEvaluator, bitMaskProvider); var variablePresenceCheckEvaluator = new VariablePresenceCheckDecorator(dataContext.StorageDefinition, landMaskEnabledUncertaintyEvaluator); var gridAggregator = new GridMeanAggregator(dataContext, timeIntegrator, latIntegrator, lonIntegrator, true); var clusteringAggregator = new GridClusteringDecorator(dataContext.StorageDefinition, gridAggregator, timeIntegrator, latIntegrator, lonIntegrator); var scaledAggregator = new Microsoft.Research.Science.FetchClimate2.ValueAggregators.LinearTransformDecorator(dataContext, clusteringAggregator); return(new WorldClim14DataSource(dataContext, variablePresenceCheckEvaluator, scaledAggregator)); }
public static async Task <CESM1BGCDataHandler> CreateAsync(IStorageContext dataContext) { var storageDefinition = dataContext.StorageDefinition; var timeAxis = await dataContext.GetDataAsync("time"); var timeIntegrator = new TimeAxisAvgProcessing.TimeAxisAvgFacade( timeAxis, new TimeAxisProjections.ContinuousDays(new DateTime(2005, 1, 1)), new WeightProviders.StepFunctionInterpolation(), new DataCoverageEvaluators.ContinousMeansCoverageEvaluator() ); var latIntegratorTask = LinearIntegratorsFactory.SmartConstructAsync(dataContext, IntegratorsFactoryHelpers.AutodetectLatName(storageDefinition)); var lonIntegratorTask = LinearIntegratorsFactory.SmartConstructAsync(dataContext, IntegratorsFactoryHelpers.AutodetectLonName(storageDefinition)); var latIntegrator = await latIntegratorTask; var lonIntegrator = await lonIntegratorTask; var thinningTimeIntegrator = new TimeAxisIntegratorThinningDecorator(timeIntegrator); var thinningLatIntegrator = new SpatGridIntegatorThinningDecorator(latIntegrator); var thinningLonIntegrator = new SpatGridIntegatorThinningDecorator(lonIntegrator); var baseNodeUncertainty = new NoBaseUncertaintyProvider(); var temporalVarianceCalculaator = new LinearCombination1DVarianceCalc(new StorageContextMetadataTimeVarianceExtractor(storageDefinition), timeIntegrator); var spatialVarianceCalculator = new LinearCombinationOnSphereVarianceCalculator(new StorageContextMetadataSpatialVarianceExtractor(storageDefinition), latIntegrator, lonIntegrator); var gaussianFieldUncertaintyEvaluator = new SequentialTimeSpatialUncertaintyEvaluatorFacade(thinningTimeIntegrator, thinningLatIntegrator, thinningLonIntegrator, temporalVarianceCalculaator, spatialVarianceCalculator, baseNodeUncertainty); var coverageCheckUncertaintyEvaluator = new GridUncertaintyConventionsDecorator(gaussianFieldUncertaintyEvaluator, latIntegrator, lonIntegrator, timeIntegrator); var scaledUncertaintyEvaluator = new Microsoft.Research.Science.FetchClimate2.UncertaintyEvaluators.LinearTransformDecorator(coverageCheckUncertaintyEvaluator); var variablePresenceCheckEvaluator = new VariablePresenceCheckDecorator(dataContext.StorageDefinition, scaledUncertaintyEvaluator); //we do not need DegK to DegC in uncertainty as uncertainty is based on defference and does not depend on constant ofsets scaledUncertaintyEvaluator.SetTranform("pr", new Func <double, double>(v => v * 2592000.0)); //kg/m^2/s to mm/month (assuming month is 30 days) var gridAggregator = new GridMeanAggregator(dataContext, timeIntegrator, latIntegrator, lonIntegrator, false); var clusteringAggregator = new GridClusteringDecorator(dataContext.StorageDefinition, gridAggregator, timeIntegrator, latIntegrator, lonIntegrator); var scaledAggregator = new Microsoft.Research.Science.FetchClimate2.ValueAggregators.LinearTransformDecorator(dataContext, clusteringAggregator); scaledAggregator.SetAdditionalTranform("tas", new Func <double, double>(v => v - 273.15)); // DegK to DegC scaledAggregator.SetAdditionalTranform("pr", new Func <double, double>(v => v * 2592000.0)); //kg/m^2/s to mm/month (assuming month is 30 days) return(new CESM1BGCDataHandler(dataContext, variablePresenceCheckEvaluator, scaledAggregator)); }
public static async Task <GFDLDataHandler> CreateAsync(IStorageContext dataContext) { var storageDefinition = dataContext.StorageDefinition; var latIntegratorTask = LinearIntegratorsFactory.SmartConstructAsync(dataContext, IntegratorsFactoryHelpers.AutodetectLatName(storageDefinition)); var lonIntegratorTask = LinearIntegratorsFactory.SmartConstructAsync(dataContext, IntegratorsFactoryHelpers.AutodetectLonName(storageDefinition)); var latIntegrator = await latIntegratorTask; var lonIntegrator = await lonIntegratorTask; var timeAxis = ((double[])(dataContext.GetDataAsync(timeAxisName).Result)).Select(elem => (elem - 15.5) * 0.9863013698630137).ToArray(); // Shifting middle of the interval to the beginning of the interval and convert from 365 to 360 years day int startYear = GetStartYear(dataContext, timeAxisName); int startDay = GetStartDay(dataContext, timeAxisName); var timeIntegrator = new TimeAxisAvgProcessing.TimeAxisAvgFacade( timeAxis, new TimeAxisProjections.ContinuousDays360(startYear, startDay), new WeightProviders.StepFunctionInterpolation(), new DataCoverageEvaluators.ContinousMeansCoverageEvaluator()) ; // units = days since 2001-01-01 00:00:00 var baseNodeUncertainty = new NoBaseUncertaintyProvider(); var temporalVarianceCalculaator = new LinearCombination1DVarianceCalc(new StorageContextMetadataTimeVarianceExtractor(storageDefinition), timeIntegrator); var spatialVarianceCalculator = new LinearCombinationOnSphereVarianceCalculator(new StorageContextMetadataSpatialVarianceExtractor(storageDefinition), latIntegrator, lonIntegrator); var gaussianFieldUncertaintyEvaluator = new SequentialTimeSpatialUncertaintyEvaluatorFacade(timeIntegrator, latIntegrator, lonIntegrator, temporalVarianceCalculaator, spatialVarianceCalculator, baseNodeUncertainty); var coverageCheckUncertaintyEvaluator = new GridUncertaintyConventionsDecorator(gaussianFieldUncertaintyEvaluator, latIntegrator, lonIntegrator, timeIntegrator); var scaledUncertaintyEvaluator = new Microsoft.Research.Science.FetchClimate2.UncertaintyEvaluators.LinearTransformDecorator(coverageCheckUncertaintyEvaluator); var variablePresenceCheckEvaluator = new VariablePresenceCheckDecorator(dataContext.StorageDefinition, scaledUncertaintyEvaluator); scaledUncertaintyEvaluator.SetTranform(PRECIPITATION, v => v * 2592000.0);// overriding variable metadata to convert kg/m^2/s to mm/month (assuming month is 30 days) //we do not need DegK to DegC in uncertainty as uncertainty is based on defference and does not depend on constant ofsets var gridAggregator = new GridMeanAggregator(dataContext, timeIntegrator, latIntegrator, lonIntegrator, true); var clusteringAggregator = new GridClusteringDecorator(dataContext.StorageDefinition, gridAggregator, timeIntegrator, latIntegrator, lonIntegrator); var scaledAggregator = new Microsoft.Research.Science.FetchClimate2.ValueAggregators.LinearTransformDecorator(dataContext, clusteringAggregator); scaledAggregator.SetAdditionalTranform(PRECIPITATION, v => v * 2592000.0); // overriding variable metadata to convert kg/m^2/s to mm/month (assuming month is 30 days) scaledAggregator.SetAdditionalTranform(TEMPERATURE, v => v - 273.15); // K to C return(new GFDLDataHandler(dataContext, variablePresenceCheckEvaluator, scaledAggregator)); }
public static async Task <HADCM3DataHandler> CreateAsync(IStorageContext dataContext) { var storageDefinition = dataContext.StorageDefinition; var latIntegratorTask = LinearIntegratorsFactory.SmartConstructAsync(dataContext, IntegratorsFactoryHelpers.AutodetectLatName(storageDefinition)); var lonIntegratorTask = LinearIntegratorsFactory.SmartConstructAsync(dataContext, IntegratorsFactoryHelpers.AutodetectLonName(storageDefinition)); var timeAxis = ((double[])(await dataContext.GetDataAsync("time"))).Select(elem => elem - 15).ToArray();//shifting middle of the interval (30 days length in total) to the beginning of the interval var timeIntegrator = new TimeAxisAvgProcessing.TimeAxisAvgFacade( timeAxis, new TimeAxisProjections.ContinuousDays360(1960, 1),//0 index axis value is 14400 which is 1/1/2000 12:00:00 AM new WeightProviders.StepFunctionInterpolation(), new DataCoverageEvaluators.ContinousMeansCoverageEvaluator() ); var latIntegrator = await latIntegratorTask; var lonIntegrator = await lonIntegratorTask; var baseNodeUncertainty = new NoBaseUncertaintyProvider(); var temporalVarianceCalculaator = new LinearCombination1DVarianceCalc(new StorageContextMetadataTimeVarianceExtractor(storageDefinition), timeIntegrator); var spatialVarianceCalculator = new LinearCombinationOnSphereVarianceCalculator(new StorageContextMetadataSpatialVarianceExtractor(storageDefinition), latIntegrator, lonIntegrator); var gaussianFieldUncertaintyEvaluator = new SequentialTimeSpatialUncertaintyEvaluatorFacade(timeIntegrator, latIntegrator, lonIntegrator, temporalVarianceCalculaator, spatialVarianceCalculator, baseNodeUncertainty); var coverageCheckUncertaintyEvaluator = new GridUncertaintyConventionsDecorator(gaussianFieldUncertaintyEvaluator, latIntegrator, lonIntegrator, timeIntegrator); var scaledUncertaintyEvaluator = new Microsoft.Research.Science.FetchClimate2.UncertaintyEvaluators.LinearTransformDecorator(coverageCheckUncertaintyEvaluator); var variablePresenceCheckEvaluator = new VariablePresenceCheckDecorator(dataContext.StorageDefinition, scaledUncertaintyEvaluator); scaledUncertaintyEvaluator.SetTranform("pr", p => p * 2592000); //we do not need DegK to DegC in uncertainty as uncertainty is based on defference and does not depend on constant ofsets var gridAggregator = new GridMeanAggregator(dataContext, timeIntegrator, latIntegrator, lonIntegrator, false); var clusteringAggregator = new GridClusteringDecorator(dataContext.StorageDefinition, gridAggregator, timeIntegrator, latIntegrator, lonIntegrator); var scaledAggregator = new Microsoft.Research.Science.FetchClimate2.ValueAggregators.LinearTransformDecorator(dataContext, clusteringAggregator); scaledAggregator.SetAdditionalTranform("pr", p => p * 2592000); scaledAggregator.SetAdditionalTranform("tas", t => t - 273.15); return(new HADCM3DataHandler(dataContext, variablePresenceCheckEvaluator, scaledAggregator)); }
public static async Task <MLDDataHandler> CreateAsync(IStorageContext dataContext) { var storageDefinition = dataContext.StorageDefinition; var latIntegratorTask = LinearIntegratorsFactory.SmartConstructAsync(dataContext, IntegratorsFactoryHelpers.AutodetectLatName(storageDefinition)); var lonIntegratorTask = LinearIntegratorsFactory.SmartConstructAsync(dataContext, IntegratorsFactoryHelpers.AutodetectLonName(storageDefinition)); var timeAxis = await dataContext.GetDataAsync("days since 1998-1-1 0:0:0"); var timeIntegrator = new TimeAxisAvgProcessing.TimeAxisAvgFacade( timeAxis, new TimeAxisProjections.ContinuousDays(new DateTime(1998, 1, 1)), new WeightProviders.StepFunctionInterpolation(), new DataCoverageEvaluators.ContinousMeansCoverageEvaluator()); var latIntegrator = await latIntegratorTask; var lonIntegrator = await lonIntegratorTask; var thinningLatIntegrator = new SpatGridIntegatorThinningDecorator(latIntegrator); var thinningLonIntegrator = new SpatGridIntegatorThinningDecorator(lonIntegrator); var thinningTimeIntegrator = new TimeAxisIntegratorThinningDecorator(timeIntegrator); var baseNodeUncertainty = new NoBaseUncertaintyProvider(); var temporalVarianceCalculaator = new LinearCombination1DVarianceCalc(new StorageContextMetadataTimeVarianceExtractor(storageDefinition), timeIntegrator); var spatialVarianceCalculator = new LinearCombinationOnSphereVarianceCalculator(new StorageContextMetadataSpatialVarianceExtractor(storageDefinition), latIntegrator, lonIntegrator); var gaussianFieldUncertaintyEvaluator = new SequentialTimeSpatialUncertaintyEvaluatorFacade(thinningTimeIntegrator, thinningLatIntegrator, thinningLonIntegrator, temporalVarianceCalculaator, spatialVarianceCalculator, baseNodeUncertainty); var coverageCheckUncertaintyEvaluator = new GridUncertaintyConventionsDecorator(gaussianFieldUncertaintyEvaluator, latIntegrator, lonIntegrator, timeIntegrator); var variablePresenceCheckEvaluator = new VariablePresenceCheckDecorator(dataContext.StorageDefinition, coverageCheckUncertaintyEvaluator); var gridAggregator = new GridMeanAggregator(dataContext, timeIntegrator, latIntegrator, lonIntegrator, true); var clusteringAggregator = new GridClusteringDecorator(dataContext.StorageDefinition, gridAggregator, timeIntegrator, latIntegrator, lonIntegrator); gridAggregator.SetMissingValue("data", -9999); return(new MLDDataHandler(dataContext, variablePresenceCheckEvaluator, clusteringAggregator)); }
/// <summary> /// Performs "default" dependency injection to assable general purpuse grid data handler with specified time axis interpolator"" /// </summary> /// <param name="dataContext"></param> /// <param name="timeIntegrator"></param> /// <returns></returns> public static async Task <Tuple <IBatchUncertaintyEvaluator, IBatchValueAggregator> > EasyConstructAsync(IStorageContext dataContext, ITimeAxisAvgProcessing timeIntegrator) { var storageDefinition = dataContext.StorageDefinition; var latIntegratorTask = LinearIntegratorsFactory.SmartConstructAsync(dataContext, IntegratorsFactoryHelpers.AutodetectLatName(storageDefinition)); var lonIntegratorTask = LinearIntegratorsFactory.SmartConstructAsync(dataContext, IntegratorsFactoryHelpers.AutodetectLonName(storageDefinition)); var latIntegrator = await latIntegratorTask; var lonIntegrator = await lonIntegratorTask; var baseNodeUncertainty = new NoBaseUncertaintyProvider(); var temporalVarianceCalculaator = new LinearCombination1DVarianceCalc(new StorageContextMetadataTimeVarianceExtractor(storageDefinition), timeIntegrator); var spatialVarianceCalculator = new LinearCombinationOnSphereVarianceCalculator(new StorageContextMetadataSpatialVarianceExtractor(storageDefinition), latIntegrator, lonIntegrator); var gaussianFieldUncertaintyEvaluator = new SequentialTimeSpatialUncertaintyEvaluatorFacade(timeIntegrator, latIntegrator, lonIntegrator, temporalVarianceCalculaator, spatialVarianceCalculator, baseNodeUncertainty); var coverageCheckUncertaintyEvaluator = new GridUncertaintyConventionsDecorator(gaussianFieldUncertaintyEvaluator, latIntegrator, lonIntegrator, timeIntegrator); var scaledUncertaintyEvaluator = new Microsoft.Research.Science.FetchClimate2.UncertaintyEvaluators.LinearTransformDecorator(coverageCheckUncertaintyEvaluator); var variablePresenceCheckEvaluator = new VariablePresenceCheckDecorator(dataContext.StorageDefinition, scaledUncertaintyEvaluator); var gridAggregator = new GridMeanAggregator(dataContext, timeIntegrator, latIntegrator, lonIntegrator, true); var clusteringAggregator = new GridClusteringDecorator(dataContext.StorageDefinition, gridAggregator, timeIntegrator, latIntegrator, lonIntegrator); var scaledAggregator = new Microsoft.Research.Science.FetchClimate2.ValueAggregators.LinearTransformDecorator(dataContext, clusteringAggregator); return(Tuple.Create((IBatchUncertaintyEvaluator)variablePresenceCheckEvaluator, (IBatchValueAggregator)scaledAggregator)); }