`along_track` perturbation not being called?
Closed this issue · 6 comments
@zacharyburnettNOAA I noticed that the along_track perturbation doesn't seem to be doing anything in the Florence best track example (the model results and the fort.22 for location is same as other perturbations for different along_track and same cross_track). Can please make sure that along_track is being called correctly.
@zacharyburnettNOAA Update is that I tried just doing say 2 variable perturbation to make it simpler:
from pathlib import Path
from ensembleperturbation.perturbation.atcf import VortexPerturbedVariable, perturb_tracks
from ensembleperturbation.plotting import (
plot_perturbations,
)
if __name__ == '__main__':
input_directory = Path.cwd()
make_perturbations_plot = False
perturb_tracks(
perturbations=4,
storm=None,
variables=['max_sustained_wind_speed','cross_track'],
sample_from_distribution=True,
quadrature=True,
overwrite=True,
parallel=False,
)
For some reason I keep getting no difference between original.22
and vortex_2_variable_quadrature_1.22
files but I get correct difference between original.22
and vortex_2_variable_quadrature_16.22
.
vortex_2_variable_quadrature_1.json
:
{
"max_sustained_wind_speed": -2.3344142183389773,
"cross_track": -2.3344142183389773,
"weight": 0.002104594050700909
}
vortex_2_variable_quadrature_16.json
:
{
"max_sustained_wind_speed": 2.3344142183389773,
"cross_track": 2.3344142183389773,
"weight": 0.0021045940507009183
}
that's quite strange, I will look into this
@zacharyburnettNOAA Recent commit feature/chaospy@21fef03 fixes the bottom issue, alpha < 0 wasn't being implemented correctly.
But along_track
still seems to not be doing anything.
I will write a test to check for this:
from pathlib import Path
from modelforcings.vortex import VortexForcing
import numpy
from ensembleperturbation.perturbation.atcf import perturb_tracks
if __name__ == '__main__':
perturbations = perturb_tracks(
perturbations=4,
directory=Path('/home/zrb/.config/JetBrains/PyCharmCE2021.3/scratches/perturbation_test') / 'track_files',
storm='florence2018',
variables=['along_track', 'max_sustained_wind_speed'],
sample_from_distribution=False,
quadrature=False,
overwrite=True,
)
tracks = {run: VortexForcing.from_fort22(perturbation['besttrack']['fort22_filename']) for run, perturbation in perturbations.items()}
original_track = tracks['original']
del tracks['original']
for run, track in tracks.items():
if numpy.allclose(track.data[['longitude', 'latitude']], original_track.data[['longitude', 'latitude']]):
print(f'points in run "{run}" unchanged from original')
print('done')
[2022-01-11 12:34:14,852] modelforcings.vortex INFO : Downloading storm data from ftp.nhc.noaa.gov/atcf/archive/2018/aal062018.dat.gz
[2022-01-11 12:34:17,388] perturbation.atcf INFO : writing 5 perturbations
[2022-01-11 12:34:19,527] perturbation.atcf INFO : wrote 2-variable perturbation to "track_files/vortex_2_variable_perturbation_1.22"
[2022-01-11 12:34:19,800] perturbation.atcf INFO : wrote 2-variable perturbation to "track_files/vortex_2_variable_perturbation_2.22"
[2022-01-11 12:34:19,832] perturbation.atcf INFO : wrote 2-variable perturbation to "track_files/vortex_2_variable_perturbation_4.22"
[2022-01-11 12:34:20,299] perturbation.atcf INFO : wrote 2-variable perturbation to "track_files/vortex_2_variable_perturbation_3.22"
[2022-01-11 12:34:20,319] perturbation.atcf INFO : wrote 2-variable perturbation to "track_files/original.22"
points in run "vortex_2_variable_perturbation_1" unchanged from original
points in run "vortex_2_variable_perturbation_2" unchanged from original
points in run "vortex_2_variable_perturbation_4" unchanged from original
points in run "vortex_2_variable_perturbation_3" unchanged from original
done
added test in 24a3e41, will work on fixing along_track