Update exercice.ipynb

parent f9c06e06
...@@ -213,7 +213,7 @@ ...@@ -213,7 +213,7 @@
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"[<matplotlib.lines.Line2D at 0x7f19740324e0>]" "[<matplotlib.lines.Line2D at 0x7f914de7d550>]"
] ]
}, },
"execution_count": 6, "execution_count": 6,
...@@ -269,7 +269,7 @@ ...@@ -269,7 +269,7 @@
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"[<matplotlib.lines.Line2D at 0x7f1973f6d898>]" "[<matplotlib.lines.Line2D at 0x7f914ddb9908>]"
] ]
}, },
"execution_count": 7, "execution_count": 7,
...@@ -315,7 +315,7 @@ ...@@ -315,7 +315,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 15, "execution_count": 8,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
...@@ -457,20 +457,20 @@ ...@@ -457,20 +457,20 @@
], ],
"source": [ "source": [
"amp_days = all_peaks_sorted[\"date\"][:-1]-all_peaks_sorted[\"date\"].iloc[0]\n", "amp_days = all_peaks_sorted[\"date\"][:-1]-all_peaks_sorted[\"date\"].iloc[0]\n",
"amp_fit = np.polyfit(amp_days.dt.days,amplitude,deg=1)\n", "amp_fit = np.polyfit(amp_days.dt.days,amplitude,deg=1)"
"amp_fit"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 12, "execution_count": 20,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"The amplitude between seasonal CO2 concentration oscillations is growing at a pace of 0.024 ppm of CO2 per year\n" "The amplitude between seasonal CO2 concentration oscillations is growing at a pace of 0.024 ppm of CO2 per year,\n",
"with a seasonal variation (peak to peak) of around 6.694 ppm in 1958-04-05 00:00:00 to 8.220 ppm in 2023-07-01 00:00:00 \n"
] ]
}, },
{ {
...@@ -490,8 +490,10 @@ ...@@ -490,8 +490,10 @@
"plt.plot(all_peaks_sorted[\"date\"][:-1],amplitude)\n", "plt.plot(all_peaks_sorted[\"date\"][:-1],amplitude)\n",
"plt.title(\"Amplitude in the CO2 concentration between seasonal peaks\")\n", "plt.title(\"Amplitude in the CO2 concentration between seasonal peaks\")\n",
"plt.ylabel(\"CO2 concentration [ppm]\")\n", "plt.ylabel(\"CO2 concentration [ppm]\")\n",
"plt.plot(all_peaks_sorted[\"date\"][:-1],amp_days.dt.days.multiply(amp_fit[0])+amp_fit[1])\n", "amp_poly = amp_days.dt.days.multiply(amp_fit[0])+amp_fit[1]\n",
"print(\"The amplitude between seasonal CO2 concentration oscillations is growing at a pace of {0:.3f} ppm of CO2 per year\".format(365*amp_fit[0]))" "plt.plot(all_peaks_sorted[\"date\"][:-1],amp_poly)\n",
"print(\"The amplitude between seasonal CO2 concentration oscillations is growing at a pace of {0:.3f} ppm of CO2 per year,\".format(365*amp_fit[0]))\n",
"print(\"with a seasonal variation (peak to peak) of around {0:.3f} ppm in {1} to {2:.3f} ppm in {3} \".format(amp_poly.iloc[0],data[\"date\"][0],amp_poly.iloc[-1],data[\"date\"].iloc[-1]))"
] ]
}, },
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment