Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve history for atmospheric correction for Nortek instruments #190

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 11 additions & 14 deletions stglib/aqd/aqdutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,17 @@ def atmos_correct(ds, atmpres):
- met["atmpres"].reindex_like(ds["Pressure"], method="nearest", tolerance="5s")
- met["atmpres"].attrs["offset"]
)
print(
f"Atmospherically correcting using time-series from {atmpres} and offset of {met['atmpres'].offset}"
)
ds["Pressure_ac"].attrs = attrs

ds.attrs["atmospheric_pressure_correction_file"] = atmpres
ds.attrs["atmospheric_pressure_correction_offset_applied"] = met["atmpres"].attrs[
"offset"
]

histtext = f"Atmospherically corrected using time-series from {atmpres} and offset of {met['atmpres'].offset}"

ds = utils.insert_history(ds, histtext)

return ds


Expand Down Expand Up @@ -972,15 +973,15 @@ def add_vel_attributes(vel, dsattrs):
and dsattrs["trim_method"].lower() == "water level sl"
):
if "trim_surf_bins" in ds.attrs:
vel.attrs[
"note"
] = "Velocity bins trimmed if out of water or if side lobes intersect sea surface (with {} additional surface bins removed).".format(
ds.attrs["trim_surf_bins"]
vel.attrs["note"] = (
"Velocity bins trimmed if out of water or if side lobes intersect sea surface (with {} additional surface bins removed).".format(
ds.attrs["trim_surf_bins"]
)
)
else:
vel.attrs[
"note"
] = "Velocity bins trimmed if out of water or if side lobes intersect sea surface."
vel.attrs["note"] = (
"Velocity bins trimmed if out of water or if side lobes intersect sea surface."
)

def add_attributes(var, dsattrs):
if inst_type == "AQD":
Expand Down Expand Up @@ -1214,10 +1215,6 @@ def add_attributes(var, dsattrs):

add_attributes(ds["P_1ac"], ds.attrs)

histtext = "Atmospheric pressure compensated."

ds = utils.insert_history(ds, histtext)

if "bin_depth" in ds:
ds["bin_depth"].attrs.update({"units": "m", "long_name": "bin depth"})

Expand Down
Loading