Open karlmsmith opened 7 years ago
Simple (linear) conversions that are performed in SOCAT are: day of year: jan1=1.0, jan1=0.0 latitude: degrees_north, degrees_south longitude: degrees_east, degrees_west mole fraction: umol/mol, mmol/mol pressure: hPa, kPa, mbar, inHg, mmHg, torr speed: knots, km/h, m/s, mph temperature: degC, K, degF
For mole fraction conversions: mmol/mol * 1000.0 = umol/mol (umol/mol is usually the standard unit but sometime mmol/mol is standard so needs to go both ways)
For atmospheric pressure conversions (hPa is standard unit; water pressure standard unit is different): mbar = hPa kPa 10.0 = hPa inHg 0.029529983071 = hPa torr or mmHg * 1.3332236842105 = hPa
For ship speed (knots is standard unit): km/h / 1.852 = knots m/s 3.6 / 1.852 = knots mph 1.609344 / 1.852 = knots
dashboard.dsg.StdUserDataArray is designed to recursively standardize data for those data values that need standard data from another data column. For example, converting mg/L or mL/L of some nutrient value to umol/kg (micromole of nutrient per kg of seawater) requires the seawater density which should be given in another data column.
The current implementation only standardized some values that do not require other data columns (e.g., dashboard.datatype.LinearConverter). Need to add more unit conversions as well as create dashboard.datatype.ValueConverter classes to handle the more complex conversions such as described above.
For adding more LinearConverter conversions, just need to add more values to the maps, once we figure out what conversions are needed.
For the conversion given above, need to know what molecular weights to use (for ionic, just the ionic MW or assume some counterion?). For something like water pressure to water depth, need algorithm for converting the given densities to a depth (e.g., attempt to do a rough integration using the water column densities or just assume constant density in the water column?)