ookla_files = list_ookla_files()
assert ookla_files.get(OoklaFile("fixed", "2021", "2"), None) is not None
download_ookla_file
[source]
download_ookla_file
(type_
:str
,year
:str
,quarter
:str
,directory
:str
='data/'
,overwrite
:bool
=False
,show_progress
=True
,chunksize
=8192
,reporthook
=None
)
Download ookla file to path
Type | Default | Details | |
---|---|---|---|
type_ |
str |
Internet connection type: 'fixed' or 'mobile' | |
year |
str |
Year (e.g. '2020') | |
quarter |
str |
Quarter (valid values: '1','2','3','4') | |
directory |
str |
data/ |
Download directory |
overwrite |
bool |
False |
Overwrite if existing |
show_progress |
bool |
True |
show progres bar |
chunksize |
int |
8192 |
Download chunksize |
reporthook |
None |
Use custom progress bar |
parallel_download
[source]
parallel_download
(item
)
download_ookla_parallel
[source]
download_ookla_parallel
(num_expected_ookla_files
,type_
,year
,directory
,overwrite
,show_progress
,chunksize
,reporthook
)
download_ookla_year_data
[source]
download_ookla_year_data
(type_
,year
,cache_dir
,use_cache
=True
,show_progress
=True
,chunksize
=8192
,reporthook
=None
)
Download ookla data for a specifed type (fixed or mobile) and year. Data for all 4 quarters will be downloaded.
assert lookup_ookla_file("2021-04-01_performance_fixed_tiles.parquet") == OoklaFile(
"fixed", "2021", "2"
)
compute_datakey
[source]
compute_datakey
(aoi_bounds
,type_
,year
,return_geometry
)
write_ookla_metajson
[source]
write_ookla_metajson
(cache_dir
,data_key
,total_bounds
,type_
,year
,return_geometry
)
class
OoklaDataManager
[source]
OoklaDataManager
(cache_dir
='~/.cache/geowrangler'
)
An instance of this class provides convenience functoins for loading and caching Ookla data
OoklaDataManager.reinitialize_processed_cache
[source]
OoklaDataManager.reinitialize_processed_cache
()
Reinitialize processed_cache_dir to start over from scratch.
OoklaDataManager.reinitialize_aggregated_cache
[source]
OoklaDataManager.reinitialize_aggregated_cache
()
Reinitialize aggregated_cache_dir to start over from scratch.
OoklaDataManager.load_type_year_data
[source]
OoklaDataManager.load_type_year_data
(aoi
:GeoDataFrame
,type_
:str
,year
:str
,use_cache
=True
,return_geometry
=False
,show_progress
=True
,chunksize
=8192
,reporthook
=None
)
Load Ookla data across all quarters for a specified aoi, type (fixed, mobile) and year
Type | Default | Details | |
---|---|---|---|
aoi |
GeoDataFrame |
area of interest | |
type_ |
str |
ookla data type: fixed or mobile | |
year |
str |
year | |
use_cache |
bool |
True |
use cache dir |
return_geometry |
bool |
False |
include geometry in returned values |
show_progress |
bool |
True |
display progress bar |
chunksize |
int |
8192 |
download buffer size |
reporthook |
None |
custom progress bar |
OoklaDataManager.aggregate_ookla_features
[source]
OoklaDataManager.aggregate_ookla_features
(aoi
:GeoDataFrame
,type_
:str
,year
:str
,use_cache
=True
,return_geometry
=False
,output_crs
='epsg:4326'
,aggregations
:Dict
[str
,typing.Any
]={'mean_avg_d_kbps': ('avg_d_kbps', 'mean'), 'mean_avg_u_kbps': ('avg_u_kbps', 'mean'), 'mean_avg_lat_ms': ('avg_lat_ms', 'mean'), 'mean_num_tests': ('tests', 'mean'), 'mean_num_devices': ('devices', 'mean')}
,show_progress
=True
,chunksize
=8192
,reporthook
=None
)
Generates yearly aggregate features for the AOI based on Ookla data for a given type (fixed, mobile) and year.
Type | Default | Details | |
---|---|---|---|
aoi |
GeoDataFrame |
Area of interest | |
type_ |
str |
Ookla speed type: 'fixedor mobile` |
|
year |
str |
Year to aggregate (over 4 quarters) | |
use_cache |
bool |
True |
Use cached data in cache dir as specified in ookla_data_manager |
return_geometry |
bool |
False |
Save aggregated data as geojson |
output_crs |
str |
epsg:4326 |
crs to use in creating aggregated geodataframe |
aggregations |
typing.Dict[str, typing.Any] |
(mean_avg_d_kbps, mean_avg_u_kbps, mean_avg_lat_ms, mean_num_tests, mean_num_devices) |
Aggregation functions on ookla data (see https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.agg.html) |
show_progress |
bool |
True |
display progress bar |
chunksize |
int |
8192 |
download buffer size |
reporthook |
None |
custom progress bar |