<jupyter_start><jupyter_text>Current weather on NE coasthttps://darksky.net/dev/docs<jupyter_code>import urllib.request
import json
cities = {'Washington':'38.9,77.0',
            'Atlantic City':'39.4,74.4',
            'Philadelphia':'40.0,75.1',
            'New York':'40.7,73.9',
            'Nantucket':'41.3,70.1',
            'New Haven':'41.3,72.9',
            'New Bedford':'41.7,70.9',
            'Cape Cod':'41.8,70.5',
            'Boston': '42.4,71.1',
         }
api_str = 'https://api.darksky.net/forecast/817a1054cf8cf001633f17ede8d4ea77/'
weather = {}
for city in cities:
    weather[city] = json.loads(urllib.request.urlopen(api_str+cities[city]).read())
    
for city in weather:
    print("{:<15s}: {:7.4f} ({}), {} m/s, {}°F ({}°F)".format(city, 
                               weather[city]['currently']['precipIntensity'],
                               weather[city]['currently']['precipType'],
                               weather[city]['currently']['windSpeed'],
                               weather[city]['currently']['temperature'],
                               weather[city]['currently']['apparentTemperature'],
                              
                              ))
import pandas as pd
df_weather = pd.DataFrame({"city":[city for city in cities], 
                           "lat":[ float(loc.split(',')[0]) for loc in cities.values() ],
                           "long":[ float(loc.split(',')[1]) for loc in cities.values() ],
                           "intensity":[weather[city]['currently']['precipIntensity'] for city in cities],
                           "type":[weather[city]['currently']['precipType'] for city in cities],
                           "wind":[weather[city]['currently']['windSpeed'] for city in cities],
                           "temp":[weather[city]['currently']['temperature'] for city in cities],
                           "feelslike":[weather[city]['currently']['apparentTemperature'] for city in cities],
                          })
df_weather
import cartopy
import cartopy.crs as ccrs
import cartopy.io.shapereader as shpreader

import seaborn as sns
import matplotlib.pyplot as plt
cmap = sns.cubehelix_palette(start=2.8, rot=0.1, as_cmap=True)
fig = plt.figure(figsize=(24, 36))
ax = plt.axes([0, 0, 1, 1],
              projection=ccrs.PlateCarree())

ax.set_extent([-80, -66.5, 35, 45], ccrs.PlateCarree())
#ax.background_patch.set_visible(True)
#ax.outline_patch.set_visible(True)


shapename = 'admin_1_states_provinces_lakes_shp'
states_shp = shpreader.natural_earth(resolution='110m',
                                     category='cultural', name=shapename)

for state in shpreader.Reader(states_shp).geometries():
    facecolor = [0.9375, 0.9375, 0.859375]
    edgecolor = 'black'

    ax.add_geometries([state], ccrs.PlateCarree(),
                      facecolor=facecolor, edgecolor=edgecolor, alpha=0.5
                      )

# plot temperatures
plt.scatter((df_weather.long * -1).values, 
            df_weather.lat.values,
            c=df_weather.temp,
            cmap=cmap,
            s=800, 
            zorder=2,
            transform=ccrs.PlateCarree())
coords = zip((df_weather.long * -1).values, df_weather.lat.values)
for xy,s in zip(coords, df_weather.temp):
    plt.annotate(xy=xy, 
                 s=s,
                 fontsize=36,
                )
plt.savefig("Temperature in North-East states.png")
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15268941584731058, 'fraction_numerical': 0.038172353961827644, 'mean_word_length': 2.1704857928505956, 'pattern_counts': {'":': 8, '<': 6, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '166938', 'license': 'Apache-2.0', 'n_tokens_mistral': 1198, 'n_tokens_neox': 1072, 'n_words': 181, 'path': 'Jupyterlab/Weather data demo.ipynb', 'repo_name': 'ahalfpen727/-Downloads-Genomic-Analyses-w-Python', 'size': '3458'}