dennissergeev / octant

Objective Cyclone Tracking ANalysis Tools
http://octant-docs.rtfd.io/
MIT License
6 stars 4 forks source link

inconsistent behavior new classify() #28

Closed aterpstra closed 5 years ago

aterpstra commented 5 years ago

Hi, The new classification is great, but somewhere there are some inconsistencies (and/or my panda knowledge is at infantile-level)

Let's load some tracks and classify them by category 'len', than TR.cats output a T/F table (which looks good). A problem seems to be somewhere in ot.is_categorized() as TR['len'].index.get_level_values('track_idx').unique() produces a similar error as TR['len'], which both fail as there seems to be a lack of category-label/unhashable index??

Likely this is easily solvable, I just couldn't find it...

test_updated_octant.zip

Also TR.cats['len'].index returns all track-indices, I expect only the indices for tracks where len=True (or is this correct??)

dennissergeev commented 5 years ago

Thanks for the notebook and test data. I just had a brief look, and the errors that were in that notebook didn't happen to me. What is the version of octant that you're using?

Regarding the TR.cats['len'].index, the output of all indices is expected, because TR.cats['len'] is a column within TR.cats dataframe, so it gives you all its elements even if they are True or False. Now, you can access only True indices by subsetting that column:

TR.cats['len'][TR.cats['len']].index

or using a database-style expression:

TR.cats.query('len==True').index

Yet another option is to use TrackRun-level selector and get those indices like so:

TR['len'].index.get_level_values('track_idx')
aterpstra commented 5 years ago

Updated entire environment so it's all fresh-and-shiny packages and errors disappear. Voila. As easy as that. This python-stuff has a very limited shelftime.

dennissergeev commented 5 years ago

Great!

This python-stuff has a very limited shelftime.

It's just octant that is not stable yet...