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):
@property
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
def relative_path(self) -> str:
......
......@@ -7,6 +7,7 @@ class AbstractVariable(object):
"""
NAME = ''
UNIT = ''
def __init__(self, dataset, altitude):
self.dataset = dataset
......
......@@ -29,16 +29,16 @@ class CrocusVariable(AbstractVariable):
class CrocusSweVariable(CrocusVariable):
NAME = 'Snow Water Equivalent'
UNIT = 'kg/m2 or mm'
def __init__(self, dataset, altitude):
# Units are kg m-2
super().__init__(dataset, altitude, 'SNOWSWE')
class CrocusDepthVariable(CrocusVariable):
NAME = 'Snow Depth'
UNIT = 'm'
def __init__(self, dataset, altitude):
# Units are m
super().__init__(dataset, altitude, "SNOWDEPTH")
......@@ -22,6 +22,7 @@ class SafranSnowfallVariable(AbstractVariable):
"""
NAME = 'Snowfall'
UNIT = 'kg/m2 or mm'
def __init__(self, dataset, altitude, nb_consecutive_days_of_snowfall=1, keyword='Snowf'):
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