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

Update how to determine depth dimension #170

Merged
merged 3 commits into from
Dec 20, 2023

Conversation

ssuttles-usgs
Copy link
Collaborator

Update needed because P_1 variable can and often does include pressure due to things other than sea water (e.g atmosheric pressure). Best practice would be to use the WATER_DEPTH and initial_instrument_height attributes to determine the depth dimension because it is expected that WATER_DEPTH attribute was determined relative to a water level datum (e.g. Mean Sea Level, Local Mean Sea Level, or ground water table).

@dnowacki-usgs
Copy link
Member

dnowacki-usgs commented Dec 18, 2023

Thanks for the PR, Steve. I agree with this:

Update needed because P_1 variable can and often does include pressure due to things other than sea water (e.g atmosheric pressure).

Agree, and note that the P_1 standard_name of sea_water_pressure does allow for air pressure variability. As an aside, we have been adding a 1 m pressure offset to Nortek instruments which cannot handle negative pressures in order to avoid problems from changes in atmospheric prior to/after a deployment when the reading would be close to zero and potentially negative without the offset. In this case, P_1 would really not reflect pressure due to sea water alone .

I don't think this part reflects the reality of most WATER_DEPTH attributes I have dealt with:

because it is expected that WATER_DEPTH attribute was determined relative to a water level datum

In my experience, WATER_DEPTH is often simply the depth of water at the site at the time of deployment. This can make a big difference in shallow/intertidal sites as you know. Often I see "WATER_DEPTH_source" or similar as "ships echosounder", which suggests a moment-in-time water depth and not one tied to any datum. Even though WATER_DEPTH in OFR 2007-1194 says it's the "Best version of water depth at site" this hasn't been my experience.

I agree that if P_1ac does NOT exist, we should use something WATER_DEPTH derived, but I wonder if that's the best route if P_1ac does exist.

Thoughts?

@dnowacki-usgs
Copy link
Member

What if we use attrs based on the CF Conventions standard names to indicate which depth we are talking about, and then use those values if present to compute the depth variable? For example, we could specify one of the following

Screenshot 2023-12-18 at 10 04 29

@ssuttles-usgs
Copy link
Collaborator Author

I agree in the past WATER_DEPTH was often taken as the nominal depth at the time of deployment, but we have since decided WATER_DEPTH should be ref to a datum, typically some estimation of local mean sea level (LMSL). In my work group, the workflow is if we have corrected pressure data we use it and initial_instrument_height to find local mean sea level from the data and use that for WATER_DEPTH attribute, in the same manner that create_z does. Alternatively, if have height_above_geopotential datum available use it in VDatum to estimate LMSL, which is used for WATER_DEPTH. It is unfortunate that the OFR is not more clear about WATER_DEPTH.

I like your idea about the CF standard name to know what WATER_DEPTH actually is. Flexibility is a plus. Just makes for a bit more coding, but I agree that is a good approach.

One more thing. We should also add D_3 to the 'if' tree for calculating depth from the data. The situation that prompted this PR was where there was P_1 and D_3 (Hobo water level data above sensor corrected for atmospheric in the Hobo software). It used P_1, which was absolute pressure and gave an erroneous value for depth. So solution, remove P_1 and add D_3 for cases when WATER_DEPTH is not ref to datum?

stglib/core/utils.py Show resolved Hide resolved
depvar = ds.attrs[name] - ds.attrs["initial_instrument_height"]
break

if "depvar" not in locals():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then replace this line with if not depvar:

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead used --> if depvar is None:

)
else:
depvar = ds.attrs[name] - ds.attrs["initial_instrument_height"]
break
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove break line

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made change

stglib/core/utils.py Show resolved Hide resolved
@dnowacki-usgs dnowacki-usgs changed the title Update how to find depth dimension in core/utils.create_z Update how to determine depth dimension Dec 20, 2023
@dnowacki-usgs dnowacki-usgs merged commit 3f9573a into USGS-CMG:master Dec 20, 2023
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants