jmastats
jmastats
jmastats
August 1, 2024
Version 0.2.2
Title Download Weather Data from Japan Meteorological Agency Website
Description Provides features that allow users to download
weather data published by the Japan Meteorological Agency (JMA) website
(<https://www.jma.go.jp/jma/index.html>). The data includes information
dating back to 1976 and aligns with the categories available on the website.
Additionally, users can process the best track data of typhoons and easily
handle earthquake record files.
Depends R (>= 4.1)
License MIT + file LICENSE
BugReports https://github.com/uribo/jmastats/issues
URL https://uribo.github.io/jmastats/,
https://github.com/uribo/jmastats
Imports cli (>= 3.4.0), crayon (>= 1.3.4), dplyr (>= 1.1.0), forcats
(>= 0.4.0), ggplot2 (>= 2.2.1), lifecycle (>= 1.0.3), lubridate
(>= 1.7.4), purrr (>= 1.0.2), rappdirs (>= 0.3.3), readr (>=
1.1.1), rlang (>= 0.2.1), rvest (>= 0.3.2), sf (>= 0.6.3),
stringr (>= 1.3.1), tibble (>= 3.0.0), tidyselect (>= 1.1.0),
tidyr (>= 1.0.0), units (>= 0.5.1), xml2 (>= 1.2.0)
Suggests knitr (>= 1.20), lwgeom (>= 0.1-4), rmarkdown (>= 1.9),
testthat (>= 2.0.0)
Encoding UTF-8
LazyData true
ByteCompile true
RoxygenNote 7.3.2
NeedsCompilation no
Author Shinya Uryu [aut, cph, cre] (<https://orcid.org/0000-0002-0493-6186>)
Maintainer Shinya Uryu <suika1127@gmail.com>
Repository CRAN
Date/Publication 2024-08-01 04:30:01 UTC
1
2 earthquake_station
Contents
earthquake_station . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
ggplot2-scales . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
jma_collect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
nearest_station . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
parse_unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
pivot_tide_level . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
read_eqdb_csv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
read_jma_weather . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
read_kishou_feed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
read_rsmc_besttrack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
read_tide_level . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
reset_cache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
stations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
tide_station . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Index 15
Description
Usage
earthquake_station
Format
Examples
head(earthquake_station)
ggplot2-scales 3
Description
[Experimental]
Usage
Arguments
Value
Examples
d <-
data.frame(
date = as.Date(c(17410, 17411, 17412, 17413, 17414, 17415), origin = "1970-01-01"),
precipitation_sum = units::set_units(c(3.5, 9.5, 0, 0, 0, 5), "mm"))
library(ggplot2)
library(units)
ggplot(d, aes(date, precipitation_sum,
color = drop_units(precipitation_sum),
fill = drop_units(precipitation_sum))) +
geom_bar(stat = "identity") +
scale_color_jma_absolute(type = "precipitation") +
scale_fill_jma_absolute(type = "precipitation")
4 jma_collect
Description
[Stable]
Refer to the data available in the JMA Historical Weather Data Search. Executed by specifying the
target location and date. Currently, not all types of data acquisition are supported.
Usage
jma_collect(
item = NULL,
block_no,
year,
month,
day,
cache = TRUE,
pack = TRUE,
quiet = FALSE
)
Arguments
item Type of weather data to be acquired. Mainly specifies the interval between
records (e.g. daily or hourly). See NOTE for details.
block_no Block number of the location to be observed. It is assumed that block_no is input
as a string consisting of a 4- or 5-digit number. If a numeric value is specified,
it is processed as a string.
year select year
month select month
day select date (default NULL)
cache use cash and save to cache. (TRUE, the default)
pack Whether to packing common variables or not. (TRUE, the default)
quiet Whether to output information on variable and row combinations that were
treated as missing values for some reason. (TRUE, the default)
Value
a tbl object
nearest_station 5
Note
The parameter item chooses one from these:
Examples
# Annually
jma_collect(item = "annually", "1284", year = 2017, month = 11, cache = FALSE)
# Daily
jma_collect(item = "daily", block_no = "0010", year = 2017, month = 11, cache = FALSE)
jma_collect(item = "daily", "0422", year = 2017, month = 11, cache = FALSE)
# Hourly
jma_collect("hourly", "0010", 2018, 7, 30, cache = FALSE)
# Historical Ranking
jma_collect("rank", block_no = "47646", year = 2020, cache = FALSE)
Description
[Stable]
Return the nearest stations information to the given coordinates.
Usage
nearest_station(longitude, latitude, geometry = NULL)
pick_neighbor_stations(
longitude,
latitude,
distance = 1,
.unit = "m",
geometry = NULL
)
6 nearest_station
pick_neighbor_tide_stations(
year,
longitude,
latitude,
distance = 100,
.unit = "km",
geometry = NULL
)
Arguments
longitude Longitude.
latitude Latitude.
geometry XY sf::sf object.
distance Distance from station to station to adjustment.
.unit Unit used for extraction from the point of interest. Default m (meters). This
value is passed to units::as_units.
year For tide level data. Restricted to the observation points in the target year.
Details
• nearest_station(): Return single station data.
• pick_neighbor_stations(): Pick-up neighbourhood stations.
• pick_neighbor_tide_stations(): Pick-up neighbourhood tidal observation stations. Filter
by distance from target point.
Value
an object of class sf.
Examples
nearest_station(142.9313, 43.70417)
d <-
pick_neighbor_stations(140.10, 36.08, 30, "km")
pick_neighbor_stations(geometry = sf::st_point(c(140.1833, 36.23333)),
distance = 100)
Description
[Stable]
Usage
parse_unit(data, rename = TRUE)
Arguments
data data
rename logical
Value
a tbl object
Examples
# For data retrieved with jma_collect(), here is a minimal example.
d <-
tibble::tibble(date = as.Date(c(17742, 17742, 17742, 17742, 17742, 17742), origin = "1970-01-01"),
time = c(1, 2, 3, 4, 5, 6),
`precipitation(mm)` = c(0, 0, 0, 0, 0, 0),
`temperature(℃)` = c(22.4, 22.1, 21, 20.2, 20.4, 23.5))
d |> parse_unit(rename = TRUE)
Description
[Stable]
Usage
pivot_tide_level(data)
Arguments
data tidal level data
8 read_eqdb_csv
Value
List to store two datasets containing hourly and tide level data.
See Also
read_tide_level()
Examples
read_tide_level(system.file("dummy/tide.txt", package = "jmastats")) |>
pivot_tide_level()
Description
[Stable]
Usage
Arguments
Value
a tbl object
See Also
https://www.data.jma.go.jp/svd/eqdb/data/shindo/index.html
Examples
read_eqdb_csv(system.file("dummy/eqdb.csv", package = "jmastats"))
read_jma_weather 9
Description
[Experimental]
Read the past weather data files downloaded from JMA.
Usage
read_jma_weather(path)
Arguments
path The path to the downloaded file.
Value
a tbl object
See Also
https://www.data.jma.go.jp/gmd/risk/obsdl/index.php, https://www.data.jma.go.jp/
gmd/risk/obsdl/top/help3.html
Examples
read_jma_weather(system.file("dummy/dl_data.csv", package = "jmastats"))
Description
[Experimental]
Usage
read_kishou_feed(frequency, type)
Arguments
frequency Release frequency. Select either high frequency ("high") or long term ("low")
type Feed type. Specify the item to be retrieved as a string. See details for the items.
10 read_rsmc_besttrack
Details
Value
a tbl object
See Also
https://xml.kishou.go.jp
Examples
read_kishou_feed("high", type = "regular")
read_kishou_feed("low", "other")
Description
[Stable]
Tidy formatting best track data and combine each point to line.
Usage
read_rsmc_besttrack(path)
track_combine(
data,
group_vars = c("international_number", "storm_name"),
keep_vars = NULL,
geometry = geometry
)
read_tide_level 11
Arguments
path path to best track data (.txt). Give the path as a directory in the user’s computer
or the URL.
data Import data using read_rsmc_besttrack
group_vars To combine track variables.
keep_vars Keep variables.
geometry geometry column name (default geometry).
Details
• read_rsmc_besttrack(): Read single best track data into sf contains observation record as
point.
• track_combine(): Combine track data to line by id (such as international_number and storm_name).
Value
a tbl object
See Also
https://www.jma.go.jp/jma/jma-eng/jma-center/rsmc-hp-pub-eg/RSMC_HP.htm
Examples
read_rsmc_besttrack(path = system.file("dummy/bst.txt", package = "jmastats"))
Description
[Stable]
Usage
read_tide_level(path = NULL, .year, .month, .stn, raw = FALSE)
Arguments
path URL or local file path to sea tide level file
.year A.D. 1997 to present year.
.month Month number. 1997 only, valid after March.
.stn Station identification name in uppercase two-digit letters.
raw If TRUE, return raw format data
12 reset_cache
Value
a tbl object
See Also
https://www.data.jma.go.jp/gmd/kaiyou/db/tide/suisan/readme.html
Examples
Description
[Experimental]
Remove all package cache files.
Usage
reset_cache()
Value
None
Examples
if (interactive())
reset_cache()
stations 13
Description
Usage
stations
Format
• area
• station_no
• station_type
• station_name
• address
• elevation
• observation_begin
• note1
• note1
• note2
• katakana
• prec_no
• block_no
• pref_code
• geometry
Examples
head(stations)
dim(stations)
14 tide_station
Description
Observation stations from 1997 to 2024. This data corresponds to the January 1, 2024 update.
Usage
tide_station
Format
A data frame with 1949 rows 7 variables
Examples
head(tide_station)
Index
∗ datasets tide_station, 14
earthquake_station, 2 track_combine (read_rsmc_besttrack), 10
stations, 13
tide_station, 14 units::as_units, 6
earthquake_station, 2
ggplot2-scales, 3
ggplot2::scale_color_gradientn, 3
ggplot2::scale_fill_gradientn, 3
jma_collect, 4
nearest_station, 5
parse_unit, 7
pick_neighbor_stations
(nearest_station), 5
pick_neighbor_tide_stations
(nearest_station), 5
pivot_tide_level, 7
read_eqdb_csv, 8
read_jma_weather, 9
read_kishou_feed, 9
read_rsmc_besttrack, 10, 11
read_tide_level, 11
read_tide_level(), 8
reset_cache, 12
scale_color_jma_absolute
(ggplot2-scales), 3
scale_color_jma_relative
(ggplot2-scales), 3
scale_fill_jma_absolute
(ggplot2-scales), 3
scale_fill_jma_relative
(ggplot2-scales), 3
sf, 11
sf::sf, 6
stations, 5, 13
15