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

Conexión con api y estado de estaciones

parent e7ee735d
No related branches found
No related tags found
No related merge requests found
Pipeline #2054 failed with stages
in 1 minute and 48 seconds
%% Cell type:markdown id: tags:
# Uso del API MakeSens
%% Cell type:markdown id: tags:
Instalar Librerias
%% Cell type:code id: tags:
```
#!pip install APIMakeSens
#!pip install tk
```
%% Cell type:markdown id: tags:
Cargar librería *MakeSens*
%% Cell type:code id: tags:
```
# Makesens
from MakeSens import MakeSens
# 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("evas.csv")
```
%% Cell type:markdown id: tags:
Definir rango de fechas para descarga
%% Cell type:code id: tags:
```
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')
```
%% Cell type:code id: tags:
```
for eva in estaciones["id"]:
data = MakeSens.download_data(eva, fechaInicio, fechaFin, 'h', token, None)
if data.empty:
print(eva, 'Offline')
else:
print(eva, 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
id,estado,institucion,url,contacto,medioContacto,comentarios
E2_00010,Sin montar,Yachay,,Mario Cosenza,Mattermost,"La estación meteorologíca llegó, pero aún no ha sido montada en Yachay."
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_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_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