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

[python #COB-992724]: CAPE/LFC Calculations Questions/Bug?


Sadly, yes you'll need to manually affix units to the columns. The data frame 
returned from `request_data` will have an attribute `units` that is a 
dictionary mapping each of the column names to the units as a string.

For now what you'll need to do is something like:

press = dataset2['pressure'].values * units(dataset2.units['pressure'])

Note the use of `values` to get the pandas column as a numpy array (it doesn't 
work otherwise). You can also hard-code the units instead of using the 
`units['pressure']` type of construct.

I would very much like to clean this up and make it simpler, but for now that's 
where things stand.


> Ryan,
> Thanks for the response. Regarding the siphon data and its panda format, I 
> modified my script to just start testing things out. I had a question 
> regarding units of the data.
> dataset2 = WyomingUpperAir.request_data(datetime(1999, 5, 4, 0), 'OUN')
> prof_m21 = mpcalc.parcel_profile(dataset2['pressure'], T[0], 
> Td_m20[0]).to('degC')
> But I get the following error:
> ValueError: `parcel_profile` given arguments with incorrect units: `pressure` 
> requires "[pressure]" but given "none".
> Any variable `x` can be assigned a unit as follows:
> from metpy.units import units
> x = x * units.meter / units.second
> Do I need to set the units for each panda column? Is this something siphon 
> should/can/does return?

Ticket Details
Ticket ID: COB-992724
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.