Exemplo n.º 1
0
 /// <summary>特定年のデータテーブルを取得する</summary>
 /// <param name="year">年</param>
 /// <returns>特定年のデータテーブル</returns>
 public WeatherDataTable GetAnnualDataTable(int year)
 {
     WeatherDataTable wdTable = new WeatherDataTable();
     foreach (WeatherRecord wr in wdList)
     {
         if (wr.DataDTime.Year == year) wdTable.AddWeatherRecord(wr);
     }
     return wdTable;
 }
Exemplo n.º 2
0
        private static void makeHourlyWeatherData(string csvFilePath, WeatherDataTable wdt)
        {
            using (StreamWriter sWriter = new StreamWriter(csvFilePath, false, Encoding.GetEncoding("Shift_JIS")))
            {
                //タイトル行
                LocationInformation linfo = wdt.Location;
                sWriter.WriteLine("地点," + linfo.Name + ",緯度," + linfo.Latitude + ",経度," + linfo.Longitude + ",海抜," + linfo.Elevation);
                sWriter.WriteLine("日時,乾球温度[C],絶対湿度[kg/kg(DA)],法線面直達日射量[W/m2],水平面天空日射量[W/m2],夜間放射量[W/m2],雲量(10分比),風向(degree),風速[m/s],大気圧[atm]");

                //1時間間隔のデータに変更
                WeatherDataTable houlyWDTable = wdt.ConvertToHoulyDataTable();
                ImmutableWeatherRecord wrs;
                for (int i = 0; i < houlyWDTable.WeatherRecordNumber; i++)
                {
                    wrs = houlyWDTable.GetWeatherRecord(i);
                    //夜間放射量[W/m2]を推定する
                    double wvp = MoistAir.GetWaterVaporPressure(wrs.GetData(WeatherRecord.RecordType.HumidityRatio).Value, wrs.GetData(WeatherRecord.RecordType.AtmosphericPressure).Value);
                    double nrd = Sky.GetNocturnalRadiation(wrs.GetData(WeatherRecord.RecordType.DryBulbTemperature).Value, wrs.GetData(WeatherRecord.RecordType.TotalSkyCover).Value * 10, wvp);

                    sWriter.WriteLine(wrs.DataDTime.ToString() + ","
                        + wrs.GetData(WeatherRecord.RecordType.DryBulbTemperature).Value.ToString("F1") + ","
                        + wrs.GetData(WeatherRecord.RecordType.HumidityRatio).Value.ToString("F5") + ","
                        + wrs.GetData(WeatherRecord.RecordType.DirectNormalRadiation).Value.ToString("F1") + ","
                        + wrs.GetData(WeatherRecord.RecordType.DiffuseHorizontalRadiation).Value.ToString("F1") + ","
                        + nrd.ToString("F1") + ","
                        + (wrs.GetData(WeatherRecord.RecordType.TotalSkyCover).Value * 10).ToString("F0") + ","
                        + wrs.GetData(WeatherRecord.RecordType.WindDirection).Value.ToString("F0") + ","
                        + wrs.GetData(WeatherRecord.RecordType.WindSpeed).Value.ToString("F1") + ","
                        + wrs.GetData(WeatherRecord.RecordType.AtmosphericPressure).Value.ToString("F2"));
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>1時間間隔のデータテーブルに変換する</summary>
        /// <returns>1時間間隔のデータテーブル</returns>
        /// <remarks>不足するデータは線形補間する</remarks>
        public WeatherDataTable ConvertToHoulyDataTable()
        {
            List<WeatherRecord> wdl = new List<WeatherRecord>();
            WeatherRecord wr1 = wdList[0];
            DateTime cDTime = new DateTime(wr1.DataDTime.Year, wr1.DataDTime.Month, wr1.DataDTime.Day,
                wr1.DataDTime.Hour, wr1.DataDTime.Minute, wr1.DataDTime.Second);
            for (int i = 1; i < wdList.Count; i++)
            {
                WeatherRecord wr2 = wdList[i];
                while (cDTime <= wr2.DataDTime)
                {
                    //補間および追加処理
                    wdl.Add(interpolateWRecord(wr1, wr2, cDTime));
                    cDTime = cDTime.AddHours(1);
                }
                wr1 = wr2;
            }

            WeatherDataTable wdTable = new WeatherDataTable(wdl.ToArray());
            wdTable.Location = (LocationInformation)this.location.Clone();
            return wdTable;
        }