jma_code 0.0.3 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/20240216-completed_AreaInformationCity-AreaForecastLocalM/AreaInformationCity.csv +2083 -0
- data/data/20240618-completed_Volcano-Earthquake/AreaForecastLocalE.csv +189 -0
- data/data/20240618-completed_Volcano-Earthquake/PointSeismicIntensity.csv +4565 -0
- data/lib/jma_code/area_forecast_local_e.rb +100 -0
- data/lib/jma_code/{area_forecast_local.rb → area_forecast_local_m.rb} +87 -8
- data/lib/jma_code/area_information_city.rb +79 -26
- data/lib/jma_code/point_seismic_intensity.rb +82 -0
- data/lib/jma_code/prefecture.rb +1 -1
- data/lib/jma_code/version.rb +1 -1
- data/lib/jma_code.rb +3 -1
- metadata +29 -24
- /data/data/{Volcano_Earthquake/20240618_AdditionalCommentEarthquake.csv → 20240618_Volcano-Earthquake/AdditionalCommentEarthquake.csv} +0 -0
- /data/data/{Volcano_Earthquake/20240618_AreaEpicenter.csv → 20240618_Volcano-Earthquake/AreaEpicenter.csv} +0 -0
- /data/data/{Volcano_Earthquake/20240618_AreaEpicenterAbbreviation.csv → 20240618_Volcano-Earthquake/AreaEpicenterAbbreviation.csv} +0 -0
- /data/data/{Volcano_Earthquake/20240618_AreaEpicenterDetail.csv → 20240618_Volcano-Earthquake/AreaEpicenterDetail.csv} +0 -0
- /data/data/{Volcano_Earthquake/20240618_AreaEpicenterSuppliment.csv → 20240618_Volcano-Earthquake/AreaEpicenterSuppliment.csv} +0 -0
- /data/data/{Volcano_Earthquake/20240618_AreaForecastEEW.csv → 20240618_Volcano-Earthquake/AreaForecastEEW.csv} +0 -0
- /data/data/{Volcano_Earthquake/20240618_AreaForecastLocalE_AreaInformationCity_PointRealtimeIntensity.csv → 20240618_Volcano-Earthquake/AreaForecastLocalE-AreaInformationCity-PointRealtimeIntensity.csv} +0 -0
- /data/data/{Volcano_Earthquake/20240618_AreaForecastLocalE_ AreaInformationCity_ PointSeismicIntensity.csv → 20240618_Volcano-Earthquake/AreaForecastLocalE-AreaInformationCity-PointSeismicIntensity.csv} +0 -0
- /data/data/{Volcano_Earthquake/20240618_AreaForecastLocalE_PointSeismicLgIntensity.csv → 20240618_Volcano-Earthquake/AreaForecastLocalE-PointSeismicLgIntensity.csv} +0 -0
- /data/data/{Volcano_Earthquake/20240618_AreaForecastLocalEEW.csv → 20240618_Volcano-Earthquake/AreaForecastLocalEEW.csv} +0 -0
- /data/data/{Volcano_Earthquake/20240618_AreaInformationPrefectureEarthquake.csv → 20240618_Volcano-Earthquake/AreaInformationPrefectureEarthquake.csv} +0 -0
- /data/data/{Volcano_Earthquake/20240618_AreaTsunami.csv → 20240618_Volcano-Earthquake/AreaTsunami.csv} +0 -0
- /data/data/{Volcano_Earthquake/20240618_CoastTsunami.csv → 20240618_Volcano-Earthquake/CoastTsunami.csv} +0 -0
- /data/data/{Volcano_Earthquake/20240618_EarthquakeForecast.csv → 20240618_Volcano-Earthquake/EarthquakeForecast.csv} +0 -0
- /data/data/{Volcano_Earthquake/20240618_EarthquakeInformation.csv → 20240618_Volcano-Earthquake/EarthquakeInformation.csv} +0 -0
- /data/data/{Volcano_Earthquake/20240618_EarthquakeWarning.csv → 20240618_Volcano-Earthquake/EarthquakeWarning.csv} +0 -0
- /data/data/{Volcano_Earthquake/20240618_PointTsunami.csv → 20240618_Volcano-Earthquake/PointTsunami.csv} +0 -0
- /data/data/{Volcano_Earthquake/20240618_PointVolcano.csv → 20240618_Volcano-Earthquake/PointVolcano.csv} +0 -0
- /data/data/{Volcano_Earthquake/20240618_TokaiInformation.csv → 20240618_Volcano-Earthquake/TokaiInformation.csv} +0 -0
- /data/data/{Volcano_Earthquake/20240618_TsunamiWarning.csv → 20240618_Volcano-Earthquake/TsunamiWarning.csv} +0 -0
- /data/data/{Volcano_Earthquake/20240618_VolcanicWarning.csv → 20240618_Volcano-Earthquake/VolcanicWarning.csv} +0 -0
@@ -0,0 +1,100 @@
|
|
1
|
+
module JMACode
|
2
|
+
using Blank
|
3
|
+
|
4
|
+
class AreaForecastLocalE < Struct.new(
|
5
|
+
:code, :name, :name_phonetic, :prefecture_code,
|
6
|
+
keyword_init: true
|
7
|
+
)
|
8
|
+
CSV_ROW_SEP = "\r\n"
|
9
|
+
NUM_HEADER_ROWS = 1
|
10
|
+
HEADERS = %i(
|
11
|
+
code
|
12
|
+
name
|
13
|
+
name_phonetic
|
14
|
+
prefecture_code
|
15
|
+
)
|
16
|
+
|
17
|
+
class << self
|
18
|
+
attr_accessor :data
|
19
|
+
|
20
|
+
def load_csv(version: "20240618-completed")
|
21
|
+
path = File.join(File.dirname(__FILE__), "../../data/#{version}_Volcano-Earthquake/AreaForecastLocalE.csv")
|
22
|
+
File.open(path) do |f|
|
23
|
+
csv = CSV.new(f, headers: HEADERS, row_sep: CSV_ROW_SEP)
|
24
|
+
yield(csv)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def load(**args)
|
29
|
+
load_csv(**args) do |csv|
|
30
|
+
csv.drop(NUM_HEADER_ROWS).map do |row|
|
31
|
+
build_by_csv_row(row)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def get
|
37
|
+
@data ||= load
|
38
|
+
end
|
39
|
+
|
40
|
+
def build_by_csv_row(row)
|
41
|
+
new(
|
42
|
+
code: row[:code],
|
43
|
+
name: row[:name],
|
44
|
+
name_phonetic: row[:name_phonetic],
|
45
|
+
prefecture_code: row[:prefecture_code],
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
def build_tree(areas=nil, cities=nil)
|
50
|
+
areas ||= get
|
51
|
+
cities ||= JMACode::AreaInformationCity.get
|
52
|
+
|
53
|
+
areas.group_by(&:prefecture).map{|pref, pref_areas|
|
54
|
+
[
|
55
|
+
block_given? ? yield(pref) : pref,
|
56
|
+
pref_areas.map{|a|
|
57
|
+
[
|
58
|
+
block_given? ? yield(a) : a,
|
59
|
+
a.area_information_cities.map{|c|
|
60
|
+
[
|
61
|
+
block_given? ? yield(c) : c,
|
62
|
+
nil
|
63
|
+
]
|
64
|
+
}
|
65
|
+
]
|
66
|
+
}
|
67
|
+
]
|
68
|
+
}
|
69
|
+
end
|
70
|
+
|
71
|
+
def walk_tree(tree, &block)
|
72
|
+
tree.map do |area, children|
|
73
|
+
a = block.call(area)
|
74
|
+
c = if children.is_a?(Array) and children.present?
|
75
|
+
walk_tree(children, &block)
|
76
|
+
else
|
77
|
+
children
|
78
|
+
end
|
79
|
+
[a, c]
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def prefecture
|
85
|
+
@prefecture ||= Prefecture.get.find{|pref| pref.code == prefecture_code}
|
86
|
+
end
|
87
|
+
|
88
|
+
def area_information_cities
|
89
|
+
@area_information_cities ||= AreaInformationCity.get.select{|x| x.area_forecast_local_e_code == code}
|
90
|
+
end
|
91
|
+
|
92
|
+
def to_csv_row
|
93
|
+
HEADERS.map do |k|
|
94
|
+
respond_to?(k) ?
|
95
|
+
public_send(k) :
|
96
|
+
nil
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
module JMACode
|
3
3
|
using Blank
|
4
4
|
|
5
|
-
class
|
5
|
+
class AreaForecastLocalM < Struct.new(
|
6
6
|
:code, :name, :name_phonetic,
|
7
7
|
:belonging_local_code_in_weather_alert,
|
8
8
|
:belonging_local_code_in_tornado_alert,
|
@@ -92,35 +92,114 @@ module JMACode
|
|
92
92
|
used_by: used_by_fields.select{|f| row[f] == '1'}.map{|f| f.to_s.sub(/\Aused_by_/, '').to_sym}
|
93
93
|
)
|
94
94
|
end
|
95
|
+
|
96
|
+
def build_tree(areas=nil, cities=nil)
|
97
|
+
areas ||= get
|
98
|
+
cities ||= JMACode::AreaInformationCity.get
|
99
|
+
|
100
|
+
toplevels, areas = areas.partition{|a| a.any_belonging_locals.blank?}
|
101
|
+
pref_areas = areas.group_by(&:prefecture_code)
|
102
|
+
pref_cities = cities.group_by(&:prefecture_code)
|
103
|
+
toplevels.group_by(&:prefecture).map{|pref, pref_toplevels|
|
104
|
+
current_areas = pref_areas[pref.code]
|
105
|
+
current_cities = pref_cities[pref.code]
|
106
|
+
|
107
|
+
[
|
108
|
+
block_given? ? yield(pref) : pref,
|
109
|
+
pref_toplevels.map{|t|
|
110
|
+
secondlevels = (current_areas+current_cities).select{|a| a.child_of?(t)}
|
111
|
+
secondlevels_children = secondlevels.map{|s|
|
112
|
+
thirdlevels = (current_areas+current_cities).select{|a| a.child_of?(s)}
|
113
|
+
thirdlevels_children = thirdlevels.map{|th|
|
114
|
+
forthlevels = current_cities.select{|c| c.child_of?(th)}
|
115
|
+
[
|
116
|
+
block_given? ? yield(th) : th,
|
117
|
+
forthlevels.map{|f|
|
118
|
+
[block_given? ? yield(f) : f, nil]
|
119
|
+
}
|
120
|
+
]
|
121
|
+
}
|
122
|
+
[
|
123
|
+
block_given? ? yield(s) : s,
|
124
|
+
thirdlevels_children
|
125
|
+
]
|
126
|
+
}
|
127
|
+
[
|
128
|
+
block_given? ? yield(t) : t,
|
129
|
+
secondlevels_children
|
130
|
+
]
|
131
|
+
}
|
132
|
+
]
|
133
|
+
|
134
|
+
}
|
135
|
+
end
|
136
|
+
|
137
|
+
def walk_tree(tree, &block)
|
138
|
+
tree.map do |area, children|
|
139
|
+
a = block.call(area)
|
140
|
+
c = if children.is_a?(Array) and children.present?
|
141
|
+
walk_tree(children, &block)
|
142
|
+
else
|
143
|
+
children
|
144
|
+
end
|
145
|
+
[a, c]
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
def prefecture_code
|
151
|
+
@prefecture_code ||= code[0, 2]
|
152
|
+
end
|
153
|
+
|
154
|
+
def prefecture
|
155
|
+
@prefecture ||= Prefecture.get.find{|pref| pref.code == prefecture_code}
|
95
156
|
end
|
96
157
|
|
97
158
|
def area_information_cities
|
98
|
-
@area_information_cities ||= AreaInformationCity.get.select{|x| x.
|
159
|
+
@area_information_cities ||= AreaInformationCity.get.select{|x| x.area_forecast_local_m_code == code}
|
99
160
|
end
|
100
161
|
|
101
162
|
def belonging_local_in_weather_alert
|
102
163
|
return nil if belonging_local_code_in_weather_alert.blank?
|
103
164
|
@belonging_local_in_weather_alert ||= begin
|
104
|
-
|
165
|
+
AreaForecastLocalM.get.find{|a| a.code == belonging_local_code_in_weather_alert}
|
105
166
|
end
|
106
167
|
end
|
107
168
|
|
108
169
|
def belonging_local_in_tornado_alert
|
109
170
|
return nil if belonging_local_code_in_tornado_alert.blank?
|
110
171
|
@belonging_local_in_tornado_alert ||= begin
|
111
|
-
|
172
|
+
AreaForecastLocalM.get.find{|a| a.code == belonging_local_code_in_tornado_alert}
|
112
173
|
end
|
113
174
|
end
|
114
175
|
|
115
176
|
def any_belonging_locals
|
116
|
-
[belonging_local_in_weather_alert, belonging_local_in_tornado_alert].compact.uniq(&:code)
|
177
|
+
@any_belonging_locals ||= [belonging_local_in_weather_alert, belonging_local_in_tornado_alert].compact.uniq(&:code)
|
178
|
+
end
|
179
|
+
|
180
|
+
def any_ancestry_locals
|
181
|
+
@any_ancestry_locals ||= [
|
182
|
+
belonging_local_in_weather_alert,
|
183
|
+
belonging_local_in_tornado_alert,
|
184
|
+
belonging_local_in_weather_alert&.belonging_local_in_weather_alert,
|
185
|
+
belonging_local_in_tornado_alert&.belonging_local_in_tornado_alert,
|
186
|
+
].compact.uniq(&:code)
|
187
|
+
end
|
188
|
+
|
189
|
+
def child_of?(area_or_city)
|
190
|
+
any_belonging_locals.map(&:code).include?(area_or_city.code)
|
117
191
|
end
|
118
192
|
|
119
193
|
def to_csv_row
|
120
194
|
HEADERS.map do |k|
|
121
|
-
respond_to?(k)
|
122
|
-
public_send(k)
|
123
|
-
|
195
|
+
if respond_to?(k)
|
196
|
+
public_send(k)
|
197
|
+
else
|
198
|
+
if k.to_s.start_with?("used_by_")
|
199
|
+
x = k.to_s.sub('used_by_', '').to_sym
|
200
|
+
used_by.include?(x) ? '1' : nil
|
201
|
+
end
|
202
|
+
end
|
124
203
|
end
|
125
204
|
end
|
126
205
|
end
|
@@ -3,38 +3,41 @@ module JMACode
|
|
3
3
|
using Blank
|
4
4
|
|
5
5
|
class AreaInformationCity < Struct.new(
|
6
|
-
:code, :
|
7
|
-
:
|
6
|
+
:code, :long_name, :alt_name, :alt_name_phonetic,
|
7
|
+
:area_forecast_local_m_code,
|
8
|
+
:area_forecast_local_e_code,
|
9
|
+
:used_by,
|
8
10
|
keyword_init: true
|
9
11
|
)
|
10
12
|
CSV_ROW_SEP = "\r\n"
|
11
13
|
NUM_HEADER_ROWS = 3
|
12
14
|
HEADERS = %i(
|
13
15
|
code
|
14
|
-
|
16
|
+
long_name
|
15
17
|
name_used_by_weather
|
16
18
|
name_phonetic_used_by_weather
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
area_forecast_local_m_code
|
20
|
+
used_by_weather
|
21
|
+
used_by_tornado
|
22
|
+
used_by_storm_surge
|
23
|
+
used_by_high_wave
|
24
|
+
used_by_landslide
|
25
|
+
used_by_flood
|
24
26
|
name_used_by_earthquake
|
25
27
|
name_phonetic_used_by_earthquake
|
26
28
|
name_used_by_volcano
|
27
29
|
name_phonetic_used_by_volcano
|
28
30
|
name_used_by_uv
|
29
31
|
name_phonetic_used_by_uv
|
30
|
-
|
31
|
-
|
32
|
+
name_used_by_rainstorm
|
33
|
+
name_phonetic_used_by_rainstorm
|
34
|
+
area_forecast_local_e_code
|
32
35
|
)
|
33
36
|
|
34
37
|
class << self
|
35
38
|
attr_accessor :data
|
36
39
|
|
37
|
-
def load_csv(version: "20240216")
|
40
|
+
def load_csv(version: "20240216-completed")
|
38
41
|
path = File.join(File.dirname(__FILE__), "../../data/#{version}_AreaInformationCity-AreaForecastLocalM/AreaInformationCity.csv")
|
39
42
|
File.open(path) do |f|
|
40
43
|
csv = CSV.new(f, headers: HEADERS, row_sep: CSV_ROW_SEP)
|
@@ -63,36 +66,86 @@ module JMACode
|
|
63
66
|
[row[:name_used_by_volcano], row[:name_phonetic_used_by_volcano]]
|
64
67
|
elsif row[:name_used_by_uv].present?
|
65
68
|
[row[:name_used_by_uv], row[:name_phonetic_used_by_uv]]
|
66
|
-
elsif row[:
|
67
|
-
[row[:
|
69
|
+
elsif row[:name_used_by_rainstorm].present?
|
70
|
+
[row[:name_used_by_rainstorm], row[:name_phonetic_used_by_rainstorm]]
|
68
71
|
else
|
69
72
|
[]
|
70
73
|
end
|
71
74
|
|
72
75
|
new(
|
73
76
|
code: row[:code],
|
74
|
-
|
77
|
+
long_name: row[:long_name],
|
75
78
|
alt_name: alt_name,
|
76
79
|
alt_name_phonetic: alt_name_phonetic,
|
77
|
-
|
80
|
+
area_forecast_local_m_code: row[:area_forecast_local_m_code],
|
81
|
+
area_forecast_local_e_code: row[:area_forecast_local_e_code],
|
78
82
|
used_by: [
|
79
|
-
row[:
|
80
|
-
row[:
|
81
|
-
row[:
|
82
|
-
row[:
|
83
|
-
row[:
|
84
|
-
row[:
|
83
|
+
row[:used_by_weather] == '1' ? :weather : nil,
|
84
|
+
row[:used_by_tornado] == '1' ? :tornado : nil,
|
85
|
+
row[:used_by_storm_surge] == '1' ? :storm_surge : nil,
|
86
|
+
row[:used_by_high_wave] == '1' ? :high_wave : nil,
|
87
|
+
row[:used_by_landslide] == '1' ? :landslide : nil,
|
88
|
+
row[:used_by_flood] == '1' ? :flood : nil,
|
85
89
|
row[:name_used_by_earthquake].present? ? :earthquake : nil,
|
86
90
|
row[:name_used_by_volcano].present? ? :volcano : nil,
|
87
91
|
row[:name_used_by_uv].present? ? :uv : nil,
|
88
|
-
row[:
|
92
|
+
row[:name_used_by_rainstorm].present? ? :rainstorm : nil,
|
89
93
|
].compact
|
90
94
|
)
|
91
95
|
end
|
92
96
|
end
|
93
97
|
|
94
|
-
def
|
95
|
-
|
98
|
+
def name
|
99
|
+
alt_name.presence || long_name
|
100
|
+
end
|
101
|
+
|
102
|
+
def name_phonetic
|
103
|
+
alt_name_phonetic
|
104
|
+
end
|
105
|
+
|
106
|
+
def prefecture_code
|
107
|
+
@prefecture_code ||= code[0, 2]
|
108
|
+
end
|
109
|
+
|
110
|
+
def area_forecast_local_m
|
111
|
+
@area_forecast_local_m ||= AreaForecastLocalM.get.find{|x| x.code == area_forecast_local_m_code}
|
112
|
+
end
|
113
|
+
|
114
|
+
def area_forecast_local_e
|
115
|
+
@area_forecast_local_e ||= AreaForecastLocalE.get.find{|x| x.code == area_forecast_local_e_code}
|
116
|
+
end
|
117
|
+
|
118
|
+
def child_of?(area_or_city)
|
119
|
+
area_forecast_local_m_code == area_or_city.code
|
120
|
+
end
|
121
|
+
|
122
|
+
def to_csv_row
|
123
|
+
HEADERS.map do |k|
|
124
|
+
if respond_to?(k)
|
125
|
+
public_send(k)
|
126
|
+
else
|
127
|
+
if k.to_s.start_with?("used_by_")
|
128
|
+
x = k.to_s.sub('used_by_', '').to_sym
|
129
|
+
used_by.include?(x) ? '1' : nil
|
130
|
+
elsif k.to_s.start_with?("name_used_by_")
|
131
|
+
x = k.to_s.sub('name_used_by_', '').to_sym
|
132
|
+
used_by.include?(x) ? alt_name : nil
|
133
|
+
elsif k.to_s.start_with?("name_phonetic_used_by_")
|
134
|
+
x = k.to_s.sub('name_phonetic_used_by_', '').to_sym
|
135
|
+
used_by.include?(x) ? alt_name_phonetic : nil
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
def to_h
|
142
|
+
{
|
143
|
+
code: code,
|
144
|
+
name: name,
|
145
|
+
name_phonetic: name_phonetic,
|
146
|
+
area_forecast_local_m_code: area_forecast_local_m_code,
|
147
|
+
used_by: used_by,
|
148
|
+
}
|
96
149
|
end
|
97
150
|
end
|
98
151
|
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
module JMACode
|
2
|
+
using Blank
|
3
|
+
|
4
|
+
class PointSeismicIntensity < Struct.new(
|
5
|
+
:code, :name, :name_phonetic,
|
6
|
+
:area_information_city_code,
|
7
|
+
:used_by,
|
8
|
+
keyword_init: true
|
9
|
+
)
|
10
|
+
CSV_ROW_SEP = "\r\n"
|
11
|
+
NUM_HEADER_ROWS = 1
|
12
|
+
HEADERS = %i(
|
13
|
+
code
|
14
|
+
name
|
15
|
+
name_phonetic
|
16
|
+
area_information_city_code
|
17
|
+
used_by_regular_seismic_intensity
|
18
|
+
used_by_realtime_seismic_intensity
|
19
|
+
used_by_long_seismic_intensity
|
20
|
+
)
|
21
|
+
|
22
|
+
class << self
|
23
|
+
attr_accessor :data
|
24
|
+
|
25
|
+
def load_csv(version: "20240618-completed")
|
26
|
+
path = File.join(File.dirname(__FILE__), "../../data/#{version}_Volcano-Earthquake/PointSeismicIntensity.csv")
|
27
|
+
File.open(path) do |f|
|
28
|
+
csv = CSV.new(f, headers: HEADERS, row_sep: CSV_ROW_SEP)
|
29
|
+
yield(csv)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def load(**args)
|
34
|
+
load_csv(**args) do |csv|
|
35
|
+
csv.drop(NUM_HEADER_ROWS).map do |row|
|
36
|
+
build_by_csv_row(row)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def get
|
42
|
+
@data ||= load
|
43
|
+
end
|
44
|
+
|
45
|
+
def build_by_csv_row(row)
|
46
|
+
used_by_fields = HEADERS.select{|n| n.to_s.start_with?('used_by_')}
|
47
|
+
new(
|
48
|
+
code: row[:code],
|
49
|
+
name: row[:name],
|
50
|
+
name_phonetic: row[:name_phonetic],
|
51
|
+
area_information_city_code: row[:area_information_city_code],
|
52
|
+
used_by: used_by_fields.select{|f| row[f] == '1'}.map{|f| f.to_s.sub(/\Aused_by_/, '').to_sym}
|
53
|
+
)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# def prefecture_code
|
58
|
+
# @prefecture_code ||= code[0, 2]
|
59
|
+
# end
|
60
|
+
|
61
|
+
# def prefecture
|
62
|
+
# @prefecture ||= Prefecture.get.find{|pref| pref.code == prefecture_code}
|
63
|
+
# end
|
64
|
+
|
65
|
+
def area_information_city
|
66
|
+
@area_information_city ||= AreaInformationCity.get.find{|x| x.code == area_information_city_code}
|
67
|
+
end
|
68
|
+
|
69
|
+
def to_csv_row
|
70
|
+
HEADERS.map do |k|
|
71
|
+
if respond_to?(k)
|
72
|
+
public_send(k)
|
73
|
+
else
|
74
|
+
if k.to_s.start_with?("used_by_")
|
75
|
+
x = k.to_s.sub('used_by_', '').to_sym
|
76
|
+
used_by.include?(x) ? '1' : nil
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
data/lib/jma_code/prefecture.rb
CHANGED
@@ -24,7 +24,7 @@ module JMACode
|
|
24
24
|
[18, '福井県', '福井', 'fukui'],
|
25
25
|
[19, '山梨県', '山梨', 'yamanashi'],
|
26
26
|
[20, '長野県', '長野', 'nagano'],
|
27
|
-
[
|
27
|
+
[21, '岐阜県', '岐阜', 'gifu'],
|
28
28
|
[22, '静岡県', '静岡', 'shizuoka'],
|
29
29
|
[23, '愛知県', '愛知', 'aichi'],
|
30
30
|
[24, '三重県', '三重', 'mie'],
|
data/lib/jma_code/version.rb
CHANGED
data/lib/jma_code.rb
CHANGED
@@ -7,9 +7,11 @@ require "jma_code/river_office"
|
|
7
7
|
require "jma_code/point_amedas"
|
8
8
|
require "jma_code/area_flood_forecast"
|
9
9
|
require "jma_code/area_information_city"
|
10
|
-
require "jma_code/
|
10
|
+
require "jma_code/area_forecast_local_m"
|
11
11
|
require "jma_code/area_marine"
|
12
12
|
require "jma_code/area_river"
|
13
|
+
require "jma_code/area_forecast_local_e"
|
14
|
+
require "jma_code/point_seismic_intensity"
|
13
15
|
|
14
16
|
module JMACode
|
15
17
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jma_code
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- metheglin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -38,6 +38,7 @@ files:
|
|
38
38
|
- data/20230105_AreaFloodForecast.csv
|
39
39
|
- data/20230105_AreaRiver.csv
|
40
40
|
- data/20240216-completed_AreaInformationCity-AreaForecastLocalM/AreaForecastLocalM(コード表).csv
|
41
|
+
- data/20240216-completed_AreaInformationCity-AreaForecastLocalM/AreaInformationCity.csv
|
41
42
|
- data/20240216_AreaInformationCity-AreaForecastLocalM/AreaForecastLocalM(コード表).csv
|
42
43
|
- data/20240216_AreaInformationCity-AreaForecastLocalM/AreaForecastLocalM(関係表 竜巻注意情報.csv
|
43
44
|
- data/20240216_AreaInformationCity-AreaForecastLocalM/AreaForecastLocalM(関係表 警報・注意報.csv
|
@@ -46,36 +47,40 @@ files:
|
|
46
47
|
- data/20240325_PointAmedas/ame_master.csv
|
47
48
|
- data/20240325_PointAmedas/snow_master.csv
|
48
49
|
- data/20240418_WaterLevelStation.csv
|
49
|
-
- data/
|
50
|
-
- data/
|
51
|
-
- data/
|
52
|
-
- data/
|
53
|
-
- data/
|
54
|
-
- data/
|
55
|
-
- data/
|
56
|
-
- data/
|
57
|
-
- data/
|
58
|
-
- data/
|
59
|
-
- data/
|
60
|
-
- data/
|
61
|
-
- data/
|
62
|
-
- data/
|
63
|
-
- data/
|
64
|
-
- data/
|
65
|
-
- data/
|
66
|
-
- data/
|
67
|
-
- data/
|
68
|
-
- data/
|
69
|
-
- data/
|
50
|
+
- data/20240618-completed_Volcano-Earthquake/AreaForecastLocalE.csv
|
51
|
+
- data/20240618-completed_Volcano-Earthquake/PointSeismicIntensity.csv
|
52
|
+
- data/20240618_Volcano-Earthquake/AdditionalCommentEarthquake.csv
|
53
|
+
- data/20240618_Volcano-Earthquake/AreaEpicenter.csv
|
54
|
+
- data/20240618_Volcano-Earthquake/AreaEpicenterAbbreviation.csv
|
55
|
+
- data/20240618_Volcano-Earthquake/AreaEpicenterDetail.csv
|
56
|
+
- data/20240618_Volcano-Earthquake/AreaEpicenterSuppliment.csv
|
57
|
+
- data/20240618_Volcano-Earthquake/AreaForecastEEW.csv
|
58
|
+
- data/20240618_Volcano-Earthquake/AreaForecastLocalE-AreaInformationCity-PointRealtimeIntensity.csv
|
59
|
+
- data/20240618_Volcano-Earthquake/AreaForecastLocalE-AreaInformationCity-PointSeismicIntensity.csv
|
60
|
+
- data/20240618_Volcano-Earthquake/AreaForecastLocalE-PointSeismicLgIntensity.csv
|
61
|
+
- data/20240618_Volcano-Earthquake/AreaForecastLocalEEW.csv
|
62
|
+
- data/20240618_Volcano-Earthquake/AreaInformationPrefectureEarthquake.csv
|
63
|
+
- data/20240618_Volcano-Earthquake/AreaTsunami.csv
|
64
|
+
- data/20240618_Volcano-Earthquake/CoastTsunami.csv
|
65
|
+
- data/20240618_Volcano-Earthquake/EarthquakeForecast.csv
|
66
|
+
- data/20240618_Volcano-Earthquake/EarthquakeInformation.csv
|
67
|
+
- data/20240618_Volcano-Earthquake/EarthquakeWarning.csv
|
68
|
+
- data/20240618_Volcano-Earthquake/PointTsunami.csv
|
69
|
+
- data/20240618_Volcano-Earthquake/PointVolcano.csv
|
70
|
+
- data/20240618_Volcano-Earthquake/TokaiInformation.csv
|
71
|
+
- data/20240618_Volcano-Earthquake/TsunamiWarning.csv
|
72
|
+
- data/20240618_Volcano-Earthquake/VolcanicWarning.csv
|
70
73
|
- lib/jma_code.rb
|
71
74
|
- lib/jma_code/area_flood_forecast.rb
|
72
|
-
- lib/jma_code/
|
75
|
+
- lib/jma_code/area_forecast_local_e.rb
|
76
|
+
- lib/jma_code/area_forecast_local_m.rb
|
73
77
|
- lib/jma_code/area_information_city.rb
|
74
78
|
- lib/jma_code/area_marine.rb
|
75
79
|
- lib/jma_code/area_river.rb
|
76
80
|
- lib/jma_code/entity/area_forecast_type.rb
|
77
81
|
- lib/jma_code/ext/blank.rb
|
78
82
|
- lib/jma_code/point_amedas.rb
|
83
|
+
- lib/jma_code/point_seismic_intensity.rb
|
79
84
|
- lib/jma_code/prefecture.rb
|
80
85
|
- lib/jma_code/river_office.rb
|
81
86
|
- lib/jma_code/version.rb
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|