contrailcirrus / pycontrails

Python library for modeling contrails and other aviation climate impacts
https://py.contrails.org/
Apache License 2.0
57 stars 16 forks source link

Bugfix/persistent contrails formed #212

Closed trdean1 closed 4 months ago

trdean1 commented 4 months ago

Fixes

Fixes bug in output_format.py so that total_persistent_contrails_formed is computed in a manner that is consistent for the convention of computing EF.

Zero EF = no contrail formed (or if it did it was less than one segment length) NaN EF = missing input to compute contrail output

Both cases should be excluded from total_persistent_contrails_formed.

Tests

Reviewer

thabbott commented 4 months ago

Maybe worth adding a test that the number of waypoints with an RF value is always larger than the number of waypoints that form persistent contrails?

(flight_summary["total_persistent_contrails_formed"] == 0.0).sum() <= (flight_summary["mean_lifetime_rf_net"].isna()).sum()

This way our tests still assert something about the mean_lifetime_rf_net summary statistic.

Otherwise looks good to me!