Commit 6d112d0f authored by Le Roux Erwan's avatar Le Roux Erwan
Browse files

[SCM] display variable unit in the variable name on the plot

parent 3beddf92
No related merge requests found
Showing with 9 additions and 3 deletions
+9 -3
...@@ -202,7 +202,11 @@ class AbstractStudy(object): ...@@ -202,7 +202,11 @@ class AbstractStudy(object):
@property @property
def variable_name(self): def variable_name(self):
return self.variable_class.NAME return self.variable_class.NAME + ' (in {})'.format(self.variable_unit)
@property
def variable_unit(self):
return self.variable_class.UNIT
@property @property
def relative_path(self) -> str: def relative_path(self) -> str:
......
...@@ -7,6 +7,7 @@ class AbstractVariable(object): ...@@ -7,6 +7,7 @@ class AbstractVariable(object):
""" """
NAME = '' NAME = ''
UNIT = ''
def __init__(self, dataset, altitude): def __init__(self, dataset, altitude):
self.dataset = dataset self.dataset = dataset
......
...@@ -29,16 +29,16 @@ class CrocusVariable(AbstractVariable): ...@@ -29,16 +29,16 @@ class CrocusVariable(AbstractVariable):
class CrocusSweVariable(CrocusVariable): class CrocusSweVariable(CrocusVariable):
NAME = 'Snow Water Equivalent' NAME = 'Snow Water Equivalent'
UNIT = 'kg/m2 or mm'
def __init__(self, dataset, altitude): def __init__(self, dataset, altitude):
# Units are kg m-2
super().__init__(dataset, altitude, 'SNOWSWE') super().__init__(dataset, altitude, 'SNOWSWE')
class CrocusDepthVariable(CrocusVariable): class CrocusDepthVariable(CrocusVariable):
NAME = 'Snow Depth' NAME = 'Snow Depth'
UNIT = 'm'
def __init__(self, dataset, altitude): def __init__(self, dataset, altitude):
# Units are m
super().__init__(dataset, altitude, "SNOWDEPTH") super().__init__(dataset, altitude, "SNOWDEPTH")
...@@ -22,6 +22,7 @@ class SafranSnowfallVariable(AbstractVariable): ...@@ -22,6 +22,7 @@ class SafranSnowfallVariable(AbstractVariable):
""" """
NAME = 'Snowfall' NAME = 'Snowfall'
UNIT = 'kg/m2 or mm'
def __init__(self, dataset, altitude, nb_consecutive_days_of_snowfall=1, keyword='Snowf'): def __init__(self, dataset, altitude, nb_consecutive_days_of_snowfall=1, keyword='Snowf'):
super().__init__(dataset, altitude) super().__init__(dataset, altitude)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment