/// <summary> /// Makes the GetData call to the base GLDAS class. /// </summary> /// <param name="errorMsg"></param> /// <param name="output"></param> /// <param name="input"></param> /// <returns></returns>S public ITimeSeriesOutput GetData(out string errorMsg, ITimeSeriesOutput output, ITimeSeriesInput input) { errorMsg = ""; Data.Source.GLDAS gldas = new Data.Source.GLDAS(); string data = gldas.GetData(out errorMsg, "Baseflow", input); if (errorMsg.Contains("ERROR")) { return(null); } ITimeSeriesOutput gldasOutput = output; gldasOutput = gldas.SetDataToOutput(out errorMsg, "Baseflow", data, output, input); if (errorMsg.Contains("ERROR")) { return(null); } gldasOutput = TemporalAggregation(out errorMsg, output, input); if (errorMsg.Contains("ERROR")) { return(null); } return(gldasOutput); }
/// <summary> /// Makes the GetData call to the base GLDAS class. /// </summary> /// <param name="errorMsg"></param> /// <param name="output"></param> /// <param name="input"></param> /// <returns></returns>S public ITimeSeriesOutput GetData(out string errorMsg, ITimeSeriesOutput output, ITimeSeriesInput input) { errorMsg = ""; Data.Source.GLDAS gldas = new Data.Source.GLDAS(); string data = gldas.GetData(out errorMsg, "PRECIP", input); //if (errorMsg.Contains("ERROR")) { return null; } //if (data.Contains("ERROR")) //{ // string[] lines = data.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries); // errorMsg = lines[0] + " Dataset: precipitation; Source: " + input.Source; // return null; //} ITimeSeriesOutput gldasOutput = output; if (errorMsg.Contains("ERROR")) { Utilities.ErrorOutput err = new ErrorOutput(); output = err.ReturnError("Precipitation", "gldas", errorMsg); errorMsg = ""; return(output); } else { gldasOutput = gldas.SetDataToOutput(out errorMsg, "Precipitation", data, output, input); } gldasOutput = TemporalAggregation(out errorMsg, output, input); if (errorMsg.Contains("ERROR")) { return(null); } return(gldasOutput); }
/// <summary> /// Makes the GetData call to the base NLDAS class. /// </summary> /// <param name="errorMsg"></param> /// <param name="output"></param> /// <param name="input"></param> /// <returns></returns> public ITimeSeriesOutput GetData(out string errorMsg, SoilMoisture input) { errorMsg = ""; Data.Source.GLDAS gldas = new Data.Source.GLDAS(); ITimeSeriesOutput gldasOutput = input.Output; List <ITimeSeriesOutput> layersData = new List <ITimeSeriesOutput>(); List <string> urls = input.Input.BaseURL; for (int i = 0; i < input.Layers.Count; i++) { input.Input.BaseURL = new List <string>() { urls[i] }; ITimeSeriesOutputFactory oFactory = new TimeSeriesOutputFactory(); ITimeSeriesOutput tempOutput = new TimeSeriesOutput(); tempOutput = oFactory.Initialize(); string data = gldas.GetData(out errorMsg, input.Layers[i].Replace('-', '_') + "_Soil_Moisture", input.Input); if (errorMsg.Contains("ERROR")) { return(null); } tempOutput = gldas.SetDataToOutput(out errorMsg, "SoilMoisture", data, tempOutput, input.Input); if (errorMsg.Contains("ERROR")) { return(null); } tempOutput = TemporalAggregation(out errorMsg, tempOutput, input.Input); if (errorMsg.Contains("ERROR")) { return(null); } layersData.Add(tempOutput); } gldasOutput = NLDAS.MergeLayers(out errorMsg, layersData, "gldas"); if (errorMsg.Contains("ERROR")) { return(null); } return(gldasOutput); }
/// <summary> /// Makes the GetData call to the base GLDAS class. /// </summary> /// <param name="errorMsg"></param> /// <param name="output"></param> /// <param name="input"></param> /// <returns></returns>S public ITimeSeriesOutput GetData(out string errorMsg, ITimeSeriesOutput output, ITimeSeriesInput input) { errorMsg = ""; string data = ""; ITimeSeriesOutput gldasOutput = output; Data.Source.GLDAS gldas = new Data.Source.GLDAS(); data = gldas.GetData(out errorMsg, "Evapotrans", input); if (errorMsg.Contains("ERROR")) { return(null); } /* * if (input.Algorithm != "gldas") * { * data = gldas.GetData(out errorMsg, "SurfaceTemp", input); * if (errorMsg.Contains("ERROR")) { return null; } * } * else * { * data = gldas.GetData(out errorMsg, "Evapotrans", input); * if (errorMsg.Contains("ERROR")) { return null; } * }*/ gldasOutput = gldas.SetDataToOutput(out errorMsg, "Evapotranspiration", data, output, input); if (errorMsg.Contains("ERROR")) { return(null); } gldasOutput = TemporalAggregation(out errorMsg, output, input); if (errorMsg.Contains("ERROR")) { return(null); } return(gldasOutput); }