deeplycloudy / xlma-python

A future, Python-based version of xlma?
MIT License
6 stars 6 forks source link

filter_flashes doesn't filter flash event count #24

Closed jaymtee closed 10 months ago

jaymtee commented 1 year ago

changing min_events_per_flash below has no effect on flash_stats. It always returns the same number of lfashes

ds = filter_flashes(ds, flash_event_count=(min_events_per_flash, None))

wx4stg commented 12 months ago

this isn't documented as far as I know, but you need to call flash_stats on ds before attempting to filter flashes.

for most properties, this raises an exception as filtering an array of nans isn't possible. However, because flash_event_count is a uint64 array, the nan fill value is 4294967295, which suppresses the exception.

I've opened a PR #26 to add an explicit check and exception if this is the case.

wx4stg commented 12 months ago

example to fix:

from pyxlma.lmalib.flash.properties import flash_stats, filter_flashes

ds = flash_stats(ds)
ds = filter_flashes(ds, flash_event_count=(min_events_per_flash, None))