
Import data from the Global Historical Climatology monthly (GHCNm) database
Source:R/import_ghcn_monthly.R
import_ghcn_monthly.RdThis function is a convenient way to access the monthly summaries of the
GHCN. Monthly average temperature is available via
import_ghcn_monthly_temp() and monthly precipitation via
import_ghcn_monthly_prcp(). Note that these functions can take a few
minutes to run, and parallelism is only enabled for precipitation data.
Usage
import_ghcn_monthly_temp(
table = c("inventory", "data"),
dataset = c("qcu", "qcf", "qfe")
)
import_ghcn_monthly_prcp(
station = NULL,
year = NULL,
table = c("inventory", "data"),
progress = rlang::is_interactive()
)Arguments
- table
Either
"inventory","data", or both. The tables to read and return in the output list.- dataset
For
import_ghcn_monthly_temp(). One of the below options. More information is available at https://www.ncei.noaa.gov/pub/data/ghcn/v4/readme.txt."qcu": Quality Control, Unadjusted"qcf": Quality Control, Adjusted, using the Pairwise Homogeneity Algorithm."qfe": Quality Control, Adjusted, Estimated using the Pairwise Homogeneity Algorithm. Only the years 1961-2010 are provided. This is to help maximize station coverage when calculating normals.
- station
For
import_ghcn_monthly_prcp(). The specific stations to import monthly precipitation data for.- year
One or more years of interest. If
NULL, the default, all years of data available for the chosenstations will be imported. Note that, in the GHCNd and GHCNm, files are split by station but not year, so setting ayearwill not speed up the download. Specifying fewer years will improve the speed of a GHCNh download, however.- progress
For
import_ghcn_monthly_prcp(). Show a progress bar when importing many stations? Defaults toTRUEin interactive R sessions. Passed to.progressinpurrr::map().
Value
a list of tibbles
Parallel Processing
If you are importing a lot of meteorological data, this can take a long
while. This is because each combination of year and station requires
downloading a separate data file from NOAA's online data directory, and the
time each download takes can quickly add up. Many data import functions in
{worldmet} can use parallel processing to speed downloading up, powered
by the capable {mirai} package. If users have any {mirai} "daemons"
set, these functions will download files in parallel. The greatest benefits
will be seen if you spawn as many daemons as you have cores on your
machine, although one fewer than the available cores is often a good rule
of thumb. Your mileage may vary, however, and naturally spawning more
daemons than station-year combinations will lead to diminishing returns.
See also
Other GHCN functions:
import_ghcn_countries(),
import_ghcn_daily(),
import_ghcn_hourly(),
import_ghcn_inventory(),
import_ghcn_stations()