Making it easier to navigate and clean station data
Project description
filter_stations
- Import the library and load the api Key to use it
from filterstations import Filter, Interactive_maps
# Retrieve the apiKey and apiSecret from a config.json file
import json
# Authentication
with open('../bson/config.json') as f:
conf = json.load(f)
apiKey = conf['apiKey']
apiSecret = conf['apiSecret']
Usage
fs = Filter(apiKey, apiSecret)
- getStationsInfo(station=None, multipleStations=[], countrycode=None)
station returns the information for a particular station
multipleStations - pass in a list of the stations. return a dataframe with the particular stations
countrycode - returns a dataframe of the stations in the particular region
returns stations information based on the parameters passed
- filterStations(address, distance, startDate=None, endDate=None, csvfile='KEcheck3.csv')
address - returns a dataframe of the stations and their clog flags in that particular region
distance - the distance desired to draw a radius from a particular region
startDate & endDate - the duration desired
csvfile - a file containing data of the stations in the format Date, station_precipitation, station_clogFlag
returns a dataframe of the filter
- filterStationsList(address, distance=100)
address - desired region
distance - radius of how far from the addres in kilometres
returns a list of the stations within the specified region
- k_neighbours(station, number=5)
station - the target station
number - number of neighbours desired
returns a dictionary of the stations from the closest distance in kilometres
Interacting with the data from the maps
maps = Interactive_maps(apiKey, apiSecret)
-
The maps functions are designed to work on jupyter notebooks
-
draw_map(map_center) Given the map center returns the map of the whole TAHMO stations network
-
create_animation(data, valid_sensors, day=100, T=10, interval=500)
data - The dataframe containing the dat
valid_sensors - the columns to filter from the data
day - the rows to choose from the data
T - the range to change the animation
returns an animated matrix of the data
- get_map(subset1, subset2, start_date=None, end_date=None, data_values=False, csv_file='KEcheck3.csv', min_zoom=8, max_zoom=11, width=850, height=850)
Subset1 - a list of the stations
subset2 - a second list of stations
Given two lists, this can be the valid sensors and the clogged sensors or subset1 can be a list of the entire map then subset2 the specific region chosen returns a map with blue being subset1 and red subset2
To get the values of the stations for the subset on click, set the data_values to be true and choose a specific start and end date
width & height - the size of the popup on click
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for filter_stations-0.1.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 425b04b8a07c2bc15d11ee7afce94c4edf3fb078b80fe2b26f968f7e2ded42db |
|
MD5 | 5e6f1fbd816e3faede26c75d30aca56b |
|
BLAKE2b-256 | 559fdc923e8442df3c7366e522e37259b3f5186a5f8cb6961418d606fa6d6db2 |