OpenEEW package for Python |
---|
The OpenEEW package for Python contains a collection of tools for working with OpenEEW, including: |
* Downloading and analyzing accelerometer data |
* Real-time data processing |
|
Currently it provides a client to simplify downloading data held as an AWS Public Dataset. See here for information about how data is organized. |
More features will be coming soon. |
Some additional resources: |
* Package documentation |
|
Installation |
The package can be installed using pip
(for a suitable version of Python):
pip install openeew
Here is an example of how the package can be used to download data for a chosen date range.
First import the AwsDataClient
class:
from openeew.data.aws import AwsDataClient
We initialize a data client object by specifying the required country, either mx
for Mexico or cl
for Chile:
data_client = AwsDataClient('mx')
To get a list of current devices:
devices = data_client.get_current_devices()
To get data for a specific (UTC) date range, first specify the start and end dates:
start_date_utc = '2018-02-16 23:39:00'
end_date_utc = '2018-02-16 23:42:00'
Then call the get_filtered_records
method:
records = data_client.get_filtered_records(
start_date_utc,
end_date_utc
)
We can also get the data as a pandas.DataFrame:
from openeew.data.df import get_df_from_records
records_df = get_df_from_records(records)
It is also possible to specify a list of device IDs:
records = data_client.get_filtered_records(
start_date_utc,
end_date_utc,
['001', '008'] # optional list of device IDs
)
A single device ID can be passed as a string:
records = data_client.get_filtered_records(
start_date_utc,
end_date_utc,
'001' # optional single device ID
)
We can change the country if we want. So if we now want to look at Chile data:
data_client.country_code = 'cl'
Contributing =========== This project welcomes contributions. See CONTRIBUTING.rst for more information.
This package is distrubted under the Apache License, Version 2.0. See LICENSE.