jma_code 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +49 -0
  3. data/data/20130523_AreaMarineAJ/AreaMarineA.csv +78 -0
  4. data/data/20130523_AreaMarineAJ/AreaMarineJ.csv +67 -0
  5. data/data/20201026_WmoObservingStations.csv +176 -0
  6. data/data/20240216_AreaInformationCity-AreaForecastLocalM/AreaForecastLocalM/357/274/210/343/202/263/343/203/274/343/203/210/343/202/231/350/241/250/357/274/211.csv +616 -0
  7. data/data/20240216_AreaInformationCity-AreaForecastLocalM/AreaForecastLocalM/357/274/210/351/226/242/344/277/202/350/241/250/343/200/200/347/253/234/345/267/273/346/263/250/346/204/217/346/203/205/345/240/261.csv +391 -0
  8. data/data/20240216_AreaInformationCity-AreaForecastLocalM/AreaForecastLocalM/357/274/210/351/226/242/344/277/202/350/241/250/343/200/200/350/255/246/345/240/261/343/203/273/346/263/250/346/204/217/345/240/261.csv +399 -0
  9. data/data/20240216_AreaInformationCity-AreaForecastLocalM/AreaInformationCity.csv +2094 -0
  10. data/data/20240315_RiverOffice.csv +163 -0
  11. data/data/20240325_PointAmedas/ame_master.csv +1378 -0
  12. data/data/20240325_PointAmedas/snow_master.csv +341 -0
  13. data/data/20240418_WaterLevelStation.csv +641 -0
  14. data/data/Volcano_Earthquake/20240618_AdditionalCommentEarthquake.csv +72 -0
  15. data/data/Volcano_Earthquake/20240618_AreaEpicenter.csv +348 -0
  16. data/data/Volcano_Earthquake/20240618_AreaEpicenterAbbreviation.csv +171 -0
  17. data/data/Volcano_Earthquake/20240618_AreaEpicenterDetail.csv +762 -0
  18. data/data/Volcano_Earthquake/20240618_AreaEpicenterSuppliment.csv +46 -0
  19. data/data/Volcano_Earthquake/20240618_AreaForecastEEW.csv +19 -0
  20. data/data/Volcano_Earthquake/20240618_AreaForecastLocalEEW.csv +61 -0
  21. data/data/Volcano_Earthquake/20240618_AreaForecastLocalE_ AreaInformationCity_ PointSeismicIntensity.csv +4377 -0
  22. data/data/Volcano_Earthquake/20240618_AreaForecastLocalE_AreaInformationCity_PointRealtimeIntensity.csv +666 -0
  23. data/data/Volcano_Earthquake/20240618_AreaForecastLocalE_PointSeismicLgIntensity.csv +708 -0
  24. data/data/Volcano_Earthquake/20240618_AreaInformationPrefectureEarthquake.csv +52 -0
  25. data/data/Volcano_Earthquake/20240618_AreaTsunami.csv +103 -0
  26. data/data/Volcano_Earthquake/20240618_CoastTsunami.csv +70 -0
  27. data/data/Volcano_Earthquake/20240618_EarthquakeForecast.csv +11 -0
  28. data/data/Volcano_Earthquake/20240618_EarthquakeInformation.csv +28 -0
  29. data/data/Volcano_Earthquake/20240618_EarthquakeWarning.csv +7 -0
  30. data/data/Volcano_Earthquake/20240618_PointTsunami.csv +560 -0
  31. data/data/Volcano_Earthquake/20240618_PointVolcano.csv +125 -0
  32. data/data/Volcano_Earthquake/20240618_TokaiInformation.csv +8 -0
  33. data/data/Volcano_Earthquake/20240618_TsunamiWarning.csv +14 -0
  34. data/data/Volcano_Earthquake/20240618_VolcanicWarning.csv +55 -0
  35. data/lib/jma_code/area_flood_forecast.rb +30 -0
  36. data/lib/jma_code/area_forecast_local.rb +52 -0
  37. data/lib/jma_code/area_information_city.rb +97 -0
  38. data/lib/jma_code/area_marine.rb +91 -0
  39. data/lib/jma_code/ext/blank.rb +61 -0
  40. data/lib/jma_code/point_amedas.rb +134 -0
  41. data/lib/jma_code/river_office.rb +30 -0
  42. data/lib/jma_code/version.rb +3 -0
  43. data/lib/jma_code/water_level_station.rb +44 -0
  44. data/lib/jma_code/wmo_observing_station.rb +68 -0
  45. data/lib/jma_code.rb +13 -0
  46. metadata +100 -0
@@ -0,0 +1,3 @@
1
+ module JMACode
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,44 @@
1
+ require "csv"
2
+
3
+ module JMACode
4
+ using Blank
5
+
6
+ class WaterLevelStation < Struct.new(
7
+ :code, :name, :river_name,
8
+ keyword_init: true
9
+ )
10
+ HEADERS = %i(
11
+ code
12
+ name
13
+ river_name
14
+ )
15
+
16
+ class << self
17
+ def load_20240418(&block)
18
+ path = File.join(File.dirname(__FILE__), "../../data/20240418_WaterLevelStation.csv")
19
+ File.open(path) do |f|
20
+ csv = CSV.new(f, headers: HEADERS, row_sep: "\r\n")
21
+ if block_given?
22
+ yield(csv)
23
+ else
24
+ load(csv, num_headers: 3, &block)
25
+ end
26
+ end
27
+ end
28
+
29
+ def load(csv, num_headers: 3)
30
+ csv.drop(num_headers).map do |row|
31
+ build_by_csv_row(row)
32
+ end
33
+ end
34
+
35
+ def build_by_csv_row(row)
36
+ new(
37
+ code: row[:code],
38
+ name: row[:name],
39
+ river_name: row[:river_name],
40
+ )
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,68 @@
1
+ require "csv"
2
+
3
+ module JMACode
4
+ using Blank
5
+
6
+ class WmoObservingStation < Struct.new(
7
+ :code, :name, :name_phonetic, :long_name, :lat, :lng, :used_by,
8
+ keyword_init: true
9
+ )
10
+ HEADERS = %i(
11
+ code
12
+ name
13
+ name_phonetic
14
+ lat_major
15
+ lat_minor
16
+ lng_major
17
+ lng_minor
18
+ long_name
19
+ used_by_bioseasonal
20
+ used_by_seasonal
21
+ used_by_special
22
+ name_used_by_uv
23
+ name_used_by_marine_live_forecast
24
+ name_used_by_flood_forecast
25
+ name_used_by_weather
26
+ )
27
+
28
+ class << self
29
+ def load_20201026(&block)
30
+ path = File.join(File.dirname(__FILE__), "../../data/20201026_WmoObservingStations.csv")
31
+ File.open(path) do |f|
32
+ csv = CSV.new(f, headers: HEADERS, row_sep: "\r\n")
33
+ if block_given?
34
+ yield(csv)
35
+ else
36
+ load(csv, num_headers: 3, &block)
37
+ end
38
+ end
39
+ end
40
+
41
+ def load(csv, num_headers: 3)
42
+ csv.drop(num_headers).map do |row|
43
+ build_by_csv_row(row)
44
+ end
45
+ end
46
+
47
+ def build_by_csv_row(row)
48
+ new(
49
+ code: row[:code],
50
+ name: row[:name],
51
+ name_phonetic: row[:name_phonetic],
52
+ lat: "#{row[:lat_major]}.#{row[:lat_minor]}".to_f,
53
+ lng: "#{row[:lng_major]}.#{row[:lng_minor]}".to_f,
54
+ long_name: row[:long_name],
55
+ used_by: [
56
+ row[:used_by_bioseasonal].present? ? :bioseasonal : nil,
57
+ row[:used_by_seasonal].present? ? :seasonal : nil,
58
+ row[:used_by_special].present? ? :special : nil,
59
+ row[:name_used_by_uv].present? ? :uv : nil,
60
+ row[:name_used_by_marine_live_forecast].present? ? :marine_live_forecast : nil,
61
+ row[:name_used_by_flood_forecast].present? ? :flood_forecast : nil,
62
+ row[:name_used_by_weather].present? ? :weather : nil,
63
+ ].compact,
64
+ )
65
+ end
66
+ end
67
+ end
68
+ end
data/lib/jma_code.rb ADDED
@@ -0,0 +1,13 @@
1
+ require "jma_code/version"
2
+ require "jma_code/ext/blank"
3
+ require "jma_code/wmo_observing_station"
4
+ require "jma_code/water_level_station"
5
+ require "jma_code/river_office"
6
+ require "jma_code/point_amedas"
7
+ require "jma_code/area_flood_forecast"
8
+ require "jma_code/area_information_city"
9
+ require "jma_code/area_forecast_local"
10
+ require "jma_code/area_marine"
11
+
12
+ module JMACode
13
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jma_code
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - metheglin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-06-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '13.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '13.0'
27
+ description: JMA Code
28
+ email: pigmybank@gmail.com
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - README.md
34
+ - data/20130523_AreaMarineAJ/AreaMarineA.csv
35
+ - data/20130523_AreaMarineAJ/AreaMarineJ.csv
36
+ - data/20201026_WmoObservingStations.csv
37
+ - data/20240216_AreaInformationCity-AreaForecastLocalM/AreaForecastLocalM(コード表).csv
38
+ - data/20240216_AreaInformationCity-AreaForecastLocalM/AreaForecastLocalM(関係表 竜巻注意情報.csv
39
+ - data/20240216_AreaInformationCity-AreaForecastLocalM/AreaForecastLocalM(関係表 警報・注意報.csv
40
+ - data/20240216_AreaInformationCity-AreaForecastLocalM/AreaInformationCity.csv
41
+ - data/20240315_RiverOffice.csv
42
+ - data/20240325_PointAmedas/ame_master.csv
43
+ - data/20240325_PointAmedas/snow_master.csv
44
+ - data/20240418_WaterLevelStation.csv
45
+ - data/Volcano_Earthquake/20240618_AdditionalCommentEarthquake.csv
46
+ - data/Volcano_Earthquake/20240618_AreaEpicenter.csv
47
+ - data/Volcano_Earthquake/20240618_AreaEpicenterAbbreviation.csv
48
+ - data/Volcano_Earthquake/20240618_AreaEpicenterDetail.csv
49
+ - data/Volcano_Earthquake/20240618_AreaEpicenterSuppliment.csv
50
+ - data/Volcano_Earthquake/20240618_AreaForecastEEW.csv
51
+ - data/Volcano_Earthquake/20240618_AreaForecastLocalEEW.csv
52
+ - data/Volcano_Earthquake/20240618_AreaForecastLocalE_ AreaInformationCity_ PointSeismicIntensity.csv
53
+ - data/Volcano_Earthquake/20240618_AreaForecastLocalE_AreaInformationCity_PointRealtimeIntensity.csv
54
+ - data/Volcano_Earthquake/20240618_AreaForecastLocalE_PointSeismicLgIntensity.csv
55
+ - data/Volcano_Earthquake/20240618_AreaInformationPrefectureEarthquake.csv
56
+ - data/Volcano_Earthquake/20240618_AreaTsunami.csv
57
+ - data/Volcano_Earthquake/20240618_CoastTsunami.csv
58
+ - data/Volcano_Earthquake/20240618_EarthquakeForecast.csv
59
+ - data/Volcano_Earthquake/20240618_EarthquakeInformation.csv
60
+ - data/Volcano_Earthquake/20240618_EarthquakeWarning.csv
61
+ - data/Volcano_Earthquake/20240618_PointTsunami.csv
62
+ - data/Volcano_Earthquake/20240618_PointVolcano.csv
63
+ - data/Volcano_Earthquake/20240618_TokaiInformation.csv
64
+ - data/Volcano_Earthquake/20240618_TsunamiWarning.csv
65
+ - data/Volcano_Earthquake/20240618_VolcanicWarning.csv
66
+ - lib/jma_code.rb
67
+ - lib/jma_code/area_flood_forecast.rb
68
+ - lib/jma_code/area_forecast_local.rb
69
+ - lib/jma_code/area_information_city.rb
70
+ - lib/jma_code/area_marine.rb
71
+ - lib/jma_code/ext/blank.rb
72
+ - lib/jma_code/point_amedas.rb
73
+ - lib/jma_code/river_office.rb
74
+ - lib/jma_code/version.rb
75
+ - lib/jma_code/water_level_station.rb
76
+ - lib/jma_code/wmo_observing_station.rb
77
+ homepage: https://rubygems.org/gems/jma_code
78
+ licenses:
79
+ - MIT
80
+ metadata: {}
81
+ post_install_message:
82
+ rdoc_options: []
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '2.7'
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ requirements: []
96
+ rubygems_version: 3.1.4
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: JMA Code
100
+ test_files: []