Skip to content

Commit 49d0563

Browse files
awlostowski-noaaawlostowski-noaa
andauthored
never let minutes since last_obs be negative (#521)
Co-authored-by: awlostowski-noaa <[email protected]>
1 parent d28549d commit 49d0563

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/python_routing_v02/troute/routing/fast_reach/simple_da.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from libc.math cimport exp, isnan, NAN
1+
from libc.math cimport exp, isnan, NAN, fabs
22
from libc.stdio cimport printf
33

44
cpdef float simple_da_with_decay_py(
@@ -119,7 +119,7 @@ cdef float obs_persist_shift(
119119
"""
120120

121121
cdef float da_weight, da_shift, da_weighted_shift
122-
da_weight = exp(minutes_since_last_valid/-decay_coeff) # TODO: This could be pre-calculated knowing when obs finish relative to simulation time
122+
da_weight = exp(fabs(minutes_since_last_valid)/-decay_coeff) # TODO: This could be pre-calculated knowing when obs finish relative to simulation time
123123
# TODO: we need to be able to export these values to compute the 'Nudge'
124124
# One possibility would be to return only the nudge from this function...
125125
da_shift = last_valid_obs - model_val

0 commit comments

Comments
 (0)