Services ¶
The services represent the business-logic of “what” data to fetch for specific use-cases. Services require an underlying data source to perform the actual reading of data.
pems_data.services.stations.StationsService
¶
Manages fetching of station-related data.
Source code in pems_data/services/stations.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
|
data_source
property
¶
This service’s IDataSource instance.
imputation_detector_agg_5min
property
¶
Returns:
Name | Type | Description |
---|---|---|
value |
str
|
The identifier for the imputation detector 5min aggregation |
metadata_file
property
¶
Returns:
Name | Type | Description |
---|---|---|
value |
str
|
The identifier for the stations metadata file. |
__init__(data_source)
¶
Initialize a new StationsService.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_source
|
IDataSource
|
The data source responsible for fetching data for this service. |
required |
Source code in pems_data/services/stations.py
31 32 33 34 35 36 37 |
|
get_district_metadata(district_number)
¶
Loads metadata for all stations in the selected district from the data source.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
district_number
|
str
|
The number of the Caltrans district to load metadata for, e.g. |
required |
Returns:
Name | Type | Description |
---|---|---|
value |
DataFrame
|
The station’s data as a DataFrame. |
Source code in pems_data/services/stations.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
|
get_imputed_agg_5min(station_id)
¶
Loads imputed aggregate 5 minute data for a specific station from the data source.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
station_id
|
str
|
The identifier for the station/detector to load data, e.g. |
required |
Returns:
Name | Type | Description |
---|---|---|
value |
DataFrame
|
The station’s data as a DataFrame. |
Source code in pems_data/services/stations.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
|