Example #1
0
File: GLDAS.cs Project: quanted/hms
        /// <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);
        }