windrose icon indicating copy to clipboard operation
windrose copied to clipboard

Handling "Calms"

Open mccannjb opened this issue 7 years ago • 5 comments

Is there a way to treat 'calms' differently within datasets? For example, in the dataset I'm attempting to create windroses for, calms are denoted as Wd=0.0 and Ws=0.0 (whereas North winds are denoted as Wd=360.0). It seems like in this case they are currently lumped in with North winds.

mccannjb avatar May 22 '17 16:05 mccannjb

Maybe you could simply remove these data from your input data For example using a Pandas DataFrame and boolean indexing

df = df[df["Ws"] > 0.1]

s-celles avatar May 22 '17 18:05 s-celles

I have started removing the calms from the dataframes prior to passing to the windrose bar function similar to the way you suggested. What I was hoping is that there is some way to replicate the typical calms representation within other windroses (i.e. a circle in the center, from which the sector "petals" emanate) as the example below shows: samplewindrose

mccannjb avatar May 22 '17 18:05 mccannjb

Pinging @LionelR

s-celles avatar May 23 '17 04:05 s-celles

It should be possible to compute the calms frequency in the histogram method and initialise the offset plots methods variable accordingly after drawing a centered circle. I don't have a computer right now but I can try something tomorrow if you can't in the mean time.

lnlrbr avatar May 23 '17 05:05 lnlrbr

I found a way to get around this. Its not the most elegant solution, but it works. The pyplot.text() allows us to place text at a coordinate of our choosing. And you can get this nice circle smack in the middle of the polar plot. Here is the sample code: plt.text(0., 0., "Calm", size=18, ha="center", va="center", bbox=dict(boxstyle="circle") )

goharShoukat avatar Jul 23 '21 16:07 goharShoukat

This was implemented in https://github.com/python-windrose/windrose/pull/102

ocefpaf avatar Sep 21 '22 17:09 ocefpaf