Did typhoons occur so often when you were a kid? Did a typhoon come to Japan around October? There was a vague question. I wanted to be able to solve this question using the data on typhoons released by the Japan Meteorological Agency, so I tried various things.
Obtained from a data catalog site operated by the government.
Weather forecast_Weather forecast / Typhoon data Use "Typhoon Position Table CSV Data" on this page.
In this article, I used the CSV data from 2001 to 2019 posted in the link.
The header of the CSV data was Japanese, so I changed it to English. Quite suitable
year,month,day,hour(UTC),typhoon_no,typhoon_name,rank,latitude,longitude,central_pressure,max_wind_speed,50KT_LDD,50KT_LD,50KT_MA,30KT_LDD,30KT_LD,30KT_MA,landing
I haven't really devised it
import folium
import pandas as pd
pd.options.display.precision = 3
# Year of start and end
start_year = 2001
end_year = 2019
# Process on a yearly basis
for year in range(start_year, end_year+1):
print('# ' + str(year) + ' year start')
#Reading data
df = pd.read_csv('./typhoon/table' + str(year) + '.csv',encoding="SHIFT-JIS")
typhoon_names = list(df['typhoon_name'])
latitude = list(df["latitude"])
longitude = list(df["longitude"])
landing = list(df["landing"])
map = folium.Map(location=[35.6611098,139.6953576], zoom_start=3)
target_typhoon = typhoon_names[0]
target_location = []
color = 'blue'
typhoon_count = 0
#Process CSV data line by line
for lt, lo, name, land in zip(latitude, longitude, typhoon_names, landing):
# If the name of the typhoon changes, write the information of the typhoon being processed on the map
if name != target_typhoon:
map.add_child(folium.PolyLine(locations=target_location, color=color))
target_location = [[float(lt), float(lo)]]
target_typhoon = name
typhoon_count += 1
else:
target_location.append([float(lt), float(lo)])
map.add_child(folium.PolyLine(locations=target_location, color=color))
map.save('./output/' + str(year) + '_typhoon_location.html')
print('# Number of typhoon : ' + str(typhoon_count))
print('# ' + str(year) + ' year end')
The output result is output under the "output" folder every year. When you open the output HTML, it looks like this. I made a GIF that displays the output image from 2001 to 2019.
After all, I want to make the typhoon that landed in Japan stand out. There was an item called "landing" in the final item of the data. It is 1 if it has landed, and 0 if it has not. This data is used for color coding.
It should be noted that this "landing" is not "in Japan". Therefore, it was necessary to judge whether it was Japan or not.
import folium
import pandas as pd
pd.options.display.precision = 3
# Year of start and end
start_year = 2001
end_year = 2019
# Coordinates of the north, south, east and west edges of Japan
east_end = 153.5911
west_end = 122.5601
north_end = 45.3326
south_end = 20.2531
def is_japan_randing(lt, lo, randing):
if south_end <= lt and lt <= north_end and west_end <= lo and lo <= east_end and randing == 1:
return True
else:
return False
# Process on a yearly basis
for year in range(start_year, end_year+1):
print('# ' + str(year) + ' year start')
#Reading data
df = pd.read_csv('./typhoon/table' + str(year) + '.csv',encoding="SHIFT-JIS")
typhoon_names = list(df['typhoon_name'])
latitude = list(df["latitude"])
longitude = list(df["longitude"])
landing = list(df["landing"])
map = folium.Map(location=[35.6611098,139.6953576], zoom_start=3)
target_typhoon = typhoon_names[0]
target_location = []
typhoon_count = 0
color = 'blue'
#Process CSV data line by line
for lt, lo, name, land in zip(latitude, longitude, typhoon_names, landing):
# If the name of the typhoon changes, write the information of the typhoon being processed on the map
if name != target_typhoon:
map.add_child(folium.PolyLine(locations=target_location, color=color))
target_location = [[float(lt), float(lo)]]
target_typhoon = name
typhoon_count += 1
color = 'blue'
else:
target_location.append([float(lt), float(lo)])
if is_japan_randing(lt, lo, land):
color = 'red'
map.add_child(folium.PolyLine(locations=target_location, color=color))
map.save('./output/' + str(year) + '_typhoon_location.html')
print('# Number of typhoon : ' + str(typhoon_count))
print('# ' + str(year) + ' year end')
Judgment in Japan is made in "is_japan_randing". I think it's very rough, but is the latitude in the northernmost and southernmost range of Japan? Is longitude the westernmost and easternmost range? Is judged.
Only the line landing in Japan turned red. There are lines that are quite close to Kyushu and Honshu. Below is a quote from Weather.com.
Typhoon landing means that the center of the typhoon reaches the coasts of Hokkaido, Honshu, Kyushu, and Shikoku. (Okinawa is not called a landing of a typhoon, but a passing.) An approaching typhoon means entering within a radius of 300 km.
Thinking this way, you can see again that this line is the coordinates of the center.
Did such a typhoon land in Japan in recent years? I tried this from the question, but it seems that the number of landings has not changed much since 2001. Next, I would like to visualize the scale of the typhoon.
Recommended Posts