Advertisement
Guest User

ALL LWW ERROR CHECK SCRIPTS

a guest
Nov 22nd, 2019
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 5.05 KB | None | 0 0
  1. ## This script identifies LLWW modifiers that do not comply with associated wetland LLWW codes ##
  2.  
  3. def codeChecker(LLWW_CODE, LLWW_MODIFIERS):
  4.     if LLWW_MODIFIERS is not None:
  5.         LLWW_MODIFIERS = LLWW_MODIFIERS.split(',')
  6.         incorrect_LLWW_MODIFIERS = []
  7.         LLWW_CODE = LLWW_CODE[0:4]
  8.         match_dict = {'LOBA': ['bg', 'id', 'kt', 'ml', 'pd', 'pl', 'pp', 'sv', 'ts', 'go', 'hf', 'sw', 'ww', 'ds'],
  9.                       'LOFP': ['bg', 'fm', 'id', 'kt', 'ml', 'ox', 'pd', 'pl', 'pp', 'sv', 'ts', 'aq', 'go', 'sw', 'ww', 'ds'],
  10.                       'LOFR': ['ay', 'bg', 'id', 'kt', 'ml', 'pl', 'pp', 'sv', 'ts', 'go', 'hf', 'dr', 'sw', 'ww', 'ds', 'it'],
  11.                       'LEBA': ['ay', 'ml', 'ox', 'pd', 'pl', 'sv', 'ts', 'ch', 'go', 'hf', 'sw', 'ww', 'ds', 'fs', 'it'],
  12.                       'LEFP': ['ay', 'fm', 'kt', 'ml', 'ox', 'pd', 'pl', 'sv', 'ts', 'aq', 'ch', 'go', 'hf', 'sw', 'ww', 'ds', 'fs', 'it'],
  13.                       'LEFR': ['ay', 'kt', 'ml', 'ox', 'pl', 'sv', 'ts', 'ch', 'go', 'hf', 'dr', 'sw', 'ww', 'ds', 'fs', 'it'],
  14.                       'TEBA': ['ay', 'ml', 'pd', 'sv', 'ts', 'ch', 'au', 'it', 'rf'],
  15.                       'TEFL': ['ay', 'fm', 'hs', 'id', 'il', 'kt', 'ox', 'pd', 'pl', 'pp', 'sv', 'ts', 'aq', 'ch', 'im', 'ar', 'au', 'ds', 'fs', 'gw', 'ir', 'it', 'rf'],
  16.                       'TEFR': ['ay', 'kt', 'ml', 'sv', 'ts', 'ch', 'au', 'it', 'rf'],
  17.                       'TESL': ['ay', 'fm', 'kt', 'ml', 'ox', 'pd', 'pl', 'pp', 'aq', 'ch', 'hf', 'au', 'it', 'rf']}
  18.         if LLWW_CODE in match_dict.keys():
  19.             for modifier in LLWW_MODIFIERS:
  20.                 if modifier in match_dict[LLWW_CODE]:
  21.                     incorrect_LLWW_MODIFIERS.append(modifier)
  22.             return(','.join(incorrect_LLWW_MODIFIERS))
  23.         else:
  24.             return(None)
  25.     else:
  26.         return(None)
  27.  
  28. ## This script identifies LLWW modifiers that do not comply with associated waterbody LLWW codes ##
  29.    
  30. def codeChecker(Waterbody, LLWW_MODIFIERS):
  31.     if LLWW_MODIFIERS is not None:
  32.         LLWW_MODIFIERS = LLWW_MODIFIERS.split(',')
  33.         incorrect_LLWW_MODIFIERS = []
  34.         match_dict = {'LK': ['ay', 'il', 'pl', 'ch', 'rr', 'sw', 'ww', 'fs', 'ir', 'it'],
  35.                       'PD': ['ay', 'sl', 'ch', 'ld', 'rr']}
  36.         if Waterbody in match_dict.keys():
  37.             for modifier in LLWW_MODIFIERS:
  38.                 if modifier in match_dict[Waterbody]:
  39.                     incorrect_LLWW_MODIFIERS.append(modifier)
  40.             return(','.join(incorrect_LLWW_MODIFIERS))
  41.         else:
  42.             return(None)
  43.     else:
  44.         return(None)
  45.  
  46. ## This script identifies LLWW modifiers that do not comply with associated flowpath LLWW codes ##
  47.    
  48. def codeChecker(FlowPath, LLWW_MODIFIERS):
  49.     if LLWW_MODIFIERS is not None:
  50.         LLWW_MODIFIERS = LLWW_MODIFIERS.split(',')
  51.         incorrect_LLWW_MODIFIERS = []
  52.         match_dict = {'BI': ['ar', 'au', 'ds', 'fs', 'ir', 'it', 'rf'],
  53.                       'TB': ['ds', 'fs', 'gw', 'ir', 'it',],
  54.                       'IN': ['au', 'ds', 'fs', 'gw', 'it', 'rf'],
  55.                       'OU': ['au', 'fs', 'ir', 'it', 'rf'],    
  56.                       'VR': ['ar', 'au', 'ds', 'fs', 'ir', 'it', 'rf']}
  57.         if FlowPath in match_dict.keys():
  58.             for modifier in LLWW_MODIFIERS:
  59.                 if modifier in match_dict[FlowPath]:
  60.                     incorrect_LLWW_MODIFIERS.append(modifier)
  61.             return(','.join(incorrect_LLWW_MODIFIERS))
  62.         else:
  63.             return(None)
  64.     else:
  65.         return(None)
  66.  
  67. ## This script identifies LLWW modifiers that do not comply with associated stream LLWW codes ##
  68.    
  69. def codeChecker(Flow, LLWW_MODIFIERS):
  70.     if LLWW_MODIFIERS is not None:
  71.         LLWW_MODIFIERS = LLWW_MODIFIERS.split(',')
  72.         incorrect_LLWW_MODIFIERS = []
  73.         match_dict = {'1': ['ay', 'bg', 'fm', 'fn', 'id', 'il', 'kt', 'mr', 'ox', 'pl', 'pp', 'sa', 'sl', 'aq', 'go', 'gr', 'im', 'dr', 'sw', 'ww', 'wm', 'ar', 'ds', 'fs', 'gw', 'ir', 'it'],
  74.                       '2': ['ay', 'bg', 'fm', 'fn', 'id', 'il', 'kt', 'mr', 'ox', 'pl', 'pp', 'sa', 'sl', 'aq', 'go', 'gr', 'im', 'ld', 'dr', 'sw', 'ww', 'wm', 'ar', 'ds', 'ir', 'it'],
  75.                       '3': ['bg', 'fm', 'fn', 'id', 'il', 'kt', 'mr', 'ox', 'pl', 'pp', 'sa', 'sl', 'aq', 'go', 'gr', 'hy', 'im', 'ld', 'dr', 'rr', 'sw', 'ww', 'wm', 'ar', 'ds', 'ir'],
  76.                       '4': ['bg', 'fm', 'fn', 'id', 'il', 'kt', 'mr', 'ox', 'pl', 'pp', 'sa', 'sl', 'aq', 'go', 'gr', 'hy', 'im', 'ld', 'dr', 'rr', 'sw', 'ww', 'wm', 'ar', 'au', 'ds', 'gw', 'ir', 'rf'],
  77.                       '5': ['ay', 'bg', 'fm', 'fn', 'id', 'il', 'kt', 'mr', 'ox', 'pl', 'pp', 'sa', 'sl', 'go', 'gr', 'im', 'ld', 'dr', 'rr', 'ww', 'wm', 'au', 'fs', 'gw', 'ir', 'it', 'rf']}
  78.         if Flow in match_dict.keys():
  79.             for modifier in LLWW_MODIFIERS:
  80.                 if modifier in match_dict[Flow]:
  81.                     incorrect_LLWW_MODIFIERS.append(modifier)
  82.             return(','.join(incorrect_LLWW_MODIFIERS))
  83.         else:
  84.             return(None)
  85.     else:
  86.         return(None)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement