Package: jma-feed
jma-feedPython client library forJMA feed.This project was generated withcookiecutterusingjacebrowning/template-python.SetupRequirementsPython 3.6+InstallationInstall jma-feed with pip:$pipinstalljma-feedor directly from the source code:$gitclonehttps://github.com/tearoom6/jma-feed.git
$cdjma-feed
$pythonsetup.pyinstallUsageAfter installation, the package can imported:importjma_feedjma_feed.__version__Report can be retrieved from Atom feeds:all_reports=jma_feed.fetch_all_reports(long_term=False)all_meteorology_reports=jma_feed.fetch_all_meteorology_reports(long_term=False)all_seismology_reports=jma_feed.fetch_all_seismology_reports(long_term=False)all_volcanology_reports=jma_feed.fetch_all_volcanology_reports(long_term=False)Report API:control=report.controlprint(control.title)print(control.date_time)print(control.status)print(control.editorial_office)print(control.publishing_office)head=report.headprint(head.title)print(head.report_date_time)print(head.target_date_time)print(head.event_id)print(head.info_type)print(head.serial)print(head.info_kind)print(head.info_kind_version)print(head.headline_text)forheadline_informationinhead.headline_information_list:print(headline_information.type)foriteminheadline_information.items:print(item.areas_code_type)forkindinitem.kinds:print(kind.name)print(kind.code)print(kind.condition)forareainitem.areas:print(area.name)print(area.code)body=report.body# Meteorologyifisinstance(body,jma_feed.ReportBodyMeteorology):target_area=body.target_areaiftarget_area:print(target_area.name)print(target_area.code)comment=body.commentifcomment:fortextincomment.texts:print(text.text)fornoticeinbody.notices:print(notice)forwarninginbody.warnings:foriteminwarning.items:print(item.change_status)print(item.full_status)print(item.editing_mark)ifitem.area:print(item.area.name)print(item.area.code)forkindinitem.kinds:print(kind.name)print(kind.code)print(kind.status)print(kind.condition)formeteorological_infoinbody.meteorological_infos:print(meteorological_info.date_time)print(meteorological_info.duration)print(meteorological_info.name)foriteminmeteorological_info.items:print(item.change_status)print(item.full_status)print(item.editing_mark)ifitem.area:print(item.area.name)print(item.area.code)forkindinitem.kinds:print(kind.name)print(kind.code)print(kind.status)print(kind.condition)fortime_series_infoinbody.time_series_infos:fortime_defineinmeteorological_info.time_defines:print(time_define.date_time)print(time_define.duration)print(time_define.name)foriteminmeteorological_info.items:print(item.change_status)print(item.full_status)print(item.editing_mark)ifitem.area:print(item.area.name)print(item.area.code)forkindinitem.kinds:print(kind.name)print(kind.code)print(kind.status)print(kind.condition)# Seismologyifisinstance(body,jma_feed.ReportBodySeismology):print(body.naming)print(body.text)print(body.next_advisory)comments=body.commentsifcommentsandcomments.warning_comment:print(comments.warning_comment.text)print(comments.warning_comment.code)print(comments.warning_comment.code_type)ifcommentsandcomments.forecast_comment:print(comments.forecast_comment.text)print(comments.forecast_comment.code)print(comments.forecast_comment.code_type)ifcommentsandcomments.observation_comment:print(comments.observation_comment.text)print(comments.observation_comment.code)print(comments.observation_comment.code_type)ifcommentsandcomments.var_comment:print(comments.var_comment.text)print(comments.var_comment.code)print(comments.var_comment.code_type)ifcommentsandcomments.free_form_comment:print(comments.free_form_comment)tsunami=body.tsunamiforearthquakeinbody.earthquakes:print(earthquake.origin_time)print(earthquake.arrival_time)print(earthquake.condition)formagnitudeinearthquake.magnitudes:print(magnitude)hypocenter=earthquake.hypocenterifhypocenter:print(hypocenter.source)ifhypocenter.area:print(hypocenter.area.name)print(hypocenter.area.code)print(hypocenter.area.coordinate)# Volcanologyifisinstance(body,jma_feed.ReportBodyVolcanology):print(body.notice)print(body.text)forvolcano_infoinbody.volcano_infos:foriteminvolcano_info.items:ifitem.kind:print(item.kind.name)print(item.kind.formal_name)print(item.kind.code)print(item.kind.condition)forareainitem.areas:print(area.name)print(area.code)print(area.coordinate)forash_infoinbody.ash_infos:print(ash_info.start_time)print(ash_info.end_time)foriteminash_info.items:ifitem.kind:print(item.kind.name)print(item.kind.formal_name)print(item.kind.code)print(item.kind.condition)forareainitem.areas:print(area.name)print(area.code)print(area.coordinate)Feed API (Low-level API):# High-frequency feed# Regular (定時: 気象に関する情報のうち、天気概況など定時に発表されるもの)feed_url=jma_feed.FEED_URL_REGULAR_SHORT_TERM# Extra (随時: 気象に関する情報のうち、警報・注意報など随時発表されるもの)feed_url=jma_feed.FEED_URL_EXTRA_SHORT_TERM# Earthquake/Volcano (地震火山: 地震、火山に関する情報)feed_url=jma_feed.FEED_URL_EQVOL_SHORT_TERM# Others (その他: 上記３種類のいずれにも属さないもの)feed_url=jma_feed.FEED_URL_OTHER_SHORT_TERM# Long-term feed# Regular (定時: 気象に関する情報のうち、天気概況など定時に発表されるもの)feed_url=jma_feed.FEED_URL_REGULAR_LONG_TERM# Extra (随時: 気象に関する情報のうち、警報・注意報など随時発表されるもの)feed_url=jma_feed.FEED_URL_EXTRA_LONG_TERM# Earthquake/Volcano (地震火山: 地震、火山に関する情報)feed_url=jma_feed.FEED_URL_EQVOL_LONG_TERM# Others (その他: 上記３種類のいずれにも属さないもの)feed_url=jma_feed.FEED_URL_OTHER_LONG_TERMfeed=jma_feed.AtomFeed(feed_url)print(feed.id)print(feed.title)print(feed.subtitle)print(feed.updated)print(feed.rights)entries=feed.entriesforentryinentries:print(entry.id)print(entry.title)print(entry.updated)print(entry.author)print(entry.content)print(entry.link)