Title: | Import Surface Meteorological Data from NOAA Integrated Surface Database (ISD) |
---|---|
Description: | Functions to import data from more than 30,000 surface meteorological sites around the world managed by the National Oceanic and Atmospheric Administration (NOAA) Integrated Surface Database (ISD, see <https://www.ncei.noaa.gov/products/land-based-station/integrated-surface-database>). |
Authors: | David Carslaw [aut, cre] |
Maintainer: | David Carslaw <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.9.9 |
Built: | 2025-01-14 09:27:46 UTC |
Source: | https://github.com/openair-project/worldmet |
Writes a text file in the ADMS format to a location of the user's choosing, with optional interpolation of missing values.
exportADMS(dat, out = "./ADMS_met.MET", interp = FALSE, maxgap = 2)
exportADMS(dat, out = "./ADMS_met.MET", interp = FALSE, maxgap = 2)
dat |
A data frame imported by |
out |
A file name for the ADMS file. The file is written to the working directory by default. |
interp |
Should interpolation of missing values be undertaken? If |
maxgap |
The maximum gap in hours that should be interpolated where
there are missing data when |
exportADMS()
returns the input dat
invisibly.
## Not run: ## import some data then export it dat <- importNOAA(year = 2012) exportADMS(dat, out = "~/adms_met.MET") ## End(Not run)
## Not run: ## import some data then export it dat <- importNOAA(year = 2012) exportADMS(dat, out = "~/adms_met.MET") ## End(Not run)
Get information on meteorological sites
getMeta( site = "heathrow", lat = NA, lon = NA, country = NA, state = NA, n = 10, end.year = "current", provider = c("OpenStreetMap", "Esri.WorldImagery"), plot = TRUE, returnMap = FALSE )
getMeta( site = "heathrow", lat = NA, lon = NA, country = NA, state = NA, n = 10, end.year = "current", provider = c("OpenStreetMap", "Esri.WorldImagery"), plot = TRUE, returnMap = FALSE )
site |
A site name search string e.g. |
lat |
A latitude in decimal degrees to search. Takes the values -90 to 90. |
lon |
A longitude in decimal degrees to search. Takes values -180 to 180. Negative numbers are west of the Greenwich meridian. |
country |
The country code. This is a two letter code. For a full listing see https://www1.ncdc.noaa.gov/pub/data/noaa/isd-history.csv. |
state |
The state code. This is a two letter code. |
n |
The number of nearest sites to search based on |
end.year |
To help filter sites based on how recent the available data
are. |
provider |
By default a map will be created in which readers may toggle
between a vector base map and a satellite/aerial image. |
plot |
If |
returnMap |
Should the leaflet map be returned instead of the meta data?
Default is |
This function is primarily used to find a site code that can be used to
access data using importNOAA()
. Sites searches of approximately 30,000
sites can be carried out based on the site name and based on the nearest
locations based on user-supplied latitude and longitude.
A data frame is returned with all available meta data, mostly
importantly including a code
that can be supplied to importNOAA()
. If
latitude and longitude searches are made an approximate distance, dist
in
km is also returned.
David Carslaw
getMetaLive()
to download the all meta data to allow re-use and
direct querying.
## Not run: ## search for sites with name beijing getMeta(site = "beijing") ## End(Not run) ## Not run: ## search for near a specified lat/lon - near Beijing airport ## returns 'n' nearest by default getMeta(lat = 40, lon = 116.9) ## End(Not run)
## Not run: ## search for sites with name beijing getMeta(site = "beijing") ## End(Not run) ## Not run: ## search for near a specified lat/lon - near Beijing airport ## returns 'n' nearest by default getMeta(lat = 40, lon = 116.9) ## End(Not run)
Download all NOAA meta data, allowing for re-use and direct querying.
getMetaLive(...)
getMetaLive(...)
... |
Currently unused. |
a tibble
## Not run: meta <- getMetaLive() head(meta) ## End(Not run)
## Not run: meta <- getMetaLive() head(meta) ## End(Not run)
This is the main function to import data from the NOAA Integrated Surface Database (ISD). The ISD contains detailed surface meteorological data from around the world for over 30,000 locations. For general information of the ISD see https://www.ncei.noaa.gov/products/land-based-station/integrated-surface-database and the map here https://gis.ncdc.noaa.gov/maps/ncei.
importNOAA( code = "037720-99999", year = 2014, hourly = TRUE, n.cores = 1, quiet = FALSE, path = NA )
importNOAA( code = "037720-99999", year = 2014, hourly = TRUE, n.cores = 1, quiet = FALSE, path = NA )
code |
The identifying code as a character string. The code is a
combination of the USAF and the WBAN unique identifiers. The codes are
separated by a “-” e.g. |
year |
The year to import. This can be a vector of years e.g. |
hourly |
Should hourly means be calculated? The default is |
n.cores |
Number of cores to use for parallel processing. Default is 1 and hence no parallelism. |
quiet |
If |
path |
If a file path is provided, the data are saved as an rds file at
the chosen location e.g. |
Note the following units for the main variables:
Date/time in POSIXct format. Note the time zone is GMT (UTC) and may need to be adjusted to merge with other local data. See details below.
Latitude in decimal degrees (-90 to 90).
Longitude in decimal degrees (-180 to 180). Negative numbers are west of the Greenwich Meridian.
Elevation of site in metres.
Wind direction in degrees. 90 is from the east.
Wind speed in m/s.
The height above ground level (AGL) of the lowest cloud or obscuring phenomena layer aloft with 5/8 or more summation total sky cover, which may be predominantly opaque, or the vertical visibility into a surface-based obstruction.
The visibility in metres.
Air temperature in degrees Celcius.
The dew point temperature in degrees Celcius.
The sea level pressure in millibars.
The relative humidity (%).
Cloud cover for different layers in Oktas (1-8).
Maximum of cl_1 to cl_3 cloud cover in Oktas (1-8).
Height of the cloud base for each later in metres.
12-hour precipitation in mm. The sum of this column should give the annual precipitation.
6-hour precipitation in mm.
This value of precipitation spreads the 12-hour total across the previous 12 hours.
The description of the present weather description (if available).
The data are returned in GMT (UTC). It may be necessary to adjust the time
zone when combining with other data. For example, if air quality data were
available for Beijing with time zone set to "Etc/GMT-8" (note the negative
offset even though Beijing is ahead of GMT. See the openair
package and
manual for more details), then the time zone of the met data can be changed
to be the same. One way of doing this would be attr(met$date, "tzone") <- "Etc/GMT-8"
for a meteorological data frame called met
. The two data sets
could then be merged based on date
.
Returns a data frame of surface observations. The data frame is
consistent for use with the openair
package. Note that the data are
returned in GMT (UTC) time zone format. Users may wish to express the data
in other time zones, e.g., to merge with air pollution data. The
lubridate package is useful in this
respect.
David Carslaw
getMeta()
to obtain the codes based on various site search
approaches.
## Not run: ## use Beijing airport code (see getMeta example) dat <- importNOAA(code = "545110-99999", year = 2010:2011) ## End(Not run)
## Not run: ## use Beijing airport code (see getMeta example) dat <- importNOAA(code = "545110-99999", year = 2010:2011) ## End(Not run)
This data frame consists of the weather description codes used in the ISD. It is not of general use to most users.
weatherCodes
weatherCodes
An object of class tbl_df
(inherits from tbl
, data.frame
) with 100 rows and 2 columns.
Weather code, which can be merged with the pwc
column in importNOAA()
datasets.
Description associated with the weather codes.
weatherCodes
weatherCodes