def get_key(row, transform=False): P = row['P'] land = row['land'] soil = row['soil'] if transform: land = str(lookup_nlcd(row['land'])) new_soil_types = ['a', 'b', 'c', 'd'] old_soil_types = ['0', '1', '2', '3'] soil_types_map = dict(zip(new_soil_types, old_soil_types)) soil = soil_types_map[row['soil']] return (P, land, soil)
def get_pollutant_load(use_type, pollutant, runoff_liters): """ Calculate the pollutant load over a particular land use type given an amount of runoff generated on that area and an event mean concentration of the pollutant. Returns the pollutant load in lbs. """ mg_per_kg = 1000000 lbs_per_kg = 2.205 nlcd = lookup_nlcd(use_type) emc = lookup_load(nlcd, pollutant) load_mg_l = emc * runoff_liters return (load_mg_l / mg_per_kg) * lbs_per_kg