This can lead to bugs if the input array is reused in another perturbation strategy. We propose the following fix:
y = torch.clone(x)
for i, lag in enumerate(self.lags):
y[i] = fetch_data(
source=self.source,
time=coords["time"] + lag,
variable=coords["variable"],
lead_time=coords["lead_time"],
device=y.device,
)[0]
Version
main
On which installation method(s) does this occur?
Source
Describe the issue
In
earth2studio.perturbations.lagged
, theLaggedEnsemble
perturbation strategy overwrite the passed data array,This can lead to bugs if the input array is reused in another perturbation strategy. We propose the following fix: