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

Calculate pressure depth uncertainty #128

Open
PennyHow opened this issue Apr 12, 2023 · 0 comments
Open

Calculate pressure depth uncertainty #128

PennyHow opened this issue Apr 12, 2023 · 0 comments
Labels
L0 Issues with L0 data L1 Issues with L1 data

Comments

@PennyHow
Copy link
Member

Moved and modified from #122. Uncertainty propagation through the pressure depth calculation is not tracked, but should be in the future. Perhaps with uncertainty arrays that accompany the z_pt_cor and z_pt outputs (i.e. z_pt_cor_unc and z_pt_unc)

def getPressDepth(z_pt, p, pt_antifreeze, pt_z_factor, pt_z_coef, pt_z_p_coef):
'''Adjust pressure depth and calculate pressure transducer depth based on
pressure transducer fluid density
Parameters
----------
z_pt : xr.Dataarray
Pressure transducer height (corrected for offset)
p : xr.Dataarray
Air pressure
pt_antifreeze : float
Pressure transducer anti-freeze percentage for fluid density
correction
pt_z_factor : float
Pressure transducer factor
pt_z_coef : float
Pressure transducer coefficient
pt_z_p_coef : float
Pressure transducer coefficient
Returns
-------
z_pt_cor : xr.Dataarray
Pressure transducer height corrected
z_pt : xr.Dataarray
Pressure transducer depth
'''
# Calculate pressure transducer fluid density
if pt_antifreeze == 50: #TODO: Implement function w/ reference (analytical or from LUT)
rho_af = 1092 #TODO: Track uncertainty
elif pt_antifreeze == 100:
rho_af = 1145
else:
rho_af = np.nan
print('ERROR: Incorrect metadata: "pt_antifreeze" = ' +
f'{pt_antifreeze}. Antifreeze mix only supported at 50% or 100%')
# assert(False)
# Correct pressure depth
z_pt_cor = z_pt * pt_z_coef * pt_z_factor * 998.0 / rho_af + 100 * (pt_z_p_coef - p) / (rho_af * 9.81)
# Calculate pressure transducer depth
z_pt = z_pt * pt_z_coef * pt_z_factor * 998.0 / rho_af
return z_pt_cor, z_pt

@PennyHow PennyHow added L0 Issues with L0 data L1 Issues with L1 data labels Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L0 Issues with L0 data L1 Issues with L1 data
Projects
None yet
Development

No branches or pull requests

1 participant