今天研究了下中央气象台24小时降水量(4-7天)的天气预报,已经发现规律并写出Winform代码。
如图:
代码如下:
string timenow = System.DateTime.Now.ToLongDateString();
int 九十六Hour = 20009600;
int 一百二十Hour = 20012000;
int 一百四十四Hour = 20014400;
int 一百六十八Hour = 20016800;
private void radioButton96_Click(object sender, EventArgs e)
{
//96小时
DateTime dt = Convert.ToDateTime(timenow);
string url = "http://image.weather.gov.cn/product/" + dt.Year.ToString() + "/" + dt.Year.ToString()
+ dt.Month.ToString().PadLeft(2, '0')
+ "/" + dt.Year.ToString() + dt.Month.ToString().PadLeft(2, '0') + dt.Day.ToString().PadLeft(2, '0')
+ "/STFC/medium/SEVP_NMC_STFC_SFER_ER24_ACHN_L88_P9_";
url = url + dt.Year.ToString() + dt.Month.ToString().PadLeft(2, '0') + dt.Day.ToString().PadLeft(2, '0') + 00 + 九十六Hour + ".JPG";
pictureBoxyuntu.LoadAsync(url);
}
private void radioButton144_Click(object sender, EventArgs e)
{
//144小时
DateTime dt = Convert.ToDateTime(timenow);
string url = "http://image.weather.gov.cn/product/" + dt.Year.ToString() + "/" + dt.Year.ToString()
+ dt.Month.ToString().PadLeft(2, '0')
+ "/" + dt.Year.ToString() + dt.Month.ToString().PadLeft(2, '0') + dt.Day.ToString().PadLeft(2, '0')
+ "/STFC/medium/SEVP_NMC_STFC_SFER_ER24_ACHN_L88_P9_";
url = url + dt.Year.ToString() + dt.Month.ToString().PadLeft(2, '0') + dt.Day.ToString().PadLeft(2, '0') + 00 + 一百四十四Hour + ".JPG";
pictureBoxyuntu.LoadAsync(url);
}
private void radioButton168_Click(object sender, EventArgs e)
{
//168小时
DateTime dt = Convert.ToDateTime(timenow);
string url = "http://image.weather.gov.cn/product/" + dt.Year.ToString() + "/" + dt.Year.ToString()
+ dt.Month.ToString().PadLeft(2, '0')
+ "/" + dt.Year.ToString() + dt.Month.ToString().PadLeft(2, '0') + dt.Day.ToString().PadLeft(2, '0')
+ "/STFC/medium/SEVP_NMC_STFC_SFER_ER24_ACHN_L88_P9_";
url = url + dt.Year.ToString() + dt.Month.ToString().PadLeft(2, '0') + dt.Day.ToString().PadLeft(2, '0') + 00 + 一百六十八Hour + ".JPG";
pictureBoxyuntu.LoadAsync(url);
}
private void radioButton120_Click(object sender, EventArgs e)
{
//120小时
DateTime dt = Convert.ToDateTime(timenow);
string url = "http://image.weather.gov.cn/product/" + dt.Year.ToString() + "/" + dt.Year.ToString()
+ dt.Month.ToString().PadLeft(2, '0')
+ "/" + dt.Year.ToString() + dt.Month.ToString().PadLeft(2, '0') + dt.Day.ToString().PadLeft(2, '0')
+ "/STFC/medium/SEVP_NMC_STFC_SFER_ER24_ACHN_L88_P9_";
url = url + dt.Year.ToString() + dt.Month.ToString().PadLeft(2, '0') + dt.Day.ToString().PadLeft(2, '0') + 00 + 一百二十Hour + ".JPG";
pictureBoxyuntu.LoadAsync(url);
}