+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)
+
+ # # snow values
+ # if element_cd in ['SNWD', 'snow_depth']:
+ # value = cm_to_in(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
+