-
-
Save jessstringham/319ab3a98d5d35010e1ac870ae2fbff1 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
DATA_PATH = '.' | |
stations = { | |
filename.split('.')[0] | |
for filename in os.listdir(os.path.join(DATA_PATH, 'ghcnd_hcn')) | |
} | |
station_to_coord = {} | |
lats = [] | |
lngs = [] | |
with open(os.path.join(DATA_PATH, 'ghcnd-stations.txt')) as f: | |
for line in f: | |
columns = line.strip().split() | |
if columns[0] in stations: | |
_, lat, lng, elevation = columns[:4] | |
lats.append(float(lat)) | |
lngs.append(float(lng)) | |
m = Basemap(projection='lcc', resolution='l', | |
width=5E6, height=3E6, | |
lat_0=38.5, lon_0=-97,) | |
plt.figure(figsize=(12, 8)) | |
m.drawcoastlines() | |
plt.scatter(*m(lngs, lats)) | |
plt.tight_layout() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment