U
    ҳg                     @   s   d d Z dS )c           6      C   s  dd l }dd l}ddlm} dd l}dd l}ddlm} ddlm} ddlm	} dd l
}dd l}dd l}ddlm} ddlm} ddlm} dd	lm} dd
lm} ddlm} |t| }| d | d }||d}|j\}}|} |}!d}"g }#g }$|tt|t|  }%|tt|t|  }&d}'| D ]x\}(})|(ddkrZd}' q|)d }*|)d }+t|*}*t|+}+t|+|! |% },t| |* |& }-|#|, |$|- q8|'dkrg }#g }$d}.| D ]\}(})dt|. }/|.d }.z`||/ })|)d }*|)d }+t|*}*t|+}+t|+|! |% },t| |* |& }-|#|, |$|- W nh   |d })|)d }*|)d }+t|*}*t|+}+t|+|! |% },t| |* |& }-|#|, |$|- Y nX q|| ||||#|$}0g }1tdD ]}2|1|2 qd}"d}"|	D ]}3t d|3 d}"z|3dkr6|!| ||3|
}4|| ||3|}5n|"| ||3|
}4|| ||3|}5|#d$d$| $|$d$|3$|%t|5 d}"W n   t |&  Y nX |3dkr|3dk n|3dkrd}3|| |3| q|
S )N    )Path)Image)merge_contour_images)octave)credentials)db)create_index_piechart)create_soc_piechart)merge_mask_img)estimate_yield/z/TCI.png   P_Latitude	Longitudea   Z	imagenamesocPaidMonitoredFieldsPMFHealthtciTCIetciETCI)'mathmatplotlib.pathr   numpycv2PILr   r   oct2pyr   collections	tracebackfirebase_adminr   r   r   r	   r
   r   OrderedDictsorteditemsimreadshapeabsfloatfindroundappendstrcreate_polymaskrangeprintZcalc_soc_indicesZcalc_indices2	referencechildset
format_exc)6uidfieldidcoordinates	imagedatefieldmaxlatfieldminlatfieldmaxlongfieldminlongZ	crop_typeimages_arrayZmain_field_arear   
matplotlibr   npr   r   r   r   r!   r"   r#   r   r   r   r	   r
   r   tci_file_namer   w_tcih_tcizero_lat	zero_longwes1XYpixelsperlatpixelsperlongpformatflagkvtemp_lat	temp_longxyplocpointKeypoly_mZ
yieldIndexi	imageNamec2index_value rY   */home/ankuromar296_gmail_com/map_coords.py
map_coords   s    






8


r[   N)r[   rY   rY   rY   rZ   <module>       