Find GHCN-D Stations from AWS Data with Fuzzy Matching
find_stations_aws.Rd
This function finds GHCN-D weather stations within a specified radius of a given location and/or matching a given name pattern using fuzzy matching, using the station data stored in the AWS-based GHCN package.
Usage
find_stations_aws(
lat = NULL,
lon = NULL,
radius = NULL,
name_pattern = NULL,
max_distance = 0.5,
max_stations = 10
)
Arguments
- lat
Numeric. Latitude of the center point in decimal degrees.
- lon
Numeric. Longitude of the center point in decimal degrees.
- radius
Numeric. Search radius in kilometers.
- name_pattern
Character. Pattern to search for in station names. Default is NULL.
- max_distance
Numeric. Maximum string distance for fuzzy matching. Default is 0.2.
- max_stations
Integer. Maximum number of stations to return. Default is 10.
Value
A data.table containing information about nearby and/or name-matched stations, sorted by relevance and distance.
Examples
find_stations_aws(40.7128, -74.0060, 50) # Nearby stations to New York City
#> id latitude longitude elevation state
#> <char> <num> <num> <num> <char>
#> 1: USC00305816 40.7106 -74.0142 25.3 NY
#> 2: USC00309580 40.7103 -74.0142 12.2 NY
#> 3: US1NYNY0078 40.7339 -73.9844 6.1 NY
#> 4: US1NYKN0025 40.6846 -73.9867 5.5 NY
#> 5: US1NJHD0023 40.7326 -74.0510 30.2 NJ
#> 6: USC00300958 40.6892 -73.9550 15.2 NY
#> 7: USC00284339 40.7419 -74.0572 41.1 NJ
#> 8: US1NYNY0082 40.7613 -73.9929 25.3 NY
#> 9: US1NYKN0059 40.6597 -73.9828 51.8 NY
#> 10: USC00304632 40.7333 -73.9333 3.0 NY
#> name gsn_flag hcn_crn_flag wmo_id geo_distance
#> <char> <char> <char> <char> <num>
#> 1: WORLD TRADE CTR 0.733160
#> 2: WORLD TRADE CTR 0.744956
#> 3: STUYVESANT SQUARE PARK - NEW Y 2.969520
#> 4: BROOKLYN 3.1 NW 3.532681
#> 5: JERSEY CITY 1.6 NNE 4.385017
#> 6: BROOKLYN 5.036879
#> 7: JERSEY CITY 5.393001
#> 8: MATTHEWS PALMER PLAYGROUND - N 5.504740
#> 9: BROOKLYN 2.4 WSW 6.220062
#> 10: LAUREL HILL 6.536863
find_stations_aws(40.7128, -74.0060, 50, name_pattern = "Central Prk")
#> id latitude longitude elevation state name gsn_flag hcn_crn_flag
#> <char> <num> <num> <num> <char> <char> <char> <char>
#> 1: <NA> NA NA NA <NA> <NA> <NA> <NA>
#> wmo_id name_distance geo_distance
#> <char> <num> <num>
#> 1: <NA> NA NA
find_stations_aws(lat = NULL, lon = NULL, radius = NULL, name_pattern = "JFK Airprt")
#> Error in find_stations_aws(lat = NULL, lon = NULL, radius = NULL, name_pattern = "JFK Airprt"): lat, lon, and radius must be numeric values