Here is a Python function that works to convert MIxS format (value [space] units) to numeric (value only):
def mixs_to_numeric(value_plus_units):
'''Takes a value with units after it (str) and returns only the numeric value (float)'''
'''Does not support scientific notation (yet)'''
'''Inputs containing no numerals or dash or period will return np.nan'''
value_only = re.sub(r'([-\.0-9]*).*', r'\1', value_plus_units)
if value_only == '':
return(np.nan)
else:
return(float(value_only))
This could be integrated into Opal (issue #5) or a Python script that converts a MIxS-formatted sample data file and returns a fully machine-readable metadata file.
Here is a Python function that works to convert MIxS format (value [space] units) to numeric (value only):
This could be integrated into Opal (issue #5) or a Python script that converts a MIxS-formatted sample data file and returns a fully machine-readable metadata file.
@ksilnoaa @Zenith2198