def normalize_array(var):
if np.issubdtype(var.dtype, '<STR_LIT>'):<EOL><INDENT>if var.dtype == str:<EOL><INDENT>return var[:]<EOL><DEDENT>def decoder(x):<EOL><INDENT>return str(x.decode('<STR_LIT:utf-8>'))<EOL><DEDENT>vfunc = np.vectorize(decoder)<EOL>return vfunc(nc4.chartostring(var[:]))<EOL><DEDENT>else:<EOL><INDENT>return var[:]<EOL><DEDENT>
Returns a normalized data array from a NetCDF4 variable. This is mostly
used to normalize string types between py2 and py3. It has no effect on types
other than chars/strings