Closed lbesnard closed 1 year ago
:+1: Thanks @lbesnard Here's how I did the same thing...
def map_failed_tests(var):
"""Convert a _failed_tests variable to a list of strings.
var can be an xarray.DataArray or a netCDF4.Variable
"""
flag_map = dict(zip(var.flag_masks, var.flag_meanings.split()))
def map_one(value):
ms = [flag_map[i] for i in flag_map if value & i]
return ", ".join(ms)
return list(map_one(v) for v in var.data)
Some test files generated with this draft PR: https://cloudstor.aarnet.edu.au/plus/s/RKMb19mu8O6GSQx
a python function to split a number into the sum of powers of 2
@mhidas, @evacougnon FYI