Filter-stations

Latest version: v0.6.1

Safety actively analyzes 623343 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 2

36.96301

Retrieving water level data
python
from filter_stations import water_level
wl = Water_level()
get water level data for the muringato gauging station
muringato_data = wl.water_level_data('muringato')
get water level data for the ewaso gauging station
ewaso_data = wl.water_level_data('ewaso')

0.6.1

The Water_level class is used to retrieve water level data and coordinates of gauging stations

Example:
Getting the coordinates
python
wl = Water_level()
coords = wl.coordinates('muringato')

0.5.5

Retrieve longitudes,latitudes for a list of station_sensor names and duplicated for stations with multiple sensors.

Parameters:
-----------
- station_sensor (list): List of station_sensor names.
- normalize (bool): If True, normalize the coordinates using MinMaxScaler to the range (0,1).

Returns:
-----------
- pd.DataFrame: DataFrame containing longitude and latitude coordinates for each station_sensor.

Usage:
-----------
To retrieve coordinates
python
start_date = '2023-01-01'
end_date = '2023-12-31'
country= 'KE'

get the precipitation data for the stations
ke_pr = filt.filter_pr(start_date=start_date, end_date=end_date,
country='Kenya').set_index('Date')

get the coordinates
xs = ret.get_coordinates(ke_pr.columns, normalize=True)

0.5.4

"""
Retrieves precipitation data from BigQuery based on specified parameters.

Parameters:
-----------
- start_date (str): Start date for data query.
- end_date (str): End date for data query.
- country (str): Country name for filtering stations.
- region (str): Region name for filtering stations.
- radius (str): Radius for stations within a specified region.
- multiple_stations (str): Comma-separated list of station IDs.
- station (str): Single station ID for data filtering.

Returns:
-----------
- pd.DataFrame: A Pandas DataFrame containing the filtered precipitation data.

Usage:
-----------
To get precipitation data for a specific date range:
python
fs = Filter(api_key, api_secret, maps_key) Create an instance of your class
start_date = '2021-01-01'
end_date = '2021-01-31'
pr_data = fs.filter_pr(start_date, end_date)

To get precipitation data for a specific date range and country:
python
fs = Filter(api_key, api_secret, maps_key) Create an instance of your class
start_date = '2021-01-01'
end_date = '2021-01-31'
country = 'Kenya'
pr_data = fs.filter_pr(start_date, end_date, country=country)

To get precipitation data for a specific date range and region:
python
fs = Filter(api_key, api_secret, maps_key) Create an instance of your class
start_date = '2021-01-01'
end_date = '2021-01-31'
region = 'Nairobi'
pr_data = fs.filter_pr(start_date, end_date, region=region)

To get precipitation data for a specific date range and region with a radius:
python
fs = Filter(api_key, api_secret, maps_key) Create an instance of your class
start_date = '2021-01-01'
end_date = '2021-01-31'
region = 'Nairobi'
radius = 100
pr_data = fs.filter_pr(start_date, end_date, region=region, radius=radius)

To get precipitation data for a specific date range and multiple stations:
python
fs = Filter(api_key, api_secret, maps_key) Create an instance of your class
start_date = '2021-01-01'
end_date = '2021-01-31'
multiple_stations = ['TA00001', 'TA00002', 'TA00003']
pr_data = fs.filter_pr(start_date, end_date, multiple_stations=multiple_stations)

To get precipitation data for a specific date range and a single station:
python
fs = Filter(api_key, api_secret, maps_key) Create an instance of your class
start_date = '2021-01-01'
end_date = '2021-01-31'
station = 'TA00001'
pr_data = fs.filter_pr(start_date, end_date, station=station)


"""

0.5.3

Include the ground truth data and maps configuration path fixed

0.5.1

Retrieves ground truth data for a specified date range.

Parameters:
-----------
- start_date (str): The start date for the report in 'yyyy-mm-dd' format.
- end_date (str, optional): The end date for the report in 'yyyy-mm-dd' format.
If not provided, only data for the start_date is returned.

Returns:
-----------
- pandas.DataFrame: A DataFrame containing ground truth data with columns 'startDate',
'station_sensor', 'description' and 'level'. The 'startDate' column is used as the index.

Raises:
-----------
- Exception: If there's an issue with the API request.

Usage:
-----------
To retrieve ground truth data for a specific date range:
python
start_date = '2023-01-01'
end_date = '2023-01-31'
report_data = ret.ground_truth(start_date, end_date)


To retrieve ground truth data for a specific date:

start_date = '2023-01-01'
report_data = ret.ground_truth(start_date)

Page 1 of 2

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.