diff --git a/archetypal/schedule.py b/archetypal/schedule.py index 89cd6a1c..5a8c5b1f 100644 --- a/archetypal/schedule.py +++ b/archetypal/schedule.py @@ -1294,7 +1294,11 @@ def series(self): index = pd.date_range( start=self.startDate, periods=self.all_values.size, freq="1H" ) - return EnergySeries(self.all_values, index=index, name=self.Name) + if self.Type is not None: + units = self.Type.UnitType + else: + units = None + return EnergySeries(self.all_values, index=index, name=self.Name, units=units) @staticmethod def get_schedule_type_limits_name(epbunch): @@ -1489,7 +1493,14 @@ def __mul__(self, other): def _repr_svg_(self): """SVG representation for iPython notebook.""" - fig, ax = self.series.plot2d(cmap="Greys", show=False, figsize=(7, 2), dpi=72) + if self.Type is not None: + vmin = self.Type.LowerLimit + vmax = self.Type.UpperLimit + else: + vmin, vmax = (0, 0) + fig, ax = self.series.plot2d( + cmap="Greys", show=False, figsize=(7, 2), dpi=72, vmin=vmin, vmax=vmax + ) f = io.BytesIO() fig.savefig(f, format="svg") return f.getvalue() diff --git a/archetypal/settings.py b/archetypal/settings.py index c7eb8303..0fabce74 100644 --- a/archetypal/settings.py +++ b/archetypal/settings.py @@ -128,7 +128,12 @@ from energy_pandas.units import unit_registry -unit_registry = unit_registry +additional_units = ( + "Dimensionless = dimensionless = Fraction", + "@alias degC = Temperature", +) +for unit in additional_units: + unit_registry.define(unit) class ZoneWeight(object):