diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-05-15 05:51:57 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-05-15 05:51:57 +0000 |
| commit | 7167c53cb73d94c3960329267b7135b5fc2547c3 (patch) | |
| tree | c4775e89552a0a12403a84c91457be90877e4b3f | |
| parent | 3ee111da10b3328dcfd9f7ab2447a38401befdb2 (diff) | |
automatic import of python-niluclient
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-niluclient.spec | 336 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 338 insertions, 0 deletions
@@ -0,0 +1 @@ +/niluclient-0.1.2.tar.gz diff --git a/python-niluclient.spec b/python-niluclient.spec new file mode 100644 index 0000000..fedee73 --- /dev/null +++ b/python-niluclient.spec @@ -0,0 +1,336 @@ +%global _empty_manifest_terminate_build 0 +Name: python-niluclient +Version: 0.1.2 +Release: 1 +Summary: An API client for getting pollution data from NILU sensor stations in Norway. +License: MIT +URL: https://github.com/hfurubotten/niluclient +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/80/23/1e1f75cf22d509a9806a717dc8469046a099bcb24a73a4dc9f5b411eff7c/niluclient-0.1.2.tar.gz +BuildArch: noarch + + +%description +# niluclient +Python client for getting air pollution data from NILU sensor stations in Norway. +The package comes with clients that can fetch and cache data from nilus api. + +[![Buy me a coffee][buymeacoffee-shield]][buymeacoffee] + + +## Acknowledgements +According to the [api documentation][api-nilu-no] from nilu.no and luftkvalitet.info, +when using data fetched through this client an acknowledgement to both +nilu.no and luftkvalitet.info needs to be included. + +## Usage + +Finding all station in an area: +```python +import niluclient as nilu + +stations = nilu.lookup_stations_in_area('Bergen') +``` + +Finding all stations and sensor reading within 20 km from a location: +```python +import niluclient as nilu + +client = nilu.create_location_client(60.123456, 5.123456) + +# name of all stations found. +station_names = client.station_names + +# dict of all stations with readings. +stations = client.station_data + +# all stations NO2 readings +for station in stations: + no2_value = station.sensors[nilu.NO2].value + +``` + +Finding readings from a specified station, and update cached value: +````python +import niluclient as nilu + +client = nilu.create_station_client('Kannik') +no2_value = client.data.sensors[nilu.NO2].value +no2_unit = client.data.sensors[nilu.NO2].unit_of_measurement + +# after an hour. (Data from the api will only update on the hour) +client.update() + +new_no2_value = client.data.sensors[nilu.NO2].value + +```` + +## Client api coverage + +**Air quality index:** +Fetch measured value and index. +- [x] GET /aq/utd (Implemented for station filtering) - `niluclient.NiluStationClient` +- [x] GET /aq/utd/{latitude}/{longitude}/{radius} - `niluclient.NiluLocationClient` +- [ ] GET /aq/historical/{fromtime}/{totime}/{station} +- [ ] GET /aq/historical/{fromtime}/{totime}/{latitude}/{longitude}/{radius} + +**Observations:** +Fetch measured value. +- [ ] GET /obs/utd +- [ ] GET /obs/utd/{latitude}/{longitude}/{radius} +- [ ] GET /obs/historical/{fromtime}/{totime}/{station} +- [ ] GET /obs/historical/{fromtime}/{totime}/{latitude}/{longitude}/{radius} + +**Day average** +Calculates day average for a given time period. +- [ ] GET /stats/day/{fromtime}/{totime}/{station} +- [ ] GET /stats/day/{fromtime}/{totime}/{latitude}/{longitude}/{radius} + +**Lookup api:** +Lists metadata used for filtering. +- [ ] GET /lookup/areas - (Partially with the `niluclient.AREAS` constants) +- [x] GET /lookup/stations - `niluclient.lookup_stations_in_area('')` +- [ ] GET /lookup/components - (Partially with the `niluclient.MEASURABLE_COMPONENTS` constants) +- [ ] GET /lookup/aqis + +Source: endpoints and description fetched from [nilu api documentation][api-nilu-no] + +[api-nilu-no]: https://api.nilu.no/docs/ +[buymeacoffee-shield]: https://www.buymeacoffee.com/assets/img/guidelines/download-assets-sm-2.svg +[buymeacoffee]: https://www.buymeacoffee.com/heine + + + +%package -n python3-niluclient +Summary: An API client for getting pollution data from NILU sensor stations in Norway. +Provides: python-niluclient +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-niluclient +# niluclient +Python client for getting air pollution data from NILU sensor stations in Norway. +The package comes with clients that can fetch and cache data from nilus api. + +[![Buy me a coffee][buymeacoffee-shield]][buymeacoffee] + + +## Acknowledgements +According to the [api documentation][api-nilu-no] from nilu.no and luftkvalitet.info, +when using data fetched through this client an acknowledgement to both +nilu.no and luftkvalitet.info needs to be included. + +## Usage + +Finding all station in an area: +```python +import niluclient as nilu + +stations = nilu.lookup_stations_in_area('Bergen') +``` + +Finding all stations and sensor reading within 20 km from a location: +```python +import niluclient as nilu + +client = nilu.create_location_client(60.123456, 5.123456) + +# name of all stations found. +station_names = client.station_names + +# dict of all stations with readings. +stations = client.station_data + +# all stations NO2 readings +for station in stations: + no2_value = station.sensors[nilu.NO2].value + +``` + +Finding readings from a specified station, and update cached value: +````python +import niluclient as nilu + +client = nilu.create_station_client('Kannik') +no2_value = client.data.sensors[nilu.NO2].value +no2_unit = client.data.sensors[nilu.NO2].unit_of_measurement + +# after an hour. (Data from the api will only update on the hour) +client.update() + +new_no2_value = client.data.sensors[nilu.NO2].value + +```` + +## Client api coverage + +**Air quality index:** +Fetch measured value and index. +- [x] GET /aq/utd (Implemented for station filtering) - `niluclient.NiluStationClient` +- [x] GET /aq/utd/{latitude}/{longitude}/{radius} - `niluclient.NiluLocationClient` +- [ ] GET /aq/historical/{fromtime}/{totime}/{station} +- [ ] GET /aq/historical/{fromtime}/{totime}/{latitude}/{longitude}/{radius} + +**Observations:** +Fetch measured value. +- [ ] GET /obs/utd +- [ ] GET /obs/utd/{latitude}/{longitude}/{radius} +- [ ] GET /obs/historical/{fromtime}/{totime}/{station} +- [ ] GET /obs/historical/{fromtime}/{totime}/{latitude}/{longitude}/{radius} + +**Day average** +Calculates day average for a given time period. +- [ ] GET /stats/day/{fromtime}/{totime}/{station} +- [ ] GET /stats/day/{fromtime}/{totime}/{latitude}/{longitude}/{radius} + +**Lookup api:** +Lists metadata used for filtering. +- [ ] GET /lookup/areas - (Partially with the `niluclient.AREAS` constants) +- [x] GET /lookup/stations - `niluclient.lookup_stations_in_area('')` +- [ ] GET /lookup/components - (Partially with the `niluclient.MEASURABLE_COMPONENTS` constants) +- [ ] GET /lookup/aqis + +Source: endpoints and description fetched from [nilu api documentation][api-nilu-no] + +[api-nilu-no]: https://api.nilu.no/docs/ +[buymeacoffee-shield]: https://www.buymeacoffee.com/assets/img/guidelines/download-assets-sm-2.svg +[buymeacoffee]: https://www.buymeacoffee.com/heine + + + +%package help +Summary: Development documents and examples for niluclient +Provides: python3-niluclient-doc +%description help +# niluclient +Python client for getting air pollution data from NILU sensor stations in Norway. +The package comes with clients that can fetch and cache data from nilus api. + +[![Buy me a coffee][buymeacoffee-shield]][buymeacoffee] + + +## Acknowledgements +According to the [api documentation][api-nilu-no] from nilu.no and luftkvalitet.info, +when using data fetched through this client an acknowledgement to both +nilu.no and luftkvalitet.info needs to be included. + +## Usage + +Finding all station in an area: +```python +import niluclient as nilu + +stations = nilu.lookup_stations_in_area('Bergen') +``` + +Finding all stations and sensor reading within 20 km from a location: +```python +import niluclient as nilu + +client = nilu.create_location_client(60.123456, 5.123456) + +# name of all stations found. +station_names = client.station_names + +# dict of all stations with readings. +stations = client.station_data + +# all stations NO2 readings +for station in stations: + no2_value = station.sensors[nilu.NO2].value + +``` + +Finding readings from a specified station, and update cached value: +````python +import niluclient as nilu + +client = nilu.create_station_client('Kannik') +no2_value = client.data.sensors[nilu.NO2].value +no2_unit = client.data.sensors[nilu.NO2].unit_of_measurement + +# after an hour. (Data from the api will only update on the hour) +client.update() + +new_no2_value = client.data.sensors[nilu.NO2].value + +```` + +## Client api coverage + +**Air quality index:** +Fetch measured value and index. +- [x] GET /aq/utd (Implemented for station filtering) - `niluclient.NiluStationClient` +- [x] GET /aq/utd/{latitude}/{longitude}/{radius} - `niluclient.NiluLocationClient` +- [ ] GET /aq/historical/{fromtime}/{totime}/{station} +- [ ] GET /aq/historical/{fromtime}/{totime}/{latitude}/{longitude}/{radius} + +**Observations:** +Fetch measured value. +- [ ] GET /obs/utd +- [ ] GET /obs/utd/{latitude}/{longitude}/{radius} +- [ ] GET /obs/historical/{fromtime}/{totime}/{station} +- [ ] GET /obs/historical/{fromtime}/{totime}/{latitude}/{longitude}/{radius} + +**Day average** +Calculates day average for a given time period. +- [ ] GET /stats/day/{fromtime}/{totime}/{station} +- [ ] GET /stats/day/{fromtime}/{totime}/{latitude}/{longitude}/{radius} + +**Lookup api:** +Lists metadata used for filtering. +- [ ] GET /lookup/areas - (Partially with the `niluclient.AREAS` constants) +- [x] GET /lookup/stations - `niluclient.lookup_stations_in_area('')` +- [ ] GET /lookup/components - (Partially with the `niluclient.MEASURABLE_COMPONENTS` constants) +- [ ] GET /lookup/aqis + +Source: endpoints and description fetched from [nilu api documentation][api-nilu-no] + +[api-nilu-no]: https://api.nilu.no/docs/ +[buymeacoffee-shield]: https://www.buymeacoffee.com/assets/img/guidelines/download-assets-sm-2.svg +[buymeacoffee]: https://www.buymeacoffee.com/heine + + + +%prep +%autosetup -n niluclient-0.1.2 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-niluclient -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon May 15 2023 Python_Bot <Python_Bot@openeuler.org> - 0.1.2-1 +- Package Spec generated @@ -0,0 +1 @@ +881c20515082cc9ed80531c4c684a25f niluclient-0.1.2.tar.gz |
