Skip to content
Snippets Groups Projects
Commit 5fc121c1 authored by Alexander Martínez Méndez's avatar Alexander Martínez Méndez
Browse files

Cambios para nueva versión del API

parent cc239504
No related branches found
No related tags found
1 merge request!1Cambios para nueva versión del API
Pipeline #2071 failed with stages
in 2 minutes and 43 seconds
%% Cell type:markdown id: tags:
# Uso del API MakeSens
%% Cell type:markdown id: tags:
Instalar Librerias
%% Cell type:code id: tags:
```
``` python
#!pip install APIMakeSens
#!pip install tk
```
%% Cell type:markdown id: tags:
Cargar librería *MakeSens*
%% Cell type:code id: tags:
```
``` python
# Makesens
from MakeSens import MakeSens
# Pandas
import pandas as pd
# Pandas
import pandas as pd
# datetime para manejo de fechas
import datetime
# pytz para manejo de zonas horarias
import pytz
```
%% Cell type:markdown id: tags:
Definir token y cargar listado de estaciones
%% Cell type:code id: tags:
```
token = 'tokenUsr'
estaciones = pd.read_csv("evasLA-CoNGA.csv")
``` python
estaciones = pd.read_csv("evasLA-CoNGA.csv").set_index("id")
```
%% Cell type:markdown id: tags:
Definir rango de fechas para descarga
%% Cell type:code id: tags:
```
``` python
fechaFin = datetime.datetime.now(pytz.timezone('America/Bogota')).strftime('%Y-%m-%d %H:%M:%S')
fechaInicio = (datetime.datetime.now(pytz.timezone('America/Bogota'))-datetime.timedelta(hours=1)).strftime('%Y-%m-%d %H:%M:%S')
fechaInicio = (datetime.datetime.now(pytz.timezone('America/Bogota'))-datetime.timedelta(hours=240)).strftime('%Y-%m-%d %H:%M:%S')
```
%% Cell type:code id: tags:
```
for eva in estaciones["id"]:
data = MakeSens.download_data(eva, fechaInicio, fechaFin, 'h', token, None)
``` python
for eva in estaciones.index:
data = MakeSens.download_data(eva, fechaInicio, fechaFin, 'h')
if data.empty:
print(eva, 'Offline')
print(eva, estaciones.loc[eva]['institucion'], 'Offline')
else:
print(eva, data['temperatura'][0])
print(eva, estaciones.loc[eva]['institucion'], data['temperatura'][0])
```
%% Output
DE2_00010 Offline
DE2_00011 Offline
DE2_00012 22.36809542857143
DE2_00013 Offline
DE2_00014 Offline
DE2_00015 Offline
DE2_00016 23.72797557142857
DE2_00017 16.2979185
DE2_00018 27.151353375
DE2_00019 Offline
E2_00010 Yachay Offline
E2_00011 UAN Offline
E2_00012 UIS 26.740791766666668
E2_00013 UIS Offline
E2_00014 UCV Offline
E2_00015 UAN Offline
E2_00016 USFQ Offline
E2_00017 UNMSM Offline
E2_00018 USB 26.138263899999995
E2_00019 UNI Offline
%% Cell type:code id: tags:
``` python
```
......
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment