NCAR / geocat-comp

GeoCAT-comp provides implementations of computational functions for operating on geosciences data. Many of these functions originated in NCL and were translated into Python.
https://geocat-comp.readthedocs.io
Apache License 2.0
125 stars 56 forks source link

geocat.comp.meteorology.delta_pressure is different with dpres_plev #538

Closed cccccoldrun closed 7 months ago

cccccoldrun commented 10 months ago

this is the ncl code

plev = (/ 1000.,950.,900.,850.,800.,750.,700.,650.,600., \ 550.,500.,450.,400.,350.,300.,250.,200., \ 175.,150.,125.,100., 80., 70., 60., 50., \ 40., 30., 25., 20. /)

plev = plev*100.
plev@units = "Pa" ; Pa = kg/(m s2) (Pascal)

ptop = min(plev)

psfc = 850*100.
psfc@units = "Pa"

dp = dpres_plevel(plev, psfc, ptop, 0) ; dp(30) print(dp)

this is the python code:

import geocat.comp as gc import numpy as np plev = [ 1000.,950.,900.,850.,800.,750.,700.,650.,600., \ 550.,500.,450.,400.,350.,300.,250.,200., \ 175.,150.,125.,100., 80., 70., 60., 50., \ 40., 30., 25., 20. ] plev = np.array(plev)100.
ptop = min(plev)
psfc = 850
100.
dp = gc.meteorology.delta_pressure(plev, psfc)
print(dp)

but the result is different if the psfc is lower than the first value of plev 屏幕截图 2024-01-05 162143 屏幕截图 2024-01-05 162521

anissa111 commented 10 months ago

Hello @cccccoldrun, thanks for submitting this bug report, someone from the geocat-comp dev team will look into this shortly!

kafitzgerald commented 10 months ago

Thanks, @cccccoldrun!

I looked into this briefly and confirmed we don't account for this case (where the specified surface pressure (psfc) is less than some values of the given pressure levels (plev)).

Instead of assigning a missing/fill value like the NCL routine, gc.meteorology.delta_pressure attempts to compute those values.

It'd be good to get a fix in for this and get test coverage.

bnepal22 commented 3 months ago

Hello @all I am confuse, does computing thickness between two pressure level here based on hypsometric equation or its jjust simple difference between two pressure level. As in the shared result above , the 3rd value why it is 2500 if its the difference between 85000-80000, similarly for the 16th value why its 3750 and so on. Could you kindly please clarify this. I am completely confuse.

cccccoldrun commented 3 months ago

Actually, if you have seen the code about the function,the top and bottom is different from the mid layers. 3750 is (25000-17500)/2 bottom:2500 is 850000(surface pressure)-(85000+80000)/2 top:250 (2500+2000)/2-2000(top pressure)


From: bnepal22 @.> Sent: Tuesday, July 30, 2024 2:35:33 PM To: NCAR/geocat-comp @.> Cc: cccccoldrun @.>; Mention @.> Subject: Re: [NCAR/geocat-comp] geocat.comp.meteorology.delta_pressure is different with dpres_plev (Issue #538)

Hello @ALLhttps://github.com/ALL I am confuse, does computing thickness between two pressure level here based on hypsometric equation or its jjust simple difference between two pressure level. As in the shared result above , the 3rd value why it is 2500 if its the difference between 85000-80000, similarly for the 16th value why its 3750 and so on. Could you kindly please clarify this. I am completely confuse.

— Reply to this email directly, view it on GitHubhttps://github.com/NCAR/geocat-comp/issues/538#issuecomment-2257575928, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AXOR3YTRDFO6GZYA2RD2FUTZO4X3LAVCNFSM6AAAAABBOCTHKWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJXGU3TKOJSHA. You are receiving this because you were mentioned.Message ID: @.***>