enerdata 1.0.2__tar.gz → 1.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {enerdata-1.0.2/enerdata.egg-info → enerdata-1.1.2}/PKG-INFO +1 -1
- {enerdata-1.0.2 → enerdata-1.1.2}/README.rst +8 -29
- {enerdata-1.0.2 → enerdata-1.1.2}/enerdata/__init__.py +1 -1
- {enerdata-1.0.2 → enerdata-1.1.2}/enerdata/profiles/__init__.py +2 -1
- {enerdata-1.0.2 → enerdata-1.1.2}/enerdata/profiles/profile.py +7 -18
- {enerdata-1.0.2 → enerdata-1.1.2/enerdata.egg-info}/PKG-INFO +1 -1
- {enerdata-1.0.2 → enerdata-1.1.2}/enerdata.egg-info/requires.txt +2 -1
- {enerdata-1.0.2 → enerdata-1.1.2}/requirements.txt +2 -1
- {enerdata-1.0.2 → enerdata-1.1.2}/LICENSE +0 -0
- {enerdata-1.0.2 → enerdata-1.1.2}/MANIFEST.in +0 -0
- {enerdata-1.0.2 → enerdata-1.1.2}/enerdata/calendars/__init__.py +0 -0
- {enerdata-1.0.2 → enerdata-1.1.2}/enerdata/contracts/__init__.py +0 -0
- {enerdata-1.0.2 → enerdata-1.1.2}/enerdata/contracts/contract.py +0 -0
- {enerdata-1.0.2 → enerdata-1.1.2}/enerdata/contracts/electrical_seasons.py +0 -0
- {enerdata-1.0.2 → enerdata-1.1.2}/enerdata/contracts/normalized_power.py +0 -0
- {enerdata-1.0.2 → enerdata-1.1.2}/enerdata/contracts/tariff.py +0 -0
- {enerdata-1.0.2 → enerdata-1.1.2}/enerdata/cups/__init__.py +0 -0
- {enerdata-1.0.2 → enerdata-1.1.2}/enerdata/cups/cups.py +0 -0
- {enerdata-1.0.2 → enerdata-1.1.2}/enerdata/datetime/__init__.py +0 -0
- {enerdata-1.0.2 → enerdata-1.1.2}/enerdata/datetime/holidays.py +0 -0
- {enerdata-1.0.2 → enerdata-1.1.2}/enerdata/datetime/solar_hour.py +0 -0
- {enerdata-1.0.2 → enerdata-1.1.2}/enerdata/datetime/station.py +0 -0
- {enerdata-1.0.2 → enerdata-1.1.2}/enerdata/datetime/timezone.py +0 -0
- {enerdata-1.0.2 → enerdata-1.1.2}/enerdata/datetime/work_and_holidays.py +0 -0
- {enerdata-1.0.2 → enerdata-1.1.2}/enerdata/metering/__init__.py +0 -0
- {enerdata-1.0.2 → enerdata-1.1.2}/enerdata/metering/measure.py +0 -0
- {enerdata-1.0.2 → enerdata-1.1.2}/enerdata/metering/meter.py +0 -0
- {enerdata-1.0.2 → enerdata-1.1.2}/enerdata/profiles/data/coefficients_HIDRO_RE.csv +0 -0
- {enerdata-1.0.2 → enerdata-1.1.2}/enerdata/profiles/data/coefficients_RE.xlsx +0 -0
- {enerdata-1.0.2 → enerdata-1.1.2}/enerdata.egg-info/SOURCES.txt +0 -0
- {enerdata-1.0.2 → enerdata-1.1.2}/enerdata.egg-info/dependency_links.txt +0 -0
- {enerdata-1.0.2 → enerdata-1.1.2}/enerdata.egg-info/top_level.txt +0 -0
- {enerdata-1.0.2 → enerdata-1.1.2}/requirements-dev.txt +0 -0
- {enerdata-1.0.2 → enerdata-1.1.2}/setup.cfg +0 -0
- {enerdata-1.0.2 → enerdata-1.1.2}/setup.py +0 -0
- {enerdata-1.0.2 → enerdata-1.1.2}/spec/__init__.py +0 -0
|
@@ -4,12 +4,12 @@ Enerdata
|
|
|
4
4
|
|
|
5
5
|
A set of energy models
|
|
6
6
|
|
|
7
|
-
.. image:: https://github.com/gisce/enerdata/actions/workflows/python2-app.yml/badge.svg
|
|
8
|
-
:target: https://github.com/gisce/enerdata/actions/workflows/python2-app.yml
|
|
7
|
+
.. image:: https://github.com/gisce/enerdata/actions/workflows/python2.7-app.yml/badge.svg
|
|
8
|
+
:target: https://github.com/gisce/enerdata/actions/workflows/python2.7-app.yml
|
|
9
|
+
|
|
10
|
+
.. image:: https://github.com/gisce/enerdata/actions/workflows/python3.11-app.yml/badge.svg
|
|
11
|
+
:target: https://github.com/gisce/enerdata/actions/workflows/python3.11-app.yml
|
|
9
12
|
|
|
10
|
-
.. image:: https://github.com/gisce/enerdata/actions/workflows/python3-app.yml/badge.svg
|
|
11
|
-
:target: https://github.com/gisce/enerdata/actions/workflows/python3-app.yml
|
|
12
|
-
|
|
13
13
|
.. image:: https://coveralls.io/repos/github/gisce/enerdata/badge.svg?branch=master
|
|
14
14
|
:target: https://coveralls.io/github/gisce/enerdata?branch=master
|
|
15
15
|
|
|
@@ -18,34 +18,13 @@ A set of energy models
|
|
|
18
18
|
Considerations
|
|
19
19
|
--------------
|
|
20
20
|
|
|
21
|
-
Any date instance must be localized
|
|
21
|
+
Any date instance must be localized. See ``enerdata.datetime.timezone.localize`` method!!!
|
|
22
22
|
|
|
23
23
|
.. code-block:: python
|
|
24
24
|
|
|
25
25
|
from enerdata.datetime.timezone import TIMEZONE
|
|
26
26
|
|
|
27
|
-
TIMEZONE.localize(datetime(2018,2,5,1,0))
|
|
27
|
+
TIMEZONE.localize(datetime(2018, 2, 5, 1, 0))
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
Default timezone ``Europe/Madrid
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
---
|
|
36
|
-
TDD
|
|
37
|
-
---
|
|
38
|
-
|
|
39
|
-
With this library we try to do TDD.
|
|
40
|
-
|
|
41
|
-
.. code-block:: bash
|
|
42
|
-
|
|
43
|
-
$ export PYTHONPATH="."
|
|
44
|
-
$ mamba
|
|
45
|
-
|
|
46
|
-
or if you are working with a virtualenv
|
|
47
|
-
|
|
48
|
-
.. code-block:: bash
|
|
49
|
-
|
|
50
|
-
$ pip install -e .
|
|
51
|
-
$ mamba
|
|
30
|
+
Default timezone is set to ``Europe/Madrid``. It can be changed overriding the TIMEZONE definition.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
__author__ = 'ecarreras'
|
|
2
|
-
__version__ = '1.
|
|
2
|
+
__version__ = '1.1.2'
|
|
@@ -2,7 +2,7 @@ try:
|
|
|
2
2
|
from collections import Counter
|
|
3
3
|
except ImportError:
|
|
4
4
|
from backport_collections import Counter
|
|
5
|
-
from decimal import Decimal
|
|
5
|
+
from decimal import Decimal, getcontext
|
|
6
6
|
|
|
7
7
|
import math
|
|
8
8
|
|
|
@@ -19,6 +19,7 @@ def my_round(x, d=0):
|
|
|
19
19
|
class Dragger(Counter):
|
|
20
20
|
|
|
21
21
|
def drag(self, number, key='default'):
|
|
22
|
+
getcontext().prec = 10 # Between 6 and 10 to get same behaviour in Python 2.7 and Python 3.11
|
|
22
23
|
if number == 0 and abs(self[key]) == Decimal('0.5'):
|
|
23
24
|
# Avoid oscillation between -1 and 1 and dragging 0.5 and -0.5
|
|
24
25
|
return number
|
|
@@ -574,15 +574,11 @@ class Profile(object):
|
|
|
574
574
|
|
|
575
575
|
def estimate(self, tariff, balance):
|
|
576
576
|
assert isinstance(tariff, Tariff)
|
|
577
|
-
logger.debug('Estimating for tariff: {0}'.format(
|
|
578
|
-
tariff.code
|
|
579
|
-
))
|
|
577
|
+
logger.debug('Estimating for tariff: {0}'.format(tariff.code))
|
|
580
578
|
|
|
581
579
|
# Adapt balance for simplified T30A with just one period
|
|
582
580
|
if isinstance(tariff, T30A_one_period) or isinstance(tariff, T31A_one_period):
|
|
583
|
-
balance = {
|
|
584
|
-
"P1": sum([values for values in balance.values()])
|
|
585
|
-
}
|
|
581
|
+
balance = {"P1": sum([values for values in balance.values()])}
|
|
586
582
|
# Adapt T31A6P adding P4 to P1
|
|
587
583
|
if isinstance(tariff, T31A) and balance.get('P4', 0) > 0:
|
|
588
584
|
balance['P1'] += balance['P4']
|
|
@@ -593,13 +589,10 @@ class Profile(object):
|
|
|
593
589
|
end = self.end_date
|
|
594
590
|
# - REE cofs get from (year/month)
|
|
595
591
|
# - Simel cofs get from (year/month/day hour) - can't substract one day
|
|
596
|
-
if self.first_day_of_month or not issubclass(self.profile_class,
|
|
597
|
-
REEProfile):
|
|
592
|
+
if self.first_day_of_month or not issubclass(self.profile_class, REEProfile):
|
|
598
593
|
cofs = self.profile_class.get_range(start, end)
|
|
599
594
|
else:
|
|
600
|
-
cofs = self.profile_class.get_range(
|
|
601
|
-
start, end - relativedelta(days=1)
|
|
602
|
-
)
|
|
595
|
+
cofs = self.profile_class.get_range(start, end - relativedelta(days=1))
|
|
603
596
|
cofs = Coefficients(cofs)
|
|
604
597
|
cofs_per_period = Counter()
|
|
605
598
|
|
|
@@ -609,9 +602,7 @@ class Profile(object):
|
|
|
609
602
|
gap_cof = cofs.get(dt)
|
|
610
603
|
cofs_per_period[period.code] += gap_cof.cof[tariff.cof]
|
|
611
604
|
|
|
612
|
-
logger.debug('Coefficients per period calculated: {0}'.format(
|
|
613
|
-
cofs_per_period
|
|
614
|
-
))
|
|
605
|
+
logger.debug('Coefficients per period calculated: {0}'.format(cofs_per_period))
|
|
615
606
|
|
|
616
607
|
energy_per_period = self.get_estimable_consumption(tariff, balance)
|
|
617
608
|
energy_per_period_rem = energy_per_period.copy()
|
|
@@ -630,13 +621,11 @@ class Profile(object):
|
|
|
630
621
|
dragger.drag(self.accumulated, key=init_drag_key)
|
|
631
622
|
|
|
632
623
|
for idx, gap in enumerate(self.gaps):
|
|
633
|
-
logger.debug('Gap {0}/{1}'.format(
|
|
634
|
-
idx + 1, len(self.gaps)
|
|
635
|
-
))
|
|
624
|
+
logger.debug('Gap {0}/{1}'.format(idx + 1, len(self.gaps)))
|
|
636
625
|
dt = gap - timedelta(minutes=1)
|
|
637
626
|
period = tariff.get_period_by_date(dt)
|
|
638
627
|
|
|
639
|
-
drag_key = period.code if
|
|
628
|
+
drag_key = period.code if self.drag_by_periods else "default"
|
|
640
629
|
|
|
641
630
|
gap_cof = cofs.get(gap).cof[tariff.cof]
|
|
642
631
|
energy = energy_per_period[period.code]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|