示例#1
0
            public override object GetTimeSeries(
                locationParam Location,
                VariableParam Variable,
                W3CDateTime?BeginDateTime, W3CDateTime?EndDateTime)
            {
                string siteNum;

                string parameterCode;
                string statisticCode;
                string agencyCode;
                string startDateTime = null;
                string endDateTime   = null;

                if (Location.isGeometry)
                {
                    throw new WaterOneFlowException("Geometry not supported ");
                }

                if (Location != null)
                {
                    siteNum = Location.SiteCode;
                }
                else
                {
                    throw new WaterOneFlowException("Missing SiteCode ");
                }

                if (Variable != null)
                {
                    parameterCode = Variable.Code;
                    statisticCode = option2UsgsStatCode(Variable);
                    agencyCode    = option2AgencyCode(Variable);
                }
                else
                {
                    throw new WaterOneFlowException("Missing Parameter ");
                }

                if (BeginDateTime.HasValue)
                {
                    startDateTime = BeginDateTime.Value.DateTime.ToString("yyyy-MM-dd");
                }
                else
                {
                    startDateTime = DateTime.Now.AddDays(-29).ToString("yyyy-MM-dd");
                }



                if (EndDateTime.HasValue)
                {
                    endDateTime = EndDateTime.Value.DateTime.ToString("yyyy-MM-dd");
                }
                else
                {
                    endDateTime = DateTime.Now.ToString("yyyy-MM-dd");
                }
                String dailyValues = null;

                try
                {
                    //dailyValues = svc.getDV(siteNum,
                    //                              parameterCode, statisticCode,
                    //                              startDateTime, endDateTime,
                    //                              agencyCode);
                    //NWISWS.TimeSeriesResponseType response
                    //    = svc.GetValuesObject(siteNum,
                    //                parameterCode,
                    //                startDateTime, endDateTime,
                    //                "*****@*****.**");
                    NWISWS.TimeSeriesResponseType response
                        = svc.GetValuesObject(Location.ToString(),
                                              Variable.ToString(),
                                              startDateTime, endDateTime,
                                              "*****@*****.**");
                    return(response);
                }
                catch (SoapHeaderException she)
                {
                    log.Info("USGS " + she.Message);
                    throw new WaterOneFlowSourceException("Error connecting to USGS;" + she.Message);
                }
                catch (Exception ex)
                {
                    log.Info("USGS DailyValue Connection Error " + ex.Message);
                    throw new WaterOneFlowSourceException("Error connecting to USGS");
                }
            }
示例#2
0
 public NWISUVTimeSeriesResponse(NWISWS.TimeSeriesResponseType
                                 NWISTimeSeriesResponseType)
 {
     Response = NWISTimeSeriesResponseType;
 }