You need to sign in or sign up before continuing.

hubeau R

parent 73337e9e
...@@ -42,9 +42,74 @@ ...@@ -42,9 +42,74 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "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", "cell_type": "code",
"execution_count": null, "execution_count": null,
...@@ -55,21 +120,17 @@ ...@@ -55,21 +120,17 @@
], ],
"metadata": { "metadata": {
"kernelspec": { "kernelspec": {
"display_name": "Python 3", "display_name": "R",
"language": "python", "language": "R",
"name": "python3" "name": "ir"
}, },
"language_info": { "language_info": {
"codemirror_mode": { "codemirror_mode": "r",
"name": "ipython", "file_extension": ".r",
"version": 3 "mimetype": "text/x-r-source",
}, "name": "R",
"file_extension": ".py", "pygments_lexer": "r",
"mimetype": "text/x-python", "version": "3.4.1"
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.4"
} }
}, },
"nbformat": 4, "nbformat": 4,
......
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