noaa-ocs-modeling/EnsemblePerturbation

Original best track is modified if perturb.write called twice?

Closed this issue · 1 comments

Trying out following code for test:

# hardcoding variable list for now
gauss_variables = [
    MaximumSustainedWindSpeed,
    CrossTrack
]
range_variables = [RadiusOfMaximumWinds]

perturber = VortexPerturber(storm='al062018', start_date='20180911', end_date=None)

perturber.write(
    number_of_perturbations=2, variables=gauss_variables, directory=output_directory, alphas=[-1.0,1.0],
)

perturber.write(
    number_of_perturbations=2, variables=range_variables, directory=output_directory, alphas=[0.25,0.75],
)

I get an issue where original.22 is written in the first call of perturber.write() and is correct but on second call to perturber.write() original.22 changes to be equal to the CrossTrack perturbation (the last perturbed variable for previous call). May need re-consider how the api works to make sure original data is not overwritten so we can call the perturber.write multiple times.

Reason for calling twice is that the expected range of alpha is different for the Gaussian variables and the in-range variables (Rmax).

fixed by 4167d8b