+def switch_units_to_american(data_map, mapping):
+ """
+ replace units with the American mixture of metric and imperial
+
+ Precip values = metric
+ Wind values = imperial
+ """
+
+ # precip values
+ data_map[mapping['tempMaxHourUnit']] = 'C'
+ data_map[mapping['tempMinHourUnit']] = 'C'
+ data_map[mapping['tempPresUnit']] = 'C'
+ data_map[mapping['dewPointUnit']] = 'C'
+
+ data_map[mapping['precipitationGaugeUnit']] = 'cm'
+ data_map[mapping['hsUnit']] = 'cm'
+ data_map[mapping['hn24AutoUnit']] = 'cm'
+ data_map[mapping['hstAutoUnit']] = 'cm'
+
+ data_map[mapping['baroUnit']] = 'inHg'
+
+ # wind values
+ data_map[mapping['windSpeedUnit']] = 'mph'
+ data_map[mapping['windGustSpeedNumUnit']] = 'mph'
+
+ return data_map
+
+def convert_nrcs_units_to_metric(element_cd, value):
+ """convert NRCS values from English to metric"""
+ if element_cd == 'TOBS':
+ value = f_to_c(value)
+ elif element_cd == 'SNWD':
+ value = in_to_cm(value)
+ elif element_cd == 'PREC':
+ value = in_to_mm(value)
+ return value
+
+def convert_units_to_american(element_cd, value):
+ """
+ convert value to 'American' units
+
+ The original unit is always metric.
+
+ Precip values = metric
+ Wind values = imperial
+ """
+
+ # no need to convert precip values, as they will arrive in metric
+ # units in "American" units mode
+ # # temp values
+ # if element_cd in ['TMAX', 'TMIN', 'TOBS', 'air_temp', 'air_temp_high_24_hour', 'air_temp_low_24_hour']:
+ # value = c_to_f(value)
+
+ # mesowest provides HS in mm, not cm; we want cm
+ if element_cd == 'snow_depth':
+ value = mm_to_cm(value)
+
+ # baro values also arrive in metric, so convert to imperial
+ if element_cd in ['PRES', 'pressure']:
+ value = inhg_to_pascal(value)
+
+ if element_cd in ['WSPD', 'wind_speed', 'wind_gust']:
+ value = ms_to_mph(value)
+
+ return value
+