diff --git a/module3/exo3/exercice.ipynb b/module3/exo3/exercice.ipynb index 26640204ca269373bf39bbd7b9af0bb6eaaf1258..187e9c3fcfe38587be0f1ba649dd01d5b8e49dfe 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]))" ] }, {