Open boshek opened 6 years ago
For another time, but I solved this in rclimateca using a "sanitizer" function for locations and a search function (along with a geocoded search, which might be more useful at times).
library(rclimateca)
ec_climate_search_locations("kentville")
#> Search results for ec_climate_search_locations(
#> query = "kentville"
#> )
#> [1] KENTVILLE CDA NS 6375 KENTVILLE CDA CS NS 27141
ec_climate_geosearch_locations("kentville, NS")
#> Search results for ec_climate_geosearch_locations(
#> query = "kentville, NS"
#> )
#> [1] KENTVILLE CDA NS 6375 / 1.5 km
#> [2] KENTVILLE CDA CS NS 27141 / 1.5 km
#> [3] SOUTH ALTON NS 6470 / 2.9 km
#> [4] SHEFFIELD MILLS NS 6467 / 5.7 km
#> [5] HELLS GATE NS 6363 / 6.7 km
#> [6] CANNING NS 6311 / 8.7 km
#> [7] WHITE ROCK NS 6507 / 9.6 km
#> [8] CAMBRIDGE STATION NS 6309 / 9.9 km
#> [9] WOLFVILLE NS 6513 / 10.1 km
#> [10] SHARPE BROOK IHD NS 6464 / 12.4 km
#> [11] WATERVILLE CAMBRIDGE NS 6497 / 12.6 km
#> [12] HOLLOW BRIDGE NS 6364 / 12.6 km
#> [13] SOUTH MOUNTAIN NS 26969 / 15.9 km
#> [14] HALL'S HARBOUR NS 6359 / 16.7 km
#> [15] BERWICK NS 7105 / 18.5 km
#> [16] GARLAND NS 6351 / 22.9 km
#> [17] SUMMERVILLE NS 6484 / 25.2 km
#> [18] WINDSOR FALMOUTH NS 6509 / 26.2 km
#> [19] WINDSOR FALMOUTH NS 6510 / 27.8 km
#> [20] MARTOCK 35M NS 49109 / 29.9 km
#> ...plus 8723 more
as_ec_climate_location("kentville cda cs")
#> <ec_climate_location>
#> [1] KENTVILLE CDA CS NS 27141
as_ec_climate_location("kentville cda ns")
#> <ec_climate_location>
#> [1] KENTVILLE CDA NS 6375
Use case: if you are given a station name without a station number, what is the workflow to turn that into data? Can use the search* functions but that breaks down if there are >1 stations.