Instantly share code, notes, and snippets.

@jessstringham jessstringham/plot_stations.py Secret
Created Jun 11, 2018

Embed
What would you like to do?
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