<jupyter_start><jupyter_text>Mean Temperature  Total Precipitation<jupyter_code>from project_functions2 import load_and_process
hp,hf = load_and_process(path='../data/raw/Total_Precitation.csv')

#where hp is historic precipitation and fp is future precipitation<jupyter_output><empty_output><jupyter_text>Historical Data Analysis<jupyter_code>sns.set_theme(style = "ticks")

scatter_hp = sns.relplot(
    data=hp, kind="scatter",
    x="Year", y="Modeled Historical"
).set(title = "Modeled Historical Precipitation in Kelowna", ylabel="Annual Precipitation (mm)")<jupyter_output><empty_output><jupyter_text>The scatterplot of the historical precipitation data shows no clear trend in precipitation over time. There is a clear outlier in 1955 where precipitation was much lower than in other years. This may have been a year with severe drought. A regression plot is produced next to confirm this relationship between total precipitation and time.<jupyter_code>regression_hp = sns.regplot(data=hp, x="Year", y="Modeled Historical", marker = "+").set(title = "Modeled Historical Precipitation Regression in Kelowna", ylabel="Annual Precipitation (mm)")<jupyter_output><empty_output><jupyter_text>The regression analysis confirms that there is no clear relationship between total precipitation and time in Kelowna. The historical annual precipitation has been pretty variable over time. This variability will be explored further with the help of a distribution plot.<jupyter_code>distribution_hp = sns.displot(data=hp["Modeled Historical"], kde=True, bins=15).set(title = "Modeled Historical Precipitation in Kelowna (1950-2005)", xlabel="Annual Precipitation (mm)")<jupyter_output><empty_output><jupyter_text>This distribution plot highlights the variability of total precipitation in Kelowna from 1950-2005. This plot suggests that in the past, total annual precipitation was commonly around 340mm. Lower values were not commonly seen, and these could possible be years of severe drought. Higher values are quite likely, with some years receiving over 370mm of precipitation. However, a total annual precipitation much higher was not seen.   Projected Data Analysis<jupyter_code>plt.plot(fp["Year"], fp["RCP 2.6 Median"], label="RCP 2.6", linewidth=1)
plt.plot(fp["Year"], fp["RCP 4.5 Median"], label="RCP 4.5", linewidth=1)
plt.plot(fp["Year"], fp["RCP 8.5 Median"], label="RCP 8.5", linewidth=1)
plt.legend()
plt.xlabel("Year")
plt.ylabel("Annual Precipitation (mm)")
plt.title("Projected Precipitation in Kelowna", fontsize=16)<jupyter_output><empty_output><jupyter_text>This graph gives a rough idea of how annual precipitation is expected to change over time with the three different carbon dioxide emission scenarios. It generally suggests that annual precipitation increases over time. It is not a very good graph because it is difficult to understand how the three scenarios compare. This data will be explored in more depth below.<jupyter_code>line_fp26 = sns.relplot(
    data=fp, kind="line",
    x="Year", y="RCP 2.6 Median"
).set(title = "RCP 2.6 Projected Precipitation", xlabel="Year", ylabel= "Total Precipitation (mm/year)")<jupyter_output><empty_output><jupyter_text>The projected precipitation in Kelowna under the representative concentration pathway 2.6 is highly variable, but appears to be increasing very slightly over time. This suggests that decreasing carbon dioxide emissions to zero by 2100 could lead to an increase in annual precipitation in Kelowna. This extent of this increase will be explored in more depth using a distribution plot.<jupyter_code>distribution_fp26 = sns.displot(data=fp["RCP 2.6 Median"], kde=True, bins=15).set(title = "Projected Precipitation in Kelowna (2005-2100) with RCP2.6", xlabel="Annual Precipitation (mm)")<jupyter_output><empty_output><jupyter_text>When comparing this distribution to the distribution of the historical data, it can be seen that the annual precipitation is predicted to become significantly greater. Most years will receive between 360 and 380mm of precipitation, but some may receive over 400mm. This is much more than in the past.<jupyter_code>line_fp45 = sns.relplot(
    data=fp, kind="line",
    x="Year", y="RCP 4.5 Median"
).set(title = "RCP 4.5 Projected Precipitation", xlabel="Year", ylabel= "Annual Precipitation (mm)")<jupyter_output><empty_output><jupyter_text>Like for RCP 2.6, the RCP 4.5 carbon dioxide emissions scenario shows that annual precipitation is expected to be highly variable and increase a little over time. Another distirbution plot will be used to analyse how the precipitation values differ from the other RCPs and historical data.<jupyter_code>distribution_fp45 = sns.displot(data=fp["RCP 4.5 Median"], kde=True, bins=15).set(title = "Projected Precipitation in Kelowna (2005-2100) with RCP 4.5", xlabel="Annual Precipitation (mm)")<jupyter_output><empty_output><jupyter_text>The variability for RCP 4.5 is also very high. Most years will receive a total precipitation of 350 to 390mm.<jupyter_code>line_fp85 = sns.relplot(
    data=fp, kind="line",
    x="Year", y="RCP 8.5 Median"
).set(title = "RCP 8.5 Projected Precipitation", xlabel="Year", ylabel= "Annual Precipitation (mm)")<jupyter_output><empty_output><jupyter_text>This plot shows greater variability in projected precipitation for Kelowna, with values surpassing 400mm. The trend also shows a general increase in total precipitation over time, which is the same as the other RCPs. One last distribution plot will be used to analyse the spread in the projected values.<jupyter_code>distribution_fp85 = sns.displot(data=fp["RCP 8.5 Median"], kde=True, bins=15).set(title = "Projected Precipitation in Kelowna (2005-2100) with RCP 8.5", xlabel="Annual Precipitation (mm)")<jupyter_output><empty_output><jupyter_text>The distributon plot for RCP 8.5 is shows very high variability. However, the majority of the values lie bewtween 350 and 390mm.   ConclusionThis data analysis shows that historical precipitation for Kelowna was commonly around 340mm a year. This is projected to increase signficantly, exceeding 400mm for all carbon dioxide emission scenarios. Therefore, it does not appear that controlling carbon dioxide emissions has a significant impact on the amount of precipitation in the future. However, RCP 4.5 and RCP 8.5 show greater variability in total precipitation compared to RCP 2.6, suggesting that measures taken to reduce carbon dioxide emissions can potentially help reduce the high variability in precipitation in Kelowna in the future. These analyses will be refined to include the ranges of values and the RCPs will also be plotted on the same plot to allow for better comparison.  Hottest Day - <NAME><jupyter_code>from project_functions3 import load_and_process 
hist,proj=load_and_process('../data/raw/Hottest_Day.csv')<jupyter_output>/Users/pippy/Desktop/data301/project-group70-project/notebooks/project_functions3.py:6: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  data['Year'][x]=i<jupyter_text>Task 4 With the recent devastating heat waves in the Pacific Northwest, the realities of what our future climate will look like has become more apparent than ever. On our current path we can expect increased frequency and intensity of these dangerous heat waves. This data shows that the hottest day of the year will generally continue to increase in temperature regardless of what future steps we take due to the emissions already in our atmosphere. We have already gone past the point of no return when it comes to our climate. Although it is still important to low our emissions as out of the possible scenarios it is still better the reduce our emissions greatly compared to the scenarios where nothing is done.<jupyter_code>import matplotlib.pyplot as plt
proj.plot(kind='line', x='Year', y='RCP 8.5 Median')
plt.ylabel('Degree Celsius')<jupyter_output><empty_output><jupyter_text>This shows the hottest day temp contuiniting to rise. The hottest day temp peaks at about 44 degrees celsius.<jupyter_code>proj.plot(kind='line', x='Year', y='RCP 4.5 Median')
plt.ylabel('Degree Celsius')<jupyter_output><empty_output><jupyter_text>This shows the hottest day temp rising and then slightly plateauing. The hottest day temp peaks at about 40 degrees celsius.<jupyter_code>proj.plot(kind='line', x='Year', y='RCP 2.6 Median')
plt.ylabel('Degree Celsius')<jupyter_output><empty_output><jupyter_text>This shows the hottest day temp rising and then dipping. The hottest day temp peaks at about 38 degrees celsius. This shows our best case senario.<jupyter_code>proj.plot(kind='line', x='Year')
plt.ylabel('Degree Celsius')<jupyter_output><empty_output><jupyter_text>This graph shows all of the carbon emission scenarios comparatively. The statements regarding the previous graphs still hold true. The RCP 2.6 scenario remains the best case scenario<jupyter_code>hist.plot(kind='line', x='Year', y='Modeled Historical')
plt.ylabel('Degree Celsius')<jupyter_output><empty_output><jupyter_text>This graph shows a slight up tick with a lower range compared to the future senarios. The hottest day temp peaks at about 36.5 degrees celsius.  Mean Temperature- <NAME>  Task 4<jupyter_code>import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from project_function1 import load_and_process
path='../data/raw/Mean_Temperature.csv'
pastTemp,futureTemp=load_and_process(path)
#see if modeled historical mean temperature lies in between the other two
years=pastTemp['Year']
plt.plot(years,pastTemp['Modeled Historical'],label='Historical')
plt.plot(years,pastTemp["Historical Range (low)"],label='Range(low)')
plt.plot(years,pastTemp['Historical Range (high)'],label='Range(high)')
plt.legend()
plt.ylabel('Degree')
plt.xlabel('Year')<jupyter_output><empty_output><jupyter_text>In the graph, I put in the 3 lines to compare with the predicted range of the mean temperature and the actual historical mean temperature. After plotting the grpah for the mean temperature that was recorded in the past. The graph shows the mean temperature has been gradually increasing due to several reasons. The growth rate does not seem to be constant.<jupyter_code>#select only the median columns to have a better look
years=futureTemp['Year']
plt.plot(years,futureTemp['RCP 2.6 Median'],label='RCP 2.6')
plt.plot(years,futureTemp["RCP 4.5 Median"],label='RCP 4.5')
plt.plot(years,futureTemp['RCP 8.5 Median'],label='RCP 8.5')
plt.legend()
plt.ylabel('Degree')
plt.xlabel('Year')<jupyter_output><empty_output><jupyter_text>For RCP 2.6, the temperature increases to almost 2 degrees until 2100. For RCP 4.5, the temperature increases 2.5 degrees Celcius. Until 2100, the mean temperature for RCP 8.5 increases 8 degrees. There is something interesting while working with the graph of future prediction. I found that the growth rate is not the same for all RCPs. The larger the RCP the faster the temperature will grow.<jupyter_code>years=futureTemp['Year']
plt.plot(years,futureTemp['Comparison'],label='Comparison of RCP 8.5 and 2.6')
plt.legend()
plt.ylabel('Degree')
plt.xlabel('Year')<jupyter_output><empty_output><jupyter_text>The graph shows the difference of the temperature change between RCP 8.5 and RCP 2.6. We can see that with the predictions go further, the larger the difference between the mean temperature of RCP 8.5 and RCP 2.6 would be.<jupyter_code>fig, ax = plt.subplots(figsize=(20, 15))
f=futureTemp.iloc[::10, :]
years=f['Year']
x = np.arange(len(years))
ax.bar(x + 0, f['RCP 2.6 Median'], label='2.6', color='#0343df', width=0.25)
ax.bar(x + 0.25, f['RCP 4.5 Median'], label='4.5', color='#e50000', width=0.25)
ax.bar(x + 0.5, f['RCP 8.5 Median'], label='8.5', color='#ffff14', width=0.25)

ax.set_ylabel('Degrees')
ax.set_xlabel('Years')
ax.set_xticks(x)
ax.set_xticklabels(years.astype(str).values, rotation='vertical')
ax.legend()
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09170739789578328, 'fraction_numerical': 0.022947560268411896, 'mean_word_length': 6.224416517055655, 'pattern_counts': {'":': 0, '<': 86, '<?xml version=': 0, '>': 86, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '21', 'dir': 'jupyter-structured-clean-dedup', 'id': '538742', 'license': 'MIT', 'n_tokens_mistral': 3854, 'n_tokens_neox': 3481, 'n_words': 1354, 'path': 'notebooks/Task4.ipynb', 'repo_name': 'data301-2021-winter1/project-group70-project', 'size': '12081'}