Esempio n. 1
0
        //---
        //+--
        public static DataTable PeriodicDailyDataHeatIndexesPresentation(AspDataReadHeatRecordType heat, AspDataReadHeatRecordType thom)
        {
            DataTable fdt = new DataTable();

            fdt.Columns.Add(new DataColumn("Measure", typeof(string)));
            fdt.Columns.Add(new DataColumn("um", typeof(string)));
            fdt.Columns.Add(new DataColumn("Max", typeof(string)));
            fdt.Columns.Add(new DataColumn("HMax", typeof(string)));
            fdt.Columns.Add(new DataColumn("From", typeof(string)));
            fdt.Columns.Add(new DataColumn("To", typeof(string)));
            fdt.Columns.Add(new DataColumn("Mean", typeof(string)));
            fdt.Columns.Add(new DataColumn("Duration", typeof(string)));
            fdt.Columns.Add(new DataColumn("NMeasure", typeof(string)));

            AspMeasureDescriptioType dtype = AspUtility.LiteralDecodeMeteoParametersType(AspMeteoParametersType.HeathIndex);
            DataRow hr = fdt.NewRow();

            hr["Measure"]  = dtype.Description;
            hr["um"]       = dtype.MeasureUnit;
            hr["Max"]      = float.IsNaN(heat.Max) ? AspUtility.BadDataPresentation : heat.Max.ToString("#0.0");
            hr["HMax"]     = AspUtility.MorphHourToString(heat.HMax);
            hr["From"]     = AspUtility.MorphHourToString(heat.From);
            hr["To"]       = AspUtility.MorphHourToString(heat.To);
            hr["Mean"]     = float.IsNaN(heat.Mean) ? AspUtility.BadDataPresentation : heat.Mean.ToString("#0.0");
            hr["Duration"] = heat.Duration < 0 ? AspUtility.BadDataPresentation : heat.Duration.ToString();
            hr["NMeasure"] = heat.NMeasure < 0 ? AspUtility.BadDataPresentation : heat.NMeasure.ToString();
            fdt.Rows.Add(hr);

            AspMeasureDescriptioType dtype2 = AspUtility.LiteralDecodeMeteoParametersType(AspMeteoParametersType.Thom);
            DataRow tr = fdt.NewRow();

            tr["Measure"]  = dtype2.Description;
            tr["um"]       = string.Empty;
            tr["Max"]      = float.IsNaN(thom.Max) ? AspUtility.BadDataPresentation : thom.Max.ToString("#0.0");
            tr["HMax"]     = AspUtility.MorphHourToString(thom.HMax);
            tr["From"]     = AspUtility.MorphHourToString(thom.From);
            tr["To"]       = AspUtility.MorphHourToString(thom.To);
            tr["Mean"]     = float.IsNaN(thom.Mean) ? AspUtility.BadDataPresentation : thom.Mean.ToString("#0.0");
            tr["Duration"] = thom.Duration < 0 ? AspUtility.BadDataPresentation : thom.Duration.ToString();
            tr["NMeasure"] = thom.NMeasure < 0 ? AspUtility.BadDataPresentation : thom.NMeasure.ToString();
            fdt.Rows.Add(tr);

            fdt.Columns["Measure"].ColumnName  = "Misura";
            fdt.Columns["um"].ColumnName       = "Unità Misura";
            fdt.Columns["Max"].ColumnName      = "Massimo";
            fdt.Columns["HMax"].ColumnName     = "Ora Massimo";
            fdt.Columns["From"].ColumnName     = "Da";
            fdt.Columns["To"].ColumnName       = "A";
            fdt.Columns["Mean"].ColumnName     = "Media";
            fdt.Columns["Duration"].ColumnName = "Durata";
            fdt.Columns["NMeasure"].ColumnName = "# Misure";
            return(fdt);
        }
Esempio n. 2
0
        //---
        //+--
        public static DataTable PeriodicDailyDataHourlyPresentation(AspDataReadSequenceRecordType[] records)
        {
            DataTable fdt = new DataTable();

            fdt.Columns.Add(new DataColumn("hfrom", typeof(string)));
            fdt.Columns.Add(new DataColumn("hto", typeof(string)));
            fdt.Columns.Add(new DataColumn("temp", typeof(string)));
            fdt.Columns.Add(new DataColumn("umid", typeof(string)));
            fdt.Columns.Add(new DataColumn("press", typeof(string)));
            fdt.Columns.Add(new DataColumn("dewpoint", typeof(string)));
            fdt.Columns.Add(new DataColumn("windmax", typeof(string)));
            fdt.Columns.Add(new DataColumn("wind", typeof(string)));
            fdt.Columns.Add(new DataColumn("windangle", typeof(string)));
            fdt.Columns.Add(new DataColumn("heat", typeof(string)));
            fdt.Columns.Add(new DataColumn("thom", typeof(string)));
            fdt.Columns.Add(new DataColumn("windchill", typeof(string)));
            fdt.Columns.Add(new DataColumn("uv", typeof(string)));
            fdt.Columns.Add(new DataColumn("rad", typeof(string)));
            fdt.Columns.Add(new DataColumn("ev", typeof(string)));
            fdt.Columns.Add(new DataColumn("rain", typeof(string)));

            for (int i = 0; i < records.Length; i++)
            {
                DataRow dtr = fdt.NewRow();

                dtr["hfrom"]     = AspUtility.MorphHourToString(records[i].hfrom);
                dtr["hto"]       = AspUtility.MorphHourToString(records[i].hto);
                dtr["temp"]      = float.IsNaN(records[i].temperature) ? AspUtility.BadDataPresentation : records[i].temperature.ToString("#0.0");
                dtr["umid"]      = float.IsNaN(records[i].umidity) ? AspUtility.BadDataPresentation : records[i].umidity.ToString("#0.0");
                dtr["press"]     = float.IsNaN(records[i].pressure) ? AspUtility.BadDataPresentation : records[i].pressure.ToString("#0.0");
                dtr["dewpoint"]  = float.IsNaN(records[i].dewpoint) ? AspUtility.BadDataPresentation : records[i].dewpoint.ToString("#0.0");
                dtr["windmax"]   = float.IsNaN(records[i].windmax) ? AspUtility.BadDataPresentation : records[i].windmax.ToString("#0.0");
                dtr["wind"]      = float.IsNaN(records[i].wind) ? AspUtility.BadDataPresentation : records[i].wind.ToString("#0.0");
                dtr["windangle"] = float.IsNaN(records[i].windangle) ? AspUtility.BadDataPresentation : records[i].windangle.ToString("#0.0");
                dtr["heat"]      = float.IsNaN(records[i].heat) ? AspUtility.BadDataPresentation : records[i].heat.ToString("#0.0");
                dtr["thom"]      = float.IsNaN(records[i].thom) ? AspUtility.BadDataPresentation : records[i].thom.ToString("#0.0");
                dtr["windchill"] = float.IsNaN(records[i].windchill) ? AspUtility.BadDataPresentation : records[i].windchill.ToString("#0.0");
                dtr["uv"]        = float.IsNaN(records[i].uv) ? AspUtility.BadDataPresentation : records[i].uv.ToString("#0.0");
                dtr["rad"]       = float.IsNaN(records[i].radiation) ? AspUtility.BadDataPresentation : records[i].radiation.ToString("#0.0");
                dtr["ev"]        = float.IsNaN(records[i].evapotraspiration) ? AspUtility.BadDataPresentation : records[i].evapotraspiration.ToString("#0.0");
                dtr["rain"]      = float.IsNaN(records[i].rain) ? AspUtility.BadDataPresentation : records[i].rain.ToString("#0.0");

                fdt.Rows.Add(dtr);
            }

            fdt.Columns["hfrom"].ColumnName     = "Da";
            fdt.Columns["hto"].ColumnName       = "A";
            fdt.Columns["temp"].ColumnName      = "Temperatura";
            fdt.Columns["umid"].ColumnName      = "Umidità";
            fdt.Columns["press"].ColumnName     = "Pressione";
            fdt.Columns["dewpoint"].ColumnName  = "Punto Rugiada";
            fdt.Columns["windmax"].ColumnName   = "Vento Max";
            fdt.Columns["wind"].ColumnName      = "Vento";
            fdt.Columns["windangle"].ColumnName = "Angolo Vento";
            fdt.Columns["heat"].ColumnName      = "Calore";
            fdt.Columns["thom"].ColumnName      = "Thom";
            fdt.Columns["windchill"].ColumnName = "Windchill";
            fdt.Columns["uv"].ColumnName        = "UV";
            fdt.Columns["rad"].ColumnName       = "Rad";
            fdt.Columns["ev"].ColumnName        = "EV";
            fdt.Columns["rain"].ColumnName      = "Pioggia";
            return(fdt);
        }