|
bool | savefig = True |
|
str | dir_out = "./fig/" |
|
bool | by_target_pos = True |
|
float | lon0 = 140.1115746 |
|
float | lat0 = 36.0827355 |
|
bool | by_target_name = not by_target_pos |
|
str | tname = "東京" |
|
int | year = 2007 |
|
int | month = 7 |
|
int | day = 15 |
|
str | datatype0 = "hourly" |
|
str | url = 'https://www.data.jma.go.jp/obd/stats/etrn/select/prefecture00.php?prec_no=&block_no=&year=&month=&day=&view=' |
|
| html = urllib.request.urlopen(url) |
|
| soup = BeautifulSoup(html, 'html.parser') |
|
| elements = soup.find_all('area') |
|
list | area_list = [element['alt'] for element in elements] |
|
list | area_link_list = [element['href'] for element in elements] |
|
list | total_station_list = [] |
|
list | total_station_link_list = [] |
|
list | total_station_etc_list = [] |
|
int | ind = 0 |
|
list | station_etc_list = [] |
|
list | station_list = [] |
|
list | station_link_list = [] |
|
list | total_station_list_flatten = [tmp1 for tmp2 in total_station_list for tmp1 in tmp2] |
|
list | total_station_link_list_flatten = [tmp1 for tmp2 in total_station_link_list for tmp1 in tmp2] |
|
list | total_station_etc_list_flatten = [tmp1 for tmp2 in total_station_etc_list for tmp1 in tmp2] |
|
list | total_station_type_list_flatten = [etc.split("javascript:viewPoint(")[1].split(",")[0][1] for etc in total_station_etc_list_flatten] |
|
list | total_station_lat_list_flatten = [float(etc.split("javascript:viewPoint(")[1].split(",")[4][1:-1]) + float(etc.split("javascript:viewPoint(")[1].split(",")[5][1:-1])/60 for etc in total_station_etc_list_flatten] |
|
list | total_station_lon_list_flatten = [float(etc.split("javascript:viewPoint(")[1].split(",")[6][1:-1]) + float(etc.split("javascript:viewPoint(")[1].split(",")[7][1:-1])/60 for etc in total_station_etc_list_flatten] |
|
| stype = np.array(total_station_type_list_flatten) |
|
| lat = np.array(total_station_lat_list_flatten) |
|
| lon = np.array(total_station_lon_list_flatten) |
|
| dist = ll2dist(lat0,lon0,lat,lon) |
|
| argmin_dist = np.argmin(dist) |
|
| station_index = argmin_dist |
|
list | station = total_station_list_flatten[station_index] |
|
list | station_link = total_station_link_list_flatten[station_index] |
|
| stype0 = stype[station_index] |
|
| lon_target = lon[station_index] |
|
| lat_target = lat[station_index] |
|
list | block_no_str = station_link.split("block_no=")[1].split("&")[0] |
|
str | datatype = datatype0 + f"_{stype0}1.php?" |
|
| fig |
|
| ax = axes[1] |
|
| figsize |
|
| s |
|
| table = pd.read_html(url) |
|
| df = table[0] |
|
| time = df["時"].values[:,0] |
|
list | jstdatetimelist = [datetime.datetime(year,month,day) + datetime.timedelta(hours=tmp) for tmp in time] |
|
list | utcdatetimelist = [tmp-datetime.timedelta(hours=9) for tmp in jstdatetimelist] |
|
list | time_target = jstdatetimelist[0].strftime("%Y-%m-%d ") |
|
str | varname_j = "降水量 (mm)" |
|
str | varname = "PREC" |
|
str | varunit = "(mm)" |
|
| prec = df[varname_j].values[:,0] |
|
| axes |
|
| marker |
|
str | fnamelabel = f"Amedas_{varname}_{time_target}_lon{lon_target}_lat{lat_target}_{station}" |
|
アメダスデータ取得・描画
指定した水平地点の近くのアメダスデータを取得し時系列を描画
- Author
- Tomoro Yanase, Team SCALE
- Note
- Reference
-