From 229dc71b84d0a1bc6da8454c137fc5337aa49daf Mon Sep 17 00:00:00 2001 From: 30a25558637cb46af376f3f831fa6cec <30a25558637cb46af376f3f831fa6cec@app-learninglab.inria.fr> Date: Tue, 19 May 2020 14:32:06 +0000 Subject: [PATCH] hubeau R --- module2/exo1/toy_notebook_fr.ipynb | 89 +++++++++++++++++++++++++----- 1 file changed, 75 insertions(+), 14 deletions(-) diff --git a/module2/exo1/toy_notebook_fr.ipynb b/module2/exo1/toy_notebook_fr.ipynb index d9e4032..fb8816c 100644 --- a/module2/exo1/toy_notebook_fr.ipynb +++ b/module2/exo1/toy_notebook_fr.ipynb @@ -42,9 +42,74 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "#Titre" + "# Titre" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Titre 2" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "ename": "ERROR", + "evalue": "Error in read.json(\"https://hubeau.eaufrance.fr/api/vbeta/hydrometrie/observations_tr.csv?code_entite=U472002001&size=20000&grandeur_hydro=H&date_debut_obs=2018-11-19&fields=date_obs,resultat_obs\"): could not find function \"read.json\"\n", + "output_type": "error", + "traceback": [ + "Error in read.json(\"https://hubeau.eaufrance.fr/api/vbeta/hydrometrie/observations_tr.csv?code_entite=U472002001&size=20000&grandeur_hydro=H&date_debut_obs=2018-11-19&fields=date_obs,resultat_obs\"): could not find function \"read.json\"\nTraceback:\n" + ] + } + ], + "source": [ + "# Hub'eau - API Hydrométrie Temps Réel\n", + "#---------------------------------------------------------------------------\n", + "\n", + "# Chargement des paquets --------------------------------------------------\n", + "require(ggplot2)\n", + "require(jsonlite)\n", + "\n", + "# Appel des data\n", + "NPstation<-read.json(\"https://hubeau.eaufrance.fr/api/vbeta/hydrometrie/observations_tr.csv?code_entite=U472002001&size=20000&grandeur_hydro=H&date_debut_obs=2018-11-19&fields=date_obs,resultat_obs\")\n", + "#NPstation$date_obs<-as.Date(NPstation$date_obs)\n", + "NPstation$date_obs<-strptime(NPstation$date_obs, format=\"%d/%m/%Y %H:%M\")\n", + "NPstation$resultat_obs<-as.numeric(NPstation$resultat_obs)\n", + "\n", + "# Appel de ggplot et print du plot\n", + "p<-ggplot(NPstation)+geom_path(aes(x=date_obs, y=resultat_obs))\n", + "p<-p+theme_bw()+labs(x='',y='m NGF', title='La Saône à Lyon [Pont La Feuillée]')+guides(color='none')+scale_x_date(date_breaks = \"1 day\", date_labels = \"%Y\")\n", + "print(p)\n", + "\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, { "cell_type": "code", "execution_count": null, @@ -55,21 +120,17 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" + "display_name": "R", + "language": "R", + "name": "ir" }, "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.6.4" + "codemirror_mode": "r", + "file_extension": ".r", + "mimetype": "text/x-r-source", + "name": "R", + "pygments_lexer": "r", + "version": "3.4.1" } }, "nbformat": 4, -- 2.18.1