sharppy / SHARPpy

Sounding/Hodograph Analysis and Research Program in Python
https://sharppy.github.io/SHARPpy/index.html
Other
216 stars 112 forks source link

Error when using KTS2MS util #151

Closed tennessean closed 5 years ago

tennessean commented 5 years ago

I was testing the Jupyter Notebook tutorial for SHARPpy, specifically the code in the section labeled "Putting it all together into one plot" (namely the part of the code that allows the display for the various parameters), when I came across this issue while trying to test out the SHERB parameter's values:

C:\Users\Public\Anaconda2\lib\site-packages\sharppy-1.3.0-py2.7.egg\sharppy\sharptab\params.pyc in sherb(prof, **kwargs)
   2306         p3km = interp.pres(prof, interp.to_msl(prof, 3000))
   2307         sfc_pres = prof.pres[prof.get_sfc()]
-> 2308         shear = utils.KTS2MS(winds.wind_shear(prof, pbot=sfc_pres, ptop=p3km))
   2309         sherb = ( shear / 26. ) * ( lr03 / 5.2 ) * ( lr75 / 5.6 )
   2310     else:

C:\Users\Public\Anaconda2\lib\site-packages\sharppy-1.3.0-py2.7.egg\sharppy\sharptab\utils.pyc in KTS2MS(val)
     84 
     85     '''
---> 86     return val * 0.514444
     87 
     88 

TypeError: can't multiply sequence by non-int of type 'float'

From what I understand (please correct me if I'm wrong), apparently the KTS2MS util isn't set as an integer, which is why it's spitting out this type of error. Regardless of whether or not this is the case, I would recommend checking not only this but also all other utils just to be on the safe side.

Thank you.

tennessean commented 5 years ago

I decided to take a look at hot the KTS2MS util was being implemented on other parameters, and I found the source of the problem:

Line 2308, the problem line, is currently written as such:

shear = utils.KTS2MS(winds.wind_shear(prof, pbot=sfc_pres, ptop=p3km))

When I changed it to this:

shear = utils.KTS2MS(utils.mag(*winds.wind_shear(prof, pbot=sfc_pres, ptop=p3km)))

The error went away, and the SHERB parameter worked exactly as intended.

So the actual source of the problem was simply that a particular util was missing.

I just thought I'd help clear up the cause of that particular issue.

Curtis044 commented 5 years ago

Tennessean: When viewing sharppy how can you change what parameters are shown, for example, I'd like to add freezing level, or SWEAT to the parameters below a sounding, can you tell me how to add those so I can view them?

wblumberg commented 5 years ago

Ugh. I could have sworn I fixed this issue back in late 2016 when it arose on a version of SHARPpy being used in Japan to identify high-shear low-CAPE tornadoes. I've added your code @tennessean and will close this issue. Thanks for submitting the correction!