Skip to content
This repository has been archived by the owner on Jun 7, 2022. It is now read-only.

Commit

Permalink
Merge pull request #80 from ReagentX/develop
Browse files Browse the repository at this point in the history
Release/1.2.4
  • Loading branch information
ReagentX authored Mar 14, 2021
2 parents 2a9a16f + 0339bd1 commit b95d60e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 25 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# PurpleAir API

[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4540629.svg)](https://doi.org/10.5281/zenodo.4540629)

A Python 3.x module to turn data from the PurpleAir/ThingSpeak API into a Pandas DataFrame safely, with many utility methods and clear errors.

![Global Sensor Map with Celsius Scale](maps/sensor_map.png)
Expand Down Expand Up @@ -116,7 +118,7 @@ print(df.head())
Result:

```log
created_at PM1.0_CF_ATM_ug/m3 PM2.5_CF_ATM_ug/m3 PM10.0_CF_ATM_ug/m3 UptimeMinutes RSSI_dbm Pressure_hpa Blank PM2.5_CF_1_ug/m3
created_at PM1.0 (CF=1) ug/m3 PM2.5 (CF=1) ug/m3 PM10.0 (CF=1) ug/m3 UptimeMinutes RSSI_dbm Pressure_hpa Blank PM2.5 (CF=ATM) ug/m3
entry_id
1002561 2020-09-09 00:01:09+00:00 1.03 1.41 1.41 18136.0 0.01 982.25 NaN 1.41
1002562 2020-09-09 00:03:09+00:00 1.07 1.60 1.60 18136.0 0.01 982.18 NaN 1.60
Expand Down
18 changes: 9 additions & 9 deletions docs/api/channel_methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ The data is shaped like this:
}
```

## `get_historical(weeks_to_get: int, thingspeak_field: str, start_date: Optional[datetime] = None) -> pd.DataFrame`
## `get_historical(weeks_to_get: int, thingspeak_field: str, start_date: datetime = datetime.now()) -> pd.DataFrame`

Get data from the ThingSpeak API from field `thingspeak_field` one week at a time up to `weeks_to_get` weeks in the past.

Expand All @@ -131,11 +131,11 @@ Parent Primary:
* Timestamp of data posting to ThingSpeak (created by ThingSpeak)
* `entry_id`
* row number relative to all data Parent primary data (created by ThingSpeak)
* `PM1.0_CF_ATM_ug/m3`
* `PM1.0 (CF=1) ug/m3`
* mass concentration calculated from count data for particle sizes ~0.3um to ~1.0um for “atmospheric” particles (From Plantower 5003/1003)
* `PM2.5_CF_ATM_ug/m3`
* `PM2.5 (CF=1) ug/m3`
* mass concentration calculated from count data for particle sizes ~0.3um to ~2.5um for “atmospheric” particles (From Plantower 5003/1003)
* `PM10.0_CF_ATM_ug/m3`
* `PM10.0 (CF=1) ug/m3`
* mass concentration calculated from count data for particle sizes ~0.3um to ~10um for “atmospheric” particles (From Plantower 5003/1003)
* `UptimeMinutes`
* the amount time the unit CPU has been running since it was powered up (From ESP8266 WiFi chip)
Expand All @@ -145,7 +145,7 @@ Parent Primary:
* Temperature inside of the sensor housing in Fahrenheit. On average, this is 8F higher than ambient conditions. (From BME280)
* `Humidity_%`
* Relative humidity inside of the sensor housing as a percentage. On average, this is 4% lower than ambient conditions (From BME280)
* `PM2.5_CF_1_ug/m3`
* `PM2.5 (CF=ATM) ug/m3`
* mass concentration calculated from count data for particle sizes ~0.3um to ~2.5um for “standard” particles (From Plantower 5003/1003)

Parent Secondary:
Expand Down Expand Up @@ -177,11 +177,11 @@ Child Primary:
* Timestamp of data posting to ThingSpeak (created by ThingSpeak)
* `entry_id`
* row number relative to all data child primary data (created by ThingSpeak)
* `PM1.0_CF_ATM_ug/m3`
* `PM1.0 (CF=1) ug/m3`
* mass concentration calculated from count data for particle sizes ~0.3um to ~1.0um for “atmospheric” particles (From Plantower 5003/1003)
* `PM2.5_CF_ATM_ug/m3`
* `PM2.5 (CF=1) ug/m3`
* mass concentration calculated from count data for particle sizes ~0.3um to ~2.5um for “atmospheric” particles (From Plantower 5003/1003)
* `PM10.0_CF_ATM_ug/m3`
* `PM10.0 (CF=1) ug/m3`
* mass concentration calculated from count data for particle sizes ~0.3um to ~10um for “atmospheric” particles (From Plantower 5003/1003)
* `UptimeMinutes`
* the amount time the unit CPU has been running since it was powered up
Expand All @@ -192,7 +192,7 @@ Child Primary:
* `Blank`
* No Data
* Note: there appears to be some float data in this column
* `PM2.5_CF_1_ug/m3`
* `PM2.5 (CF=ATM) ug/m3`
* mass concentration calculated from count data for particle sizes ~0.3um to ~2.5um for “standard” particles (From Plantower 5003/1003)

Child Secondary:
Expand Down
28 changes: 14 additions & 14 deletions purpleair/api_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
PARENT_PRIMARY_COLS = {
'created_at': 'created_at',
'entry_id': 'entry_id',
'field1': 'PM1.0_CF_ATM_ug/m3',
'field2': 'PM2.5_CF_ATM_ug/m3',
'field3': 'PM10.0_CF_ATM_ug/m3',
'field1': 'PM1.0 (CF=1) ug/m3',
'field2': 'PM2.5 (CF=1) ug/m3',
'field3': 'PM10.0 (CF=1) ug/m3',
'field4': 'UptimeMinutes',
'field5': 'ADC',
'field6': 'Temperature_F',
'field7': 'Humidity_%',
'field8': 'PM2.5_CF_1_ug/m3',
'field8': 'PM2.5 (CF=ATM) ug/m3',
}

PARENT_SECONDARY_COLS = {
Expand All @@ -39,21 +39,21 @@
'field4': '2.5um/dl',
'field5': '5.0um/dl',
'field6': '10.0um/dl',
'field7': 'PM1.0_CF_1_ug/m3',
'field8': 'PM10.0_CF_1_ug/m3',
'field7': 'PM1.0 (CF=ATM) ug/m3',
'field8': 'PM10 (CF=ATM) ug/m3',
}

CHILD_PRIMARY_COLS = {
'created_at': 'created_at',
'entry_id': 'entry_id',
'field1': 'PM1.0_CF_ATM_ug/m3',
'field2': 'PM2.5_CF_ATM_ug/m3',
'field3': 'PM10.0_CF_ATM_ug/m3',
'field1': 'PM1.0 (CF=1) ug/m3',
'field2': 'PM2.5 (CF=1) ug/m3',
'field3': 'PM10.0 (CF=1) ug/m3',
'field4': 'UptimeMinutes',
'field5': 'RSSI_dbm',
'field6': 'Pressure_hpa',
'field7': 'Blank',
'field8': 'PM2.5_CF_1_ug/m3',
'field6': 'Atmospheric Pressure',
'field7': 'gas_sensor',
'field8': 'PM2.5 (CF=ATM) ug/m3',
}

CHILD_SECONDARY_COLS = {
Expand All @@ -65,6 +65,6 @@
'field4': '2.5um/dl',
'field5': '5.0um/dl',
'field6': '10.0um/dl',
'field7': 'PM1.0_CF_1_ug/m3',
'field8': 'PM10.0_CF_1_ug/m3'
'field7': 'PM1.0 (CF=ATM) ug/m3',
'field8': 'PM10 (CF=ATM) ug/m3'
}
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

setup(
name='purpleair',
version='1.2.3',
version='1.2.4',
description='Python API Client to get and transform PurpleAir data.',
long_description=LONG_DESCRIPTION,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit b95d60e

Please sign in to comment.