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. |
Authors: | Shinya Uryu [aut, cph, cre] |
Maintainer: | Shinya Uryu <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.2.2.9000 |
Built: | 2024-11-11 02:58:55 UTC |
Source: | https://github.com/uribo/jmastats |
This data corresponds to the July 18, 2024 update.
earthquake_station
earthquake_station
A simple feature data frame with 671 rows 7 variables
head(earthquake_station)
head(earthquake_station)
scale_color_jma_absolute(type = "precipitation", ...) scale_color_jma_relative(type = "amedas", ...) scale_fill_jma_absolute(type = "precipitation", ...) scale_fill_jma_relative(type = "amedas", ...)
scale_color_jma_absolute(type = "precipitation", ...) scale_color_jma_relative(type = "amedas", ...) scale_fill_jma_absolute(type = "precipitation", ...) scale_fill_jma_relative(type = "amedas", ...)
type |
Display item |
... |
Arguments to pass on to ggplot2::scale_color_gradientn or ggplot2::scale_fill_gradientn |
A ScaleContinuous
object that can be added to a ggplot
object
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")
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")
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.
jma_collect( item = NULL, block_no, year, month, day, cache = TRUE, pack = TRUE, quiet = FALSE )
jma_collect( item = NULL, block_no, year, month, day, cache = TRUE, pack = TRUE, quiet = FALSE )
item |
Type of weather data to be acquired. Mainly specifies
the interval between records (e.g. |
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 |
cache |
use cash and save to cache. ( |
pack |
Whether to packing common variables or not. ( |
quiet |
Whether to output information on variable and
row combinations that were treated as missing values
for some reason. ( |
a tbl
object
The parameter item
chooses one from these:
annually: Annual value. Please specify a location by block_no
.
monthly: Monthly value. Please specify location and year.
3monthly: Value every 3 months. Please specify location and year.
10daily: Seasonal value. Please specify location and year.
mb5daily: Semi-seasonal value. Please specify location and year.
daily: Daily value. Please specify location, year and month.
hourly: Hourly value. Please specify location, year, month and day.
rank: Values of the largest in the history of observations.
nml_ym: Climatological normals for each year and month.
nml_3m: Climatological normals for each 3 months.
nml_10d: Climatological normals for each season (almost 10 days).
nml_mb5d: Climatological normals for each semi-season (almost 5 days).
nml_daily: Daily climatological normals for specific month. for each location.
# 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) # Climatological normals jma_collect("nml_ym", block_no = "47646", cache = FALSE, pack = FALSE) jma_collect("nml_3m", "47646", cache = FALSE, pack = FALSE, quiet = TRUE) jma_collect("nml_10d", "0228", cache = FALSE, pack = FALSE, quiet = TRUE) jma_collect("nml_mb5d", "0228", cache = FALSE, pack = FALSE, quiet = FALSE)
# 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) # Climatological normals jma_collect("nml_ym", block_no = "47646", cache = FALSE, pack = FALSE) jma_collect("nml_3m", "47646", cache = FALSE, pack = FALSE, quiet = TRUE) jma_collect("nml_10d", "0228", cache = FALSE, pack = FALSE, quiet = TRUE) jma_collect("nml_mb5d", "0228", cache = FALSE, pack = FALSE, quiet = FALSE)
Return the nearest stations information to the given coordinates.
nearest_station(longitude, latitude, geometry = NULL) pick_neighbor_stations( longitude, latitude, distance = 1, .unit = "m", geometry = NULL ) pick_neighbor_tide_stations( year, longitude, latitude, distance = 100, .unit = "km", geometry = NULL )
nearest_station(longitude, latitude, geometry = NULL) pick_neighbor_stations( longitude, latitude, distance = 1, .unit = "m", geometry = NULL ) pick_neighbor_tide_stations( year, longitude, latitude, distance = 100, .unit = "km", geometry = NULL )
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. |
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.
an object of class sf
.
nearest_station(142.9313, 43.70417) pick_neighbor_stations(140.10, 36.08, 300000) d <- pick_neighbor_stations(140.10, 36.08, 30, "km") pick_neighbor_stations(geometry = sf::st_point(c(140.1833, 36.23333)), distance = 100) pick_neighbor_tide_stations(longitude = 133.4375, latitude = 34.45833, year = 2020, distance = 100, .unit = "km")
nearest_station(142.9313, 43.70417) pick_neighbor_stations(140.10, 36.08, 300000) d <- pick_neighbor_stations(140.10, 36.08, 30, "km") pick_neighbor_stations(geometry = sf::st_point(c(140.1833, 36.23333)), distance = 100) pick_neighbor_tide_stations(longitude = 133.4375, latitude = 34.45833, year = 2020, distance = 100, .unit = "km")
parse_unit(data, rename = TRUE)
parse_unit(data, rename = TRUE)
data |
data |
rename |
logical |
a tbl
object
# 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)
# 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)
pivot_tide_level(data)
pivot_tide_level(data)
data |
tidal level data |
List to store two datasets containing hourly and tide level data.
read_tide_level(system.file("dummy/tide.txt", package = "jmastats")) |> pivot_tide_level()
read_tide_level(system.file("dummy/tide.txt", package = "jmastats")) |> pivot_tide_level()
read_eqdb_csv(path, show_metadata = TRUE)
read_eqdb_csv(path, show_metadata = TRUE)
path |
local file path to earthquake record file. |
show_metadata |
logical. If FALSE, returns only the values observed at each location. |
a tbl
object
https://www.data.jma.go.jp/svd/eqdb/data/shindo/index.html
read_eqdb_csv(system.file("dummy/eqdb.csv", package = "jmastats"))
read_eqdb_csv(system.file("dummy/eqdb.csv", package = "jmastats"))
Read the past weather data files downloaded from JMA.
read_jma_weather(path)
read_jma_weather(path)
path |
The path to the downloaded file. |
a tbl
object
https://www.data.jma.go.jp/gmd/risk/obsdl/index.php, https://www.data.jma.go.jp/gmd/risk/obsdl/top/help3.html
read_jma_weather(system.file("dummy/dl_data.csv", package = "jmastats"))
read_jma_weather(system.file("dummy/dl_data.csv", package = "jmastats"))
read_kishou_feed(frequency, type)
read_kishou_feed(frequency, type)
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. |
The following items can be specified in the type argument.
regular: It will be announced on time.
extra: It will be announced at any time.
eqvol: Earthquakes and Volcanoes.
other: Other informations.
a tbl
object
read_kishou_feed("high", type = "regular") read_kishou_feed("low", "other")
read_kishou_feed("high", type = "regular") read_kishou_feed("low", "other")
Tidy formatting best track data and combine each point to line.
read_rsmc_besttrack(path) track_combine( data, group_vars = c("international_number", "storm_name"), keep_vars = NULL, geometry = geometry )
read_rsmc_besttrack(path) track_combine( data, group_vars = c("international_number", "storm_name"), keep_vars = NULL, geometry = geometry )
path |
path to best track data ( |
data |
Import data using read_rsmc_besttrack |
group_vars |
To combine track variables. |
keep_vars |
Keep variables. |
geometry |
geometry column name (default |
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).
a tbl
object
https://www.jma.go.jp/jma/jma-eng/jma-center/rsmc-hp-pub-eg/RSMC_HP.htm
read_rsmc_besttrack(path = system.file("dummy/bst.txt", package = "jmastats")) read_rsmc_besttrack(path = system.file("dummy/bst.txt", package = "jmastats")) |> track_combine()
read_rsmc_besttrack(path = system.file("dummy/bst.txt", package = "jmastats")) read_rsmc_besttrack(path = system.file("dummy/bst.txt", package = "jmastats")) |> track_combine()
read_tide_level(path = NULL, .year, .month, .stn, raw = FALSE)
read_tide_level(path = NULL, .year, .month, .stn, raw = FALSE)
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 |
a tbl
object
https://www.data.jma.go.jp/gmd/kaiyou/db/tide/suisan/readme.html
# Read a local storage file (dummy data) read_tide_level(system.file("dummy/tide.txt", package = "jmastats")) # Request from URL read_tide_level("https://www.data.jma.go.jp/gmd/kaiyou/data/db/tide/suisan/txt/2020/TK.txt") # Request from parameters read_tide_level(.year = 2020, .month = 2, .stn = "TK")
# Read a local storage file (dummy data) read_tide_level(system.file("dummy/tide.txt", package = "jmastats")) # Request from URL read_tide_level("https://www.data.jma.go.jp/gmd/kaiyou/data/db/tide/suisan/txt/2020/TK.txt") # Request from parameters read_tide_level(.year = 2020, .month = 2, .stn = "TK")
Remove all package cache files.
reset_cache()
reset_cache()
None
if (interactive()) reset_cache()
if (interactive()) reset_cache()
This data corresponds to the April 1, 2024 update.
stations
stations
A data frame with 1323 rows 14 variables:
area
station_no
station_type
station_name
address
elevation
observation_begin
note1
note1
note2
katakana
prec_no
block_no
pref_code
geometry
head(stations) dim(stations)
head(stations) dim(stations)
Observation stations from 1997 to 2024. This data corresponds to the January 1, 2024 update.
tide_station
tide_station
A data frame with 1949 rows 7 variables
head(tide_station)
head(tide_station)