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

[BUG] mixed-layer parcel in parcelx and DefineParcel #250

Open
Chun-ChihWang opened this issue Apr 28, 2023 · 0 comments
Open

[BUG] mixed-layer parcel in parcelx and DefineParcel #250

Chun-ChihWang opened this issue Apr 28, 2023 · 0 comments

Comments

@Chun-ChihWang
Copy link

In SharpPy 1.4.0, when I tried to define a mixed-layer parcel object using parcelx in sharptab.params, it didn't seem to work as described. In the description, it sounds like a user should be able to specify a custom depth of the mixed-layer parcel by specifying
mlpcl = params.parcelx(prof, flag=4, pres=xxx), where xxx is the depth (in mb) of the parcel from the surface to mix.

The parcel depth is then supposed to be passed to DefineParcel, which is called within parcelx, as a kwarg when lplvals is not specified, but it didn't get passed because the DefineParcel call does not have any kwarg in it. Line 1777 of params.py
"
pcl.lplvals = kwargs.get('lplvals', DefineParcel(prof, flag))
"
Therefore, any specification of pres in parcelx has no effect. When I tried printing out the mixed-layer parcel depth in __ml (in DefineParcel; assigned to self.presval), it always gave me the default lowest 100 mb even when I specified pres=50 in my parcelx call.

Simply adding pres to the DefineParcel call in Line 1777 of params.py created another issue where the specified pres was taken as the parcel starting pressure. For example, if pres=50, then the parcel starting pressure is taken as 50 mb, which doesn't make sense and will mess up the mixed-layer parcel calculations (e.g., MLCAPE, MLLCL, etc). I believe this is a variable name conflict issue- the variable "pres" is used to represent two completely different variables in parcelx and DefineParcel. As a temporary fix, I created a new kwarg named "pcl_dp" that gets passed to my modified DefineParcel call in parcelx (in params) that includes a kwarg.
"
pcl_dp = kwargs.get('pcl_dp', None)
if pcl_dp is not None:
pcl.lplvals = kwargs.get('lplvals', DefineParcel(prof, flag, pcl_dp=pcl_dp))
else:
pcl.lplvals = kwargs.get('lplvals', DefineParcel(prof, flag))
"
This gave me the desired pbot and ptop for layer averaging in __ml. However, I am not sure if this is the best way to get around this problem.

The above isn't really an issue if a user wishes to compute the default lowest 100 mb mixed-layer parameters. It is only an issue if a user wants to define his/her own mixed-layer parcel.

Cheers,
David

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

No branches or pull requests

1 participant