ambient-wx


Nameambient-wx JSON
Version 0.1.3 PyPI version JSON
download
home_pageNone
SummaryAPI Wrapper for the Ambient Weather Station API with meteorological units and pandas functionality as well
upload_time2024-07-17 21:24:48
maintainerNone
docs_urlNone
authorBarry Martin
requires_python<4.0,>=3.9
licenseMIT
keywords weather ambient weather
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Ambient Weather Station API Wrapper

There are a couple of great packages that do a great job but this package introduces units.
It also serves as a side-project for me. ☺️

This is currently a work in progress to get it in a package and with the proper tests and CI.

### Install

python 3.8 or greater is required

`pip install ambient_wx`

### Units

Units are set for these fields using the [pint](https://pint.readthedocs.io/en/stable/) python library:
* windspeedmph - mph
* windgustmph - mph
* maxdailygust - mph
* tempf - degF
* baromrelin - Hg
* baromabsin - Hg
* tempinf - degF
* hourlyrainin - inches
* dailyrainin - inches
* monthlyrainin - inches
* yearlyrainin - inches
* feelsLike - degF
* dewPoint - degF
* winddir - degrees
* winddir_avg10m - degrees
* humidity - percent
* humidityin - percent

### Setup the API object
```python
from ambient_wx import AmbientApi
api_key = "123"
app_key = "456"
api = AmbientApi(api_key, app_key)
```

### Get Devices
```python
from ambient_wx import WxDeviceCollection
devices = WxDeviceCollection(api)
devices.get_devices()
device = devices.devices[0] # first device
print(device.mac_addr)
```

### Get Device Obervations
```python
from ambient_wx import WxObservationCollection
# with a device object
obs = WxObservationCollection(api, device=device)

# or with a known device mac addr to skip an api call for a device
obs = WxObservationCollection(api, mac_addr="some_mac_addr")

# get the last 5 observations this populates obs.data as a 
# list of WxObservation objects
obs.get_observations(limit=5)

# iterate through observations
for o in obs.data:
    print(o.tempf, o.winddir, o.humidity)
```

### Get data for an end date
```python
obs = WxObservationCollection(api, device)
obs.get_observations(end_date=datetime(2024, 4, 25))

for o in obs.data:
    print(o.tempf, o.winddir, o.humidity)
```

### Perform Unit Conversions
```python
# convert deg F to deg C
degc = obs.data[0].tempf.to('degC') 
print(degc)
```

### Create pandas Dataframe from Observations
```python
df = obs.to_dataframe()
print(df)
```

### Write csv from Observations
```python
obs.write_csv("/some_path/my_observations.csv")
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "ambient-wx",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": "weather, ambient weather",
    "author": "Barry Martin",
    "author_email": "barry.martin@thepythongeek.com",
    "download_url": "https://files.pythonhosted.org/packages/14/69/44defbad8d3417d26e6f41e18211570a617add76aba9bbec6a98611018d3/ambient_wx-0.1.3.tar.gz",
    "platform": null,
    "description": "# Ambient Weather Station API Wrapper\n\nThere are a couple of great packages that do a great job but this package introduces units.\nIt also serves as a side-project for me. \u263a\ufe0f\n\nThis is currently a work in progress to get it in a package and with the proper tests and CI.\n\n### Install\n\npython 3.8 or greater is required\n\n`pip install ambient_wx`\n\n### Units\n\nUnits are set for these fields using the [pint](https://pint.readthedocs.io/en/stable/) python library:\n* windspeedmph - mph\n* windgustmph - mph\n* maxdailygust - mph\n* tempf - degF\n* baromrelin - Hg\n* baromabsin - Hg\n* tempinf - degF\n* hourlyrainin - inches\n* dailyrainin - inches\n* monthlyrainin - inches\n* yearlyrainin - inches\n* feelsLike - degF\n* dewPoint - degF\n* winddir - degrees\n* winddir_avg10m - degrees\n* humidity - percent\n* humidityin - percent\n\n### Setup the API object\n```python\nfrom ambient_wx import AmbientApi\napi_key = \"123\"\napp_key = \"456\"\napi = AmbientApi(api_key, app_key)\n```\n\n### Get Devices\n```python\nfrom ambient_wx import WxDeviceCollection\ndevices = WxDeviceCollection(api)\ndevices.get_devices()\ndevice = devices.devices[0] # first device\nprint(device.mac_addr)\n```\n\n### Get Device Obervations\n```python\nfrom ambient_wx import WxObservationCollection\n# with a device object\nobs = WxObservationCollection(api, device=device)\n\n# or with a known device mac addr to skip an api call for a device\nobs = WxObservationCollection(api, mac_addr=\"some_mac_addr\")\n\n# get the last 5 observations this populates obs.data as a \n# list of WxObservation objects\nobs.get_observations(limit=5)\n\n# iterate through observations\nfor o in obs.data:\n    print(o.tempf, o.winddir, o.humidity)\n```\n\n### Get data for an end date\n```python\nobs = WxObservationCollection(api, device)\nobs.get_observations(end_date=datetime(2024, 4, 25))\n\nfor o in obs.data:\n    print(o.tempf, o.winddir, o.humidity)\n```\n\n### Perform Unit Conversions\n```python\n# convert deg F to deg C\ndegc = obs.data[0].tempf.to('degC') \nprint(degc)\n```\n\n### Create pandas Dataframe from Observations\n```python\ndf = obs.to_dataframe()\nprint(df)\n```\n\n### Write csv from Observations\n```python\nobs.write_csv(\"/some_path/my_observations.csv\")\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "API Wrapper for the Ambient Weather Station API with meteorological units and pandas functionality as well",
    "version": "0.1.3",
    "project_urls": {
        "Homepage": "https://github.com/bvmcode/ambient_wx",
        "Issues": "https://github.com/bvmcode/ambient_wx/issues",
        "Source": "https://github.com/bvmcode/ambient_wx"
    },
    "split_keywords": [
        "weather",
        " ambient weather"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a9b9b245aacf1a93dfcfee677975e2ddf42001face0a8a4c4557b70c71ea79f8",
                "md5": "239ec8a7f56845a81bba46a5265a315c",
                "sha256": "69ad2ebae0b73e7072fd1be5fcce59ac684c6b633d7cdd4be55553ec7e9bfb72"
            },
            "downloads": -1,
            "filename": "ambient_wx-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "239ec8a7f56845a81bba46a5265a315c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 7935,
            "upload_time": "2024-07-17T21:24:47",
            "upload_time_iso_8601": "2024-07-17T21:24:47.619594Z",
            "url": "https://files.pythonhosted.org/packages/a9/b9/b245aacf1a93dfcfee677975e2ddf42001face0a8a4c4557b70c71ea79f8/ambient_wx-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "146944defbad8d3417d26e6f41e18211570a617add76aba9bbec6a98611018d3",
                "md5": "1ba84acf8c1958de089c932653b0723e",
                "sha256": "ffb1e88b15d29bda45c264e2c55c02686a6dfcb907f44a350e71af50986f07e1"
            },
            "downloads": -1,
            "filename": "ambient_wx-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "1ba84acf8c1958de089c932653b0723e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 7441,
            "upload_time": "2024-07-17T21:24:48",
            "upload_time_iso_8601": "2024-07-17T21:24:48.510032Z",
            "url": "https://files.pythonhosted.org/packages/14/69/44defbad8d3417d26e6f41e18211570a617add76aba9bbec6a98611018d3/ambient_wx-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-17 21:24:48",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "bvmcode",
    "github_project": "ambient_wx",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "ambient-wx"
}
        
Elapsed time: 0.52285s