dayfilter
Filter time-series based on sun movement
Installation
pip install dayfilter
DayFilter depends on suntime. Due to known issue of suntime, please use my fork of suntime on test-pypi. To install, use:
pip uninstall -y suntime
pip install -i https://test.pypi.org/simple/ suntime-yasirroni
I can't bundle my fork of suntime into DayFilter due to LICENSE incompatibility issue.
Usage
Simple use case of getting list of bool
from datetime import datetime
from dayfilter import is_daytime
date_string = '2010-01-01-16:58:30.00000'
date_datetime = datetime.strptime(date_string, '%Y-%m-%d-%H:%M:%S.%f')
# WASHINGTON DC DULLES INT'L AR [STERLING - ISIS], VA. data
latitude = 38.98
longitude = -77.47
time_zone = -5
is_daytime(date_datetime, latitude, longitude, time_zone)
Using DayFilter class for multiple call
from dayfilter import DayFilter
import pandas as pd
from datetime import datetime
# WASHINGTON DC DULLES INT'L AR [STERLING - ISIS], VA. data
latitude = 38.98
longitude = -77.47
time_zone = -5
f = DayFilter(latitude, longitude, time_zone)
date_strings = [
'2010-01-01-05:58:42.00000',
'2010-01-01-06:59:22.00000',
'2010-01-01-13:22:23.00000',
'2010-01-01-14:54:55.00000',
'2010-01-01-15:31:45.00000',
'2010-01-02-17:12:22.00000',
'2010-01-02-15:12:32.00000',
'2010-01-02-16:59:32.00000',
'2010-01-02-18:00:11.00000',
]
date_format = '%Y-%m-%d-%H:%M:%S.%f'
date_datetimes = [datetime.strptime(date_string, date_format) for date_string in date_strings]
df = pd.DataFrame(index=date_datetimes, data=[1,2,3,4,5,6,7,8,9])
df_ = f.filter(df)
print(df_)
Adcanced use of DayFilter class with custom filter
from dayfilter import DayFilter
from dayfilter.post_process import shift_sr_down, shift_ss_up
from dayfilter.logic import logic_daytime
f2 = DayFilter(latitude, longitude, time_zone, post_processes=[shift_sr_down, shift_ss_up], logic=logic_daytime)
df__ = f2.filter(df)
print(df__)
print(f.get_sr_ss(df_.index[0]))
print(f.get_sr_ss(df_.index[0], post_processes=True))
TODO
- Consider refactor to astral due to suntime LICENSE. a. Astral is slower and have same bug with the original suntime b. Soulution of the suntime bug exist on yasirroni/suntime
License
This project is licensed in MIT License, but depends on suntime that use LGPL license.
Metadata
Release files for dayfilter 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dayfilter-0.3.1.tar.gz | 6.6 kB | Without provenance | Details for dayfilter-0.3.1.tar.gz |
Release files / dayfilter-0.3.1.tar.gz
| Download URL | dayfilter-0.3.1.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3555de8f1e4d7ae5749204d02107778ef8c699ecd48f20e2934f57b3bbc890c1
|
|
BLAKE2b-256 checksum How to use checksums |
629b434a2520d5331d213f4068e38ee614c783a43cc93b34c61dcbc064cac39f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.11.4 pkginfo/1.8.2 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.7.4
|
Security for dayfilter 0.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.