Skip to content

openeew/openeew-python

Repository files navigation

OpenEEW package for Python

https://travis-ci.org/grillo/openeew-python.svg?branch=master https://readthedocs.org/projects/openeew-python/badge/?version=latest

The OpenEEW package for Python contains a collection of tools for working with OpenEEW, including:

  • Downloading and analyzing accelerometer data
  • Real-time data processing
  • Detection algorithms

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:

Installation

The package can be installed using pip (for a suitable version of Python):

pip install openeew

Usage

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.

License

This package is distrubted under the Apache License, Version 2.0. See LICENSE.

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy