Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Klaus Zimmermann
climix
Commits
29e95e28
Commit
29e95e28
authored
Nov 20, 2019
by
Klaus Zimmermann
Browse files
Store original parameters instead of converting units post-hoc (fixes
#134
)
parent
02dde888
Changes
2
Hide whitespace changes
Inline
Side-by-side
climix/aggregators.py
View file @
29e95e28
...
...
@@ -42,7 +42,5 @@ class PointLocalAggregator(Aggregator):
if
proposed_standard_name
is
not
None
:
cube
.
attributes
[
'proposed_standard_name'
]
=
proposed_standard_name
for
extra_coord
in
self
.
index_function
.
extra_coords
:
change_units
(
extra_coord
,
self
.
output_metadata
.
units
,
unit_standard_name
)
cube
.
add_aux_coord
(
extra_coord
)
return
cube
climix/index_functions.py
View file @
29e95e28
...
...
@@ -67,7 +67,7 @@ class CountOccurrences:
self
.
lazy_condition
=
DASK_OPERATORS
[
condition
]
self
.
standard_name
=
None
self
.
units
=
Unit
(
'days'
)
self
.
extra_coords
=
[
threshold
]
self
.
extra_coords
=
[
threshold
.
copy
()
]
def
prepare
(
self
,
input_cube
):
change_units
(
self
.
threshold
,
...
...
@@ -95,7 +95,7 @@ class FirstOccurrence:
self
.
standard_name
=
None
self
.
units
=
Unit
(
'days'
)
self
.
NO_OCCURRENCE
=
np
.
inf
self
.
extra_coords
=
[
threshold
]
self
.
extra_coords
=
[
threshold
.
copy
()
]
def
prepare
(
self
,
input_cube
):
change_units
(
self
.
threshold
,
...
...
@@ -143,7 +143,7 @@ class LastOccurrence:
self
.
standard_name
=
None
self
.
units
=
Unit
(
'days'
)
self
.
NO_OCCURRENCE
=
-
np
.
inf
self
.
extra_coords
=
[
threshold
]
self
.
extra_coords
=
[
threshold
.
copy
()
]
def
prepare
(
self
,
input_cube
):
change_units
(
self
.
threshold
,
...
...
@@ -192,7 +192,7 @@ class SpellLength:
self
.
reducer
=
NUMPY_REDUCERS
[
reducer
]
self
.
standard_name
=
None
self
.
units
=
Unit
(
'days'
)
self
.
extra_coords
=
[
threshold
]
self
.
extra_coords
=
[
threshold
.
copy
()
]
def
prepare
(
self
,
input_cube
):
change_units
(
self
.
threshold
,
...
...
@@ -269,7 +269,7 @@ class ThresholdedStatistics:
self
.
reducer
=
NUMPY_REDUCERS
[
reducer
]
self
.
lazy_condition
=
DASK_OPERATORS
[
condition
]
self
.
lazy_reducer
=
DASK_REDUCERS
[
reducer
]
self
.
extra_coords
=
[
threshold
]
self
.
extra_coords
=
[
threshold
.
copy
()
]
def
prepare
(
self
,
input_cube
):
change_units
(
self
.
threshold
,
...
...
@@ -300,7 +300,7 @@ class TemperatureSum:
else
:
self
.
fun
=
lambda
d
,
t
:
np
.
maximum
(
t
-
d
,
0
)
self
.
lazy_fun
=
lambda
d
,
t
:
da
.
maximum
(
t
-
d
,
0
)
self
.
extra_coords
=
[
threshold
]
self
.
extra_coords
=
[
threshold
.
copy
()
]
def
prepare
(
self
,
input_cube
):
change_units
(
self
.
threshold
,
...
...
Write
Preview
Markdown
is supported
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