[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[python #MVS-634658]: Metpy LCL question

Hello, and thanks for reaching out!

If you adapt your originally-provided script (without the loops) per the 
previous response, you won't need to construct this loop, and the code should 
run quickly. If you prefer to perform the calculations in this way, your error 
appears to come from the following: you've created your 2-d arrays to loop over 
and place your LCL pressure and temperature into, but haven't told python where 
in these arrays you should place each individual `mpcalc.lcl` output (lclp, 
lclt) like you have for the LCL height `mpcalc.pressure_to_height_std` 
calculation output (lclh). Be sure to check out your array indexing carefully 
when you construct loops like this, especially nested ones!

I hope this helps, and if not please don't hesitate to follow up!

All the best,


> I tried the mask code suggested but now I got this:
> ValueError: setting an array element with a sequence.
> when I run this code:
> lclp=np.empty(((428,614)))
> lclt=np.empty(((428,614)))
> lclh=np.empty(((428,614)))
> for i in range(428):
> for j in range(614):
> lclp, lclt = mpcalc.lcl(sfcp[i,j],sfct[i,j],dp[i,j])
> lclh[i,j]=mpcalc.pressure_to_height_std(lclp).to('feet')

Ticket Details
Ticket ID: MVS-634658
Department: Support Python
Priority: Low
Status: Closed
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata 
inquiry tracking system and then made publicly available through the web.  If 
you do not want to have your interactions made available in this way, you must 
let us know in each email you send to us.