Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
climix
climix
Commits
2bce8047
Commit
2bce8047
authored
Nov 11, 2019
by
Klaus Zimmermann
Browse files
Deal with missing long_name in quantity parameters (closes
#127
)
parent
04577bd8
Changes
1
Hide whitespace changes
Inline
Side-by-side
climix/metadata.py
View file @
2bce8047
...
...
@@ -90,10 +90,10 @@ PARAMETER_KINDS = {}
@
dataclass
class
ParameterQuantity
(
Parameter
):
long_name
:
str
standard_name
:
str
data
:
Any
units
:
str
long_name
:
str
=
None
@
property
def
parameter
(
self
):
...
...
@@ -107,12 +107,16 @@ class ParameterQuantity(Parameter):
if
isinstance
(
data
,
dict
)
and
len
(
data
)
==
1
:
key
,
value
=
data
.
popitem
()
data
=
parameters
[
key
]
return
ParameterQuantity
(
ln
=
self
.
long_name
if
ln
is
not
None
:
ln
=
ln
.
format
(
**
parameters
)
param
=
ParameterQuantity
(
ParameterKind
.
QUANTITY
,
self
.
long_name
.
format
(
**
parameters
),
self
.
standard_name
.
format
(
**
parameters
),
data
,
self
.
units
)
self
.
units
,
ln
)
return
param
PARAMETER_KINDS
[
'quantity'
]
=
ParameterQuantity
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment