diff --git a/apiMakeSens.ipynb b/apiMakeSens.ipynb index 9d31b350180698e7e1cd6c8b985a79ea900f5318..a9ab9bbc62c16d589c4df407996faea954c279b8 100644 --- a/apiMakeSens.ipynb +++ b/apiMakeSens.ipynb @@ -1,155 +1 @@ -{ - "nbformat": 4, - "nbformat_minor": 0, - "metadata": { - "colab": { - "provenance": [], - "collapsed_sections": [] - }, - "kernelspec": { - "name": "python3", - "display_name": "Python 3" - }, - "language_info": { - "name": "python" - } - }, - "cells": [ - { - "cell_type": "markdown", - "source": [ - "# Uso del API MakeSens" - ], - "metadata": { - "id": "wtWF1n8HOTFV" - } - }, - { - "cell_type": "markdown", - "source": [ - "Instalar Librerias" - ], - "metadata": { - "id": "vh3vxnBcOg1s" - } - }, - { - "cell_type": "code", - "source": [ - "#!pip install APIMakeSens\n", - "#!pip install tk" - ], - "metadata": { - "id": "2qUuqqUrOist" - }, - "execution_count": 1, - "outputs": [] - }, - { - "cell_type": "markdown", - "source": [ - "Cargar librerÃa *MakeSens*" - ], - "metadata": { - "id": "kqjOySK5OzWd" - } - }, - { - "cell_type": "code", - "source": [ - "# Makesens\n", - "from MakeSens import MakeSens\n", - "# Pandas \n", - "import pandas as pd \n", - "# datetime para manejo de fechas\n", - "import datetime\n", - "# pytz para manejo de zonas horarias\n", - "import pytz" - ], - "metadata": { - "id": "METaVqUqOPPp" - }, - "execution_count": 2, - "outputs": [] - }, - { - "cell_type": "markdown", - "source": [ - "Definir token y cargar listado de estaciones" - ], - "metadata": { - "id": "RMuW2nnqPFJd" - } - }, - { - "cell_type": "code", - "source": [ - "token = 'tokenUsr'\n", - "estaciones = pd.read_csv(\"evasLA-CoNGA.csv\")" - ], - "metadata": { - "id": "J8zPR6KYOZPh" - }, - "execution_count": 3, - "outputs": [] - }, - { - "cell_type": "markdown", - "source": [ - "Definir rango de fechas para descarga" - ], - "metadata": { - "id": "AHgUeh7F_-py" - } - }, - { - "cell_type": "code", - "source": [ - "fechaFin = datetime.datetime.now(pytz.timezone('America/Bogota')).strftime('%Y-%m-%d %H:%M:%S')\n", - "fechaInicio = (datetime.datetime.now(pytz.timezone('America/Bogota'))-datetime.timedelta(hours=1)).strftime('%Y-%m-%d %H:%M:%S')" - ], - "metadata": { - "id": "LulIK6c9_-GT" - }, - "execution_count": 4, - "outputs": [] - }, - { - "cell_type": "code", - "source": [ - "for eva in estaciones[\"id\"]:\n", - " data = MakeSens.download_data(eva, fechaInicio, fechaFin, 'h', token, None)\n", - " if data.empty:\n", - " print(eva, 'Offline')\n", - " else:\n", - " print(eva, data['temperatura'][0])" - ], - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "04N3QvHqRcJ2", - "outputId": "4d37f2df-91c3-4925-8540-deeaffb1ebca" - }, - "execution_count": 5, - "outputs": [ - { - "output_type": "stream", - "name": "stdout", - "text": [ - "DE2_00010 Offline\n", - "DE2_00011 Offline\n", - "DE2_00012 22.36809542857143\n", - "DE2_00013 Offline\n", - "DE2_00014 Offline\n", - "DE2_00015 Offline\n", - "DE2_00016 23.72797557142857\n", - "DE2_00017 16.2979185\n", - "DE2_00018 27.151353375\n", - "DE2_00019 Offline\n" - ] - } - ] - } - ] -} +{"metadata":{"colab":{"provenance":[],"collapsed_sections":[]},"kernelspec":{"name":"python3","display_name":"Python 3 (ipykernel)","language":"python"},"language_info":{"name":"python","version":"3.9.15","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"# Uso del API MakeSens","metadata":{"id":"wtWF1n8HOTFV"}},{"cell_type":"markdown","source":"Instalar Librerias","metadata":{"id":"vh3vxnBcOg1s"}},{"cell_type":"code","source":"#!pip install APIMakeSens\n#!pip install tk","metadata":{"id":"2qUuqqUrOist","trusted":true},"execution_count":1,"outputs":[]},{"cell_type":"markdown","source":"Cargar librerÃa *MakeSens*","metadata":{"id":"kqjOySK5OzWd"}},{"cell_type":"code","source":"# Makesens\nfrom MakeSens import MakeSens\n# Pandas \nimport pandas as pd \n# datetime para manejo de fechas\nimport datetime\n# pytz para manejo de zonas horarias\nimport pytz","metadata":{"id":"METaVqUqOPPp","trusted":true},"execution_count":2,"outputs":[]},{"cell_type":"markdown","source":"Definir token y cargar listado de estaciones","metadata":{"id":"RMuW2nnqPFJd"}},{"cell_type":"code","source":"estaciones = pd.read_csv(\"evasLA-CoNGA.csv\").set_index(\"id\")","metadata":{"id":"J8zPR6KYOZPh","trusted":true},"execution_count":12,"outputs":[]},{"cell_type":"markdown","source":"Definir rango de fechas para descarga","metadata":{"id":"AHgUeh7F_-py"}},{"cell_type":"code","source":"fechaFin = datetime.datetime.now(pytz.timezone('America/Bogota')).strftime('%Y-%m-%d %H:%M:%S')\nfechaInicio = (datetime.datetime.now(pytz.timezone('America/Bogota'))-datetime.timedelta(hours=240)).strftime('%Y-%m-%d %H:%M:%S')","metadata":{"id":"LulIK6c9_-GT","trusted":true},"execution_count":14,"outputs":[]},{"cell_type":"code","source":"for eva in estaciones.index:\n data = MakeSens.download_data(eva, fechaInicio, fechaFin, 'h')\n if data.empty:\n print(eva, estaciones.loc[eva]['institucion'], 'Offline')\n else:\n print(eva, estaciones.loc[eva]['institucion'], data['temperatura'][0])","metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"04N3QvHqRcJ2","outputId":"4d37f2df-91c3-4925-8540-deeaffb1ebca","trusted":true},"execution_count":26,"outputs":[{"name":"stdout","text":"E2_00010 Yachay Offline\nE2_00011 UAN Offline\nE2_00012 UIS 26.740791766666668\nE2_00013 UIS Offline\nE2_00014 UCV Offline\nE2_00015 UAN Offline\nE2_00016 USFQ Offline\nE2_00017 UNMSM Offline\nE2_00018 USB 26.138263899999995\nE2_00019 UNI Offline\n","output_type":"stream"}]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]} \ No newline at end of file diff --git a/evasLA-CoNGA.csv b/evasLA-CoNGA.csv index 069bb46d6d5dbbc8b5c260ed992855f0130d1282..ddf93c25cf06b6e987cd7f3f8bd58813f57d1998 100644 --- a/evasLA-CoNGA.csv +++ b/evasLA-CoNGA.csv @@ -3,9 +3,9 @@ E2_00010,Sin montar,Yachay,,Mario Cosenza,Mattermost,"La estación meteorologÃc E2_00011,Offline,UAN,https://makesens.aws.thinger.io/dashboards/DE2_00011?authorization=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJEYXNoYm9hcmRfREUyXzAwMDExIiwic3ZyIjoibWFrZXNlbnMuYXdzLnRoaW5nZXIuaW8iLCJ1c3IiOiJNYWtlU2VucyJ9.uc17JVghB7hsCdiMkqNpc1A_GFbPWYJluHUK43XrinM,Yohani Rodriguez,yohani.rodriguez@uan.edu.co,Problema de compatibilidad wifi - estación E2_00012,Online,UIS,https://eventos.redclara.net/event/1121/,Jennifer Grisales,Mattermost, E2_00013,Offline,UIS,https://makesens.aws.thinger.io/dashboards/DE2_00013?authorization=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJEYXNoYm9hcmRfREUyXzAwMDEzIiwic3ZyIjoibWFrZXNlbnMuYXdzLnRoaW5nZXIuaW8iLCJ1c3IiOiJNYWtlU2VucyJ9.dhTGRnuLBRVf8f_whId34_NrhIq8JrBGmetIgKV--A4,Jennifer Grisales,Mattermost,Deconexión de red -E2_00014,Online,UCV,https://makesens.aws.thinger.io/dashboards/DE2_00018?authorization=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJEYXNoYm9hcmRfREUyXzAwMDE4Iiwic3ZyIjoibWFrZXNlbnMuYXdzLnRoaW5nZXIuaW8iLCJ1c3IiOiJNYWtlU2VucyJ9.yLS1E47V58-8o-UybfCSOdejYxJfAJmlxFfe6IwhUko,José Antonio López RodrÃguez,Mattermost, +E2_00014,Online,USB,https://makesens.aws.thinger.io/dashboards/DE2_00018?authorization=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJEYXNoYm9hcmRfREUyXzAwMDE4Iiwic3ZyIjoibWFrZXNlbnMuYXdzLnRoaW5nZXIuaW8iLCJ1c3IiOiJNYWtlU2VucyJ9.yLS1E47V58-8o-UybfCSOdejYxJfAJmlxFfe6IwhUko,José Antonio López RodrÃguez,Mattermost, E2_00015,Offline,UAN,https://makesens.aws.thinger.io/dashboards/DE2_00015?authorization=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJEYXNoYm9hcmRfREUyXzAwMDE1Iiwic3ZyIjoibWFrZXNlbnMuYXdzLnRoaW5nZXIuaW8iLCJ1c3IiOiJNYWtlU2VucyJ9.1yGSWoyP-hi_GJSc2vVakJfJj7gyRgsaKFi99b7rJVc,Yohani Rodriguez,Mattermost,Problema de compatibilidad wifi - estación E2_00016,Online,USFQ,https://makesens.aws.thinger.io/dashboards/DE2_00016?authorization=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJEYXNoYm9hcmRfREUyXzAwMDE2Iiwic3ZyIjoibWFrZXNlbnMuYXdzLnRoaW5nZXIuaW8iLCJ1c3IiOiJNYWtlU2VucyJ9.cZt_x2GKIFoNOAMIJbLcuerJsn4YL56CWHxkwJ6AjSc,Dennis Cazar RamÃrez,Mattermost, E2_00017,,UNMSM,,Teofilo Vargas,Mattermost, -E2_00018,Offline,USB,https://makesens.aws.thinger.io/dashboards/DE2_00018?authorization=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJEYXNoYm9hcmRfREUyXzAwMDE4Iiwic3ZyIjoibWFrZXNlbnMuYXdzLnRoaW5nZXIuaW8iLCJ1c3IiOiJNYWtlU2VucyJ9.yLS1E47V58-8o-UybfCSOdejYxJfAJmlxFfe6IwhUko,Jorge Stephany,Mattermost, +E2_00018,Offline,UCV,https://makesens.aws.thinger.io/dashboards/DE2_00018?authorization=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJEYXNoYm9hcmRfREUyXzAwMDE4Iiwic3ZyIjoibWFrZXNlbnMuYXdzLnRoaW5nZXIuaW8iLCJ1c3IiOiJNYWtlU2VucyJ9.yLS1E47V58-8o-UybfCSOdejYxJfAJmlxFfe6IwhUko,Jorge Stephany,Mattermost, E2_00019,Offline,UNI,,Carlos Javier Solano,Mattermost,Cambios en red wifi