Created
May 24, 2020 22:37
-
-
Save dyerrington/f7819c88b9e902a242437669f345021b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests, re | |
def test_station_data_availability(station_id): | |
for year in range(1960, 2020 + 1): | |
r = requests.get(f"https://www.ncei.noaa.gov/data/local-climatological-data/access/{year}/") | |
matches = re.search(r"href=\"([0-9]{6}" +str(station_id) + ".csv)", r.text) | |
if matches: | |
print(station_id, " data exists for ", year) | |
else: | |
print(station_id, " data not found for ", year) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment