Skip to content

Commit

Permalink
Improve history for atmospheric correction for Nortek instruments (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
dnowacki-usgs authored Feb 28, 2024
1 parent eee48ed commit 1136943
Showing 1 changed file with 11 additions and 14 deletions.
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

0 comments on commit 1136943

Please sign in to comment.