o
    QpÆeÚ"  ã                   @   sF   d dl Z d dlZd dlZe j e  d¡d¡Zg d¢ZG dd„ dƒZdS )é    NZRSMASINSAR_HOMEzminsar/defaults/queues.cfg)
ZfronteraZ	stampede3ZcometZpegasusZeos_sanghoonZeoszeos
Zbeijing_serverZdeqing_serverZdqcentos7insarc                   @   sx   e Zd Zdd„ Zdd„ Zdd„ Zedd„ ƒZed	d
„ ƒZedd„ ƒZ	edd„ ƒZ
edd„ ƒZedd„ ƒZedd„ ƒZdS )ÚPathFindc                 C   s²   t  d¡d | _t  d¡| _t j d¡| _t j d¡| _t j d¡| _d| _	d| _
d	| _d
| _d| _d| _d| _d| _d| _d| _d| _d| _d| _t j d¡| _| jd | _d S )NZ
OPERATIONSz/LOGSÚ
SCRATCHDIRz"${RSMASINSAR_HOME}/minsar/defaultsz$SENTINEL_ORBITSz$SENTINEL_AUXzmerged/geom_referenceÚmiaplpyÚmintpyÚ	run_filesÚconfigsz
merged/SLCzmerged/interferogramsZgeom_reference_noDEMzSentinelWrapper.py -c zstripmapWrapper.py -c Ú	referenceÚstackÚimage_productsz1${RSMASINSAR_HOME}/minsar/defaults/dask/dask.yamlz/minsar_template.cfg)ÚosÚgetenvÚlogdirZ
scratchdirÚpathÚ
expandvarsÚ
defaultdirÚorbitdirÚauxdirZgeoreferencedirZ
miaplpydirZ	mintpydirÚrundirZ	configdirZmergedslcdirZmergedintdirZgeomlatlondirZwrappercommandtopsZwrappercommandstripmapZreferencedirZstackdirZtiffdirZ
daskconfigÚauto_template)Úself© r   úD/home/exouser/operations/rsmas_insar/minsar/objects/auto_defaults.pyÚ__init__   s*   zPathFind.__init__c                 C   s$   |dkrddgS |dkrddgS d S )NÚtopsztopsStack.subswathztopsStack.boundingBoxÚstripmapzstripmapStack.sensorzstripmapStack.boundingBoxr   )r   Úacquisition_moder   r   r   Úrequired_template_options%   s
   z"PathFind.required_template_optionsc                 C   sî   t |ƒ}|d |jd  dkr|jd |d |jd < |d |jd  dkr2|jd |d |jd < |d |jd  dkrG|j|d |jd < d|jvrRd	|d d< |jd
kru|d d dkrf| j|d d< |d d dkru| j|d d< d S )NÚtemplatezStack.slcDirÚautoz/SLCzStack.demDirz/DEMzStack.workingDirZcleanoptÚ0r   ztopsStack.orbitDirztopsStack.auxDir)ÚvarsÚprefixÚwork_dirr   r   r   )r   ÚinpsÚ	inps_dictr   r   r   Úset_isce_defaults-   s   

zPathFind.set_isce_defaultsc                 C   s   | j | jd  }|S )NzStack.boundingBox)r   r!   )r#   Úcropboxr   r   r   Úgrab_cropboxB   s   zPathFind.grab_cropboxc                 C   sP   | }d|v rt j  |d d¡ d¡|d< d|v r&t j  |d d¡ d¡|d< |S )Nzssaraopt.startDateú%Y%m%dú%Y-%m-%dzssaraopt.endDate)ÚdatetimeÚstrptimeÚstrftime)Ztemplate_optionsr$   r   r   r   Úcorrect_for_ssara_date_formatI   s   ÿÿz&PathFind.correct_for_ssara_date_formatc                  C   s>   g } |   g d¢¡ |   g d¢¡ |   dg¡ |   g d¢¡ | S )N)r	   ZmisregZorbitsZcoarse_interferogramsZESDZinterferogramsZ
secondarys)Zmergedr   Zcoreg_secondarysZ	baselinesZgeom_referenceZSLC)ZMINTPYr   r   ZDEM)Úappend)Z	cleanlistr   r   r   Úisce_clean_listX   s   zPathFind.isce_clean_listc                  C   ó   g d¢} | S )N)zvelocity.pngzavgSpatialCoherence.pngztemporalCoherence.pngzmaskTempCoh.pngzmask.pngzdemRadar_error.pngzvelocityStd.pngzgeo_velocity.pngzcoherence*.pngzunwrapPhase*.pngz$rms_timeseriesResidual_quadratic.pdfzCoherenceHistory.pdfzCoherenceMatrix.pdfzbl_list.txtzNetwork.pdfzgeo_velocity_masked.kmzztimeseries*.pngzgeo_timeseries*.pngr   )ZfileListr   r   r   Úget_email_file_listc   s   zPathFind.get_email_file_listc                  C   r0   )N)ZlatZlonZlosZhgtZ
shadowMaskZincLocalr   )Zlist_geor   r   r   Úget_geom_reference_listsl   s   z!PathFind.get_geom_reference_listsc                    s  i }| j D ]}| d¡s| d¡r| j | ||< qd| j d v r+d‰ g d¢}g d¢}n
d‰ g d¢}g d¢}‡ fd	d
„|D ƒ}t||ƒD ]\}}| |¡||< || dkrXd ||< qCˆ dkr‹|d dvrwt|d ƒ tj |d d¡ d¡|d< |d dvr‹tj |d d¡ d¡|d< |S )NÚ	topsStackÚstripmapStackr   r   )Úslc_directoryÚworking_directoryÚdemÚbboxÚreference_dateZtime_thresholdZbaseline_thresholdÚazimuth_looksÚrange_looksÚsensorZlow_band_frequencyZhigh_band_frequencyZsubband_bandwidthÚ
unw_methodÚfilter_strengthZfilter_sigma_xZfilter_sigma_yZfilter_size_xZfilter_size_yZfilter_kernel_rotationÚworkflowÚzeroÚnofocusÚtext_cmdÚuseGPU)ÚslcDirÚ
workingDirÚdemDirÚboundingBoxÚreferenceDateZtimeThresholdZbaselineThresholdÚazimuthLooksÚ
rangeLooksr<   ZLowBandFrequencyZHighBandFrequencyZsubbandBandwithÚ	unwMethodZgolsteinFilterStrengthZfilterSigmaXZfilterSigmaYZfilterSizeXZfilterSizeYZfilterKernelRotationr?   ZzerodoprA   ÚtextCmdrC   )r5   Zorbit_directoryZaux_directoryr6   r7   r9   Znum_connectionsZnum_overlap_connectionsÚ	swath_numr8   rB   Zexclude_datesZinclude_datesr:   r;   r>   Zesd_coherence_thresholdZsnr_misreg_thresholdr=   ÚpolarizationÚcoregistrationr?   Ú
start_dateÚ	stop_daterC   ÚrmFilterZnum_processZnum_process4topo)rD   ÚorbitDirÚauxDirrE   rF   rH   ZnumConnectionsZnumOverlapConnectionsZsubswathrG   rL   ZexcludeDatesZincludeDatesrI   rJ   ZfiltStrengthZesdCoherenceThresholdZsnrMisregThresholdrK   rN   rO   r?   Ú	startDateZstopDaterC   rR   Z
numProcessZnumProcess4topoc                    s   g | ]}ˆ d  | ‘qS )Ú.r   )Ú.0Úx©Zstackprefixr   r   Ú
<listcomp>™   s    z?PathFind.correct_for_isce_naming_convention.<locals>.<listcomp>ÚNonerP   )Nr   r(   r)   rQ   )r   Ú
startswithÚzipÚpopÚprintr*   r+   r,   )r#   r$   ÚitemZisceKeyZtemplateKeyZold_keyZnew_keyr   rY   r   Ú"correct_for_isce_naming_conventionq   sB   
€
€ÿÿÿÿz+PathFind.correct_for_isce_naming_conventionc                  C   s"   g d¢} d  | dd… ¡}| |fS )N)Zdownloadr7   ZifgramZ
timeseriesZuploadZ	insarmapsZimageProductsa}  Command line options for steps processing with names are chosen from the following list:
            {}

            In order to use either --start or --step, it is necessary that a
            previous run was done using one of the steps options to process at least
            through the step immediately preceding the starting step of the current run.
            
            r   é   )Úformat)Ú	STEP_LISTÚ	STEP_HELPr   r   r   Úprocess_rsmas_help«   s
   
ù	zPathFind.process_rsmas_helpN)Ú__name__Ú
__module__Ú__qualname__r   r   r%   Ústaticmethodr'   r-   r/   r1   r2   ra   rf   r   r   r   r   r      s$    






9r   )	r   r*   Úglobr   Újoinr   Zqueue_config_fileÚsupported_platformsr   r   r   r   r   Ú<module>   s   