
    ZfY
                     0    d Z ddlZddlZg dZg dZddZy)z8Utilities to grab template content for processing steps.    N)	load_datamodify_networkinvert_networkderampvelocitygeocodegoogle_earth)r   r   reference_pointquick_overviewcorrect_unwrap_errorr   correct_LODcorrect_SETcorrect_ionospherecorrect_tropospherer   correct_topographyresidual_RMSreference_dater   r   r	   hdfeos5c                     ddl }| t        vrt        d|  dt               |Gt        j                  j                  t        j                  j                  |j                        d      }t        |      j                         }|D cg c]  }|j                  d       }}d| z   }|D cg c]*  }t        j                  ||      s|j                  |      , }}t        |      dkD  r	|d   dz   }	nt        d	| d
| d      d}
t        |	dz   t        |            D ]  }||   j!                  d      s|}
 n dj                  fd||	|
 D              }|j#                         }|rd|z   dz   }|S c c}w c c}w )a  Grab the related template content for each step
    To avoid duplication in each utility script.

    Parameters: step_name     - str, step name
                template_file - str, path of the template file
    Returns:    step_content  - str, comments and options of the step
    r   Nzinput step name "z" not found! STEP_LIST=zdefaults/smallbaselineApp.cfg z!^##########[ ]?\d{0,2}\.*\d{0,2}    z	pattern "z" is not found in file: !z##########  c              3   .   K   | ]  }d z  |z     yw)r   N ).0lineindentations     Q/home/exouser/operations/rsmas_insar/tools/MintPy/src/mintpy/defaults/template.py	<genexpr>z'get_template_content.<locals>.<genexpr>R   s     Od3{?T1Os   ztemplate options:

)mintpy	STEP_LIST
ValueErrorospathjoindirname__file__open	readlinesstriprematchindexlenrange
startswithrstrip)	step_nametemplate_filer   header_footerr#   linesr   patternindsind0ind1istep_contents     `          r    get_template_contentr?   .   s~     	!,YK7NykZ[[ RWW__V__%EGfg))+E)./TZZ_/E/ 3Y>G*/K$288GT3JEKKKDK
4y1}Aw{9WI-Em_TUVWW D463u:& 8}-D 77OeD>NOOL&&(L,|;dB/ 0 Ls   	E6,E;E;)N   T)__doc__r&   r.   STEP_LIST4OFFSETr$   r?   r       r    <module>rD      s$    > 
 	 	,)rC   