Skip to content

Commit

Permalink
Incorporate comment into atmospheric pressure correction (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
dnowacki-usgs authored Apr 23, 2024
1 parent a3c7d31 commit 176b501
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions doc/atmos.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ which sets the zero offset for the pressure sensor. In the example below, the of
float64 atmpres(time)
_FillValue: nan
offset: -10.25
comment: Atmospherically corrected using NOAA station 9414523 Redwood City, CA
unlimited dimensions:
current shape = (8874,)
filling on

A second optional but highly recommended attribute for the ``atmpres`` variable is ``comment``. This can be used to store information about the station used for atmospheric compensation. For example, ``atmpres:comment = "Atmospherically corrected using NOAA station 9414523 Redwood City, CA"``.

The time base of the atmospheric pressure file must be the same as that of the instrument pressure record. This file will be used by the run scripts to atmospherically compensate the pressure record.

Steps to generate an atmospheric pressure file
Expand Down
4 changes: 4 additions & 0 deletions stglib/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,10 @@ def atmos_correct(ds, atmpres):
ds.attrs["atmospheric_pressure_correction_offset_applied"] = met["atmpres"].attrs[
"offset"
]
if "comment" in met["atmpres"].attrs:
ds.attrs["atmospheric_pressure_correction_comment"] = met["atmpres"].attrs[
"comment"
]

# Is reindexing with a tolerance still necessary? Keeping old code around to check
# ds["P_1ac"] = (
Expand Down
4 changes: 4 additions & 0 deletions stglib/rsk/cdf2nc.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ def atmos_correct_profile(ds, atmpres):
ds.attrs["atmospheric_pressure_correction_offset_applied"] = met["atmpres"].attrs[
"offset"
]
if "comment" in met["atmpres"].attrs:
ds.attrs["atmospheric_pressure_correction_comment"] = met["atmpres"].attrs[
"comment"
]

return ds

Expand Down

0 comments on commit 176b501

Please sign in to comment.