Commit 2bce8047 authored by Klaus Zimmermann's avatar Klaus Zimmermann
Browse files

Deal with missing long_name in quantity parameters (closes #127)

parent 04577bd8
...@@ -90,10 +90,10 @@ PARAMETER_KINDS = {} ...@@ -90,10 +90,10 @@ PARAMETER_KINDS = {}
@dataclass @dataclass
class ParameterQuantity(Parameter): class ParameterQuantity(Parameter):
long_name: str
standard_name: str standard_name: str
data: Any data: Any
units: str units: str
long_name: str = None
@property @property
def parameter(self): def parameter(self):
...@@ -107,12 +107,16 @@ class ParameterQuantity(Parameter): ...@@ -107,12 +107,16 @@ class ParameterQuantity(Parameter):
if isinstance(data, dict) and len(data) == 1: if isinstance(data, dict) and len(data) == 1:
key, value = data.popitem() key, value = data.popitem()
data = parameters[key] data = parameters[key]
return ParameterQuantity( ln = self.long_name
if ln is not None:
ln = ln.format(**parameters)
param = ParameterQuantity(
ParameterKind.QUANTITY, ParameterKind.QUANTITY,
self.long_name.format(**parameters),
self.standard_name.format(**parameters), self.standard_name.format(**parameters),
data, data,
self.units) self.units,
ln)
return param
PARAMETER_KINDS['quantity'] = ParameterQuantity PARAMETER_KINDS['quantity'] = ParameterQuantity
......
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