Skip to content

Commit

Permalink
PI: Fix broadcast of timeseries over all ensembles
Browse files Browse the repository at this point in the history
When broadcasting a timeseries to all ensemble members, we have to be
sure to do so _after_ it has been filled (with NaNs) to the right
length.
  • Loading branch information
Tjerk Vreeken committed Sep 5, 2019
1 parent 187640f commit 91388ca
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/rtctools/data/pi.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,13 +575,6 @@ def __init__(self, data_config, folder, basename, binary=True, pi_validate_times
unit = header.find('pi:units', ns).text
self.set_unit(variable, unit=unit, ensemble_member=ensemble_member)

if make_virtual_ensemble:
# Make references to the original input series for the virtual
# ensemble members.
for i in range(1, self.ensemble_size):
self.__values[i][variable] = self.__values[0][variable]
self.set_unit(variable, unit=unit, ensemble_member=i)

# Prepend empty space, if start_datetime > self.__start_datetime.
if start_datetime > self.__start_datetime:
if self.__dt:
Expand Down Expand Up @@ -614,6 +607,13 @@ def __init__(self, data_config, folder, basename, binary=True, pi_validate_times
self.__values[ensemble_member][variable] = np.hstack(
(self.__values[ensemble_member][variable], filler))

if make_virtual_ensemble:
# Make references to the original input series for the virtual
# ensemble members.
for i in range(1, self.ensemble_size):
self.__values[i][variable] = self.__values[0][variable]
self.set_unit(variable, unit=unit, ensemble_member=i)

if not self.__dt:
# Remove time values outside the start/end datetimes.
# Only needed for non-equidistant, because we can't build the
Expand Down

0 comments on commit 91388ca

Please sign in to comment.