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
ax = plt.axes(projection=ccrs.PlateCarree()) | |
# get country centroids | |
ax.set_extent([lon[0] - 1, lon[1] + 1, lat[0] - 1, lat[1] + 1]) | |
for key, cn in zip(c.keys(),c.values()): | |
ax.add_geometries(cn.geometry, | |
crs=ccrs.PlateCarree(), | |
edgecolor="grey", | |
facecolor="whitesmoke", |
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
Dim i, j, lr2 As Integer | |
Dim rg1, rg2 As Range | |
Dim k As Long | |
'Loop through each row of ProjectTasksTracker sheet except the header row | |
For i = 2 To lr1 | |
'Check if the update column is not empty in ProjectTasksTracker sheet. | |
'Proceed if not empty | |
If ws1.Cells(i, 6).Value <> "" Then |
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 os, json, requests | |
#all sky surface shortwave downward irradiance | |
radiation_parameter = "ALLSKY_SFC_SW_DWN" | |
#url for irradiance | |
base_url = r"https://power.larc.nasa.gov/api/temporal/hourly/point?parameters=ALLSKY_SFC_SW_DWN&community=RE&time-standard=UTC&longitude={longitude}&latitude={latitude}&format=JSON&start=2020&end=2020" | |
rad_data = [] |
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
rescale = lambda y: (y - np.min(y)) / (np.max(y) - np.min(y)) | |
fig, ax1 = plt.subplots() | |
x = df_temp.index.tolist() | |
y = df_temp["mean"].values.tolist() | |
ax1.bar(x, y, color = my_cmap(rescale(y)), width = 0.8) | |
ax1.set_ylabel("Temperature anomaly \n relative to 1951-80 mean (°C)", color = "red") | |
ax1.tick_params(axis='y', color='red', labelcolor='red') |
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
gases = ["CO$_2$", "CH$_4$", "N$_2$O", "F-gases"] | |
warming_potential = [1, 25, 300, 1000] | |
text_height = [i*1.2 for i in warming_potential] | |
text = ["1", "25", "300", "1000+"] | |
volume = [74.4, 17.3, 6.2, 2.1] | |
colors = ["brown", "darkslategray", "darkgray", "purple"] | |
fig, (ax1, ax2) = plt.subplots(1, 2) |
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
fig, ax = plt.subplots() | |
df["Annual Mean"].plot(ax = ax, c = "black", marker = "s") | |
df["Lowess Smoothing"].plot(ax = ax, c = "red") | |
x = df.index.tolist() | |
y = df["Annual Mean"].tolist() | |
# Define the 95% confidence interval | |
ci = np.mean(y) + 1.96 * np.std(y) / np.sqrt(len(y)) | |
plt.fill_between(x, y-ci, y+ci, |
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
anomaly = df["Annual Mean"] | |
fig = plt.figure(figsize = (10, 1.5)) | |
ax = fig.add_axes([0, 0, 1, 1]) | |
#turn the x and y-axis off | |
ax.set_axis_off() | |
#create a collection with a rectangle for each year | |
col = PatchCollection([ |
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 folium | |
folium_coordinates = [] | |
for x,y in coordinates: | |
folium_coordinates.append([y,x]) | |
route = [] | |
for stop in cycle: | |
route.append(folium_coordinates[stop]) | |
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 networkx as nx | |
import matplotlib.pyplot as plt | |
cities = ["Berlin","Dusseldorf","Hamburg","Munich","Berlin"] | |
def make_tsp_tree(cities): | |
""" | |
Create all Hamilton paths from start to end city from a list of cities. | |
Creates a directed prefix tree from a list of the created paths. | |
Remove the root node and nil node. |
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
fig = go.Figure() | |
fig.add_trace(go.Waterfall(x = [["Initial","Short-term measure","Short-term measure", | |
"Short-term measure","Short-term measure","Short-term measure", | |
"Intermediate", "Long-term measure","Long-term measure", | |
"Long-term measure","Final"], | |
df["Values"]], | |
y = df["kWh"], | |
measure = df["measure"].tolist(), | |
base = 0, #by default |
NewerOlder