Skip to content

Commit

Permalink
Enable setting of frequency cutoffs for PUV
Browse files Browse the repository at this point in the history
  • Loading branch information
dnowacki-usgs committed Feb 27, 2024
1 parent 8eca46f commit 6ed6891
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions stglib/vec/nc2waves.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,22 @@ def ds_puv(ds):

puvs = {k: np.full_like(ds["time"].values, np.nan, dtype=float) for k in desc}

if "P_1ac" in ds:
pvar = "P_1ac"
else:
pvar = "P_1"

if "puv_first_frequency_cutoff" in ds.attrs:
first_frequency_cutoff = ds.attrs["puv_first_frequency_cutoff"]
else:
first_frequency_cutoff = 1 / 10

if "puv_last_frequency_cutoff" in ds.attrs:
last_frequency_cutoff = ds.attrs["puv_last_frequency_cutoff"]
else:
last_frequency_cutoff = 1 / 2.5

for n in tqdm(range(N)):
if "P_1ac" in ds:
pvar = "P_1ac"
else:
pvar = "P_1"
puv = waves.puv_quick(
ds[pvar][n, :].values,
ds["u_1205"][n, :],
Expand All @@ -143,8 +154,8 @@ def ds_puv(ds):
ds.attrs["pressure_sensor_height"],
ds.attrs["velocity_sample_volume_height"],
1 / ds.attrs["sample_interval"],
first_frequency_cutoff=1 / 10,
last_frequency_cutoff=1 / 2,
first_frequency_cutoff=first_frequency_cutoff,
last_frequency_cutoff=last_frequency_cutoff,
)

for k in puvs:
Expand Down

0 comments on commit 6ed6891

Please sign in to comment.