From 8307b8d15329a706ecd26ea00f62f4e455a7ad77 Mon Sep 17 00:00:00 2001 From: 0f6de7c698c3859424c5f05b941261d9 <0f6de7c698c3859424c5f05b941261d9@app-learninglab.inria.fr> Date: Wed, 18 Oct 2023 07:54:43 +0000 Subject: [PATCH] Update exercice.ipynb --- module3/exo3/exercice.ipynb | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/module3/exo3/exercice.ipynb b/module3/exo3/exercice.ipynb index 2664020..187e9c3 100644 --- a/module3/exo3/exercice.ipynb +++ b/module3/exo3/exercice.ipynb @@ -213,7 +213,7 @@ { "data": { "text/plain": [ - "[]" + "[]" ] }, "execution_count": 6, @@ -269,7 +269,7 @@ { "data": { "text/plain": [ - "[]" + "[]" ] }, "execution_count": 7, @@ -315,7 +315,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -457,20 +457,20 @@ ], "source": [ "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" + "amp_fit = np.polyfit(amp_days.dt.days,amplitude,deg=1)" ] }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 20, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "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 @@ "plt.plot(all_peaks_sorted[\"date\"][:-1],amplitude)\n", "plt.title(\"Amplitude in the CO2 concentration between seasonal peaks\")\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", - "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]))" + "amp_poly = amp_days.dt.days.multiply(amp_fit[0])+amp_fit[1]\n", + "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]))" ] }, { -- 2.18.1