I don't see any reason you couldn't write tests for functions in maproom.py. Do you have a specific impediment in mind? Writing tests for the UI requires infrastructure we don't have in place yet, but a function that's pure computation like this one should be testable using the same paradigm you've been using elsewhere.
I'm ok deferring proper handling of NaNs if you want.