Beispiel #1
0
    // sets up the statistics control
    private void CreateStatistics(Variable var, Station st, DateTime start, DateTime end, DataManager manager)
    {
        //TODO: eliminate double loading of periodCollection!!!
        PeriodCollection periods = new PeriodCollection(manager);
        periods.Load(var.Id, st.StationId);
        bool hasObservations = periods.HasObservations(new TimeInterval(start, end));

        if (hasObservations)
        {
            MeasuredTimeSeries ts = TimeSeriesFactory.CreateTimeSeries(new Sensor(st, var, start, end));
            ts.LoadObservations(manager);
            Statistics stats = new Statistics(ts);

            controls_statistics_window statControl = (controls_statistics_window) LoadControl("~/controls/statistics_window.ascx");
            statControl.Statistics = stats;
            statControl.Variable = var;
            statControl.Update();
            placeholder_statistics.Controls.Add(statControl);
        }
    }
Beispiel #2
0
 private bool CheckHourlyPrecipAvailable(Variable var, Station st, DateTime start, DateTime end, DataManager manager)
 {
     Variable tmpVar = new Variable(VariableEnum.PrecipHour);
     PeriodCollection periods = new PeriodCollection(manager);
     TimeInterval interval = new TimeInterval(start, end);
     periods.Load(st.StationId, tmpVar.Id, interval);
     if ( periods.Count > 0 )
     {
         return periods.HasObservations(interval);
     }
     else
     {
         return false;
     }
 }