Skip to content

CCL Calculation Issue #3075

Answered by Z-Richard
Cjseng asked this question in Q&A
Jun 15, 2023 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

Hi @Cjseng, I am sorry for the late response -- but the issue is due to the fact MetPy implicitly assumes that the pressure array is in descending order (such that it mimics the real atmosphere, from ground to TOA). To make your code work, you only need to change

pressure = df['Pres (mb)'].values * units.mbar
temperature = df['Temp (C)'].values * units.degC
dewpoint = df['Dewpoint (C)'].values * units.degC

to

pressure = np.flip(df['Pres (mb)'].values) * units.mbar
temperature = np.flip(df['Temp (C)'].values) * units.degC
dewpoint = np.flip(df['Dewpoint (C)'].values) * units.degC

I believe MetPy should have better specifications for these functions and provide more useful error messages …

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@Cjseng
Comment options

Comment options

You must be logged in to vote
1 reply
@Cjseng
Comment options

Answer selected by Cjseng
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants