
    9lh                         d dl Z d Zd Zy)    Nc           	      x   t        d|  d       t        j                  j                  |       st        d|  d       y	 t	        | d      5 }t        |      D ]'  \  }}t        d|dz    d	|j                                 ) 	 ddd       y# 1 sw Y   yxY w# t        $ r}t        d
|        Y d}~yd}~ww xY w)z
    Reads an ASCII file line by line and prints each line.
    Useful for simple text files or when processing each line individually.
    z
--- Reading 'z' line by line ---Error: File '' not found.NrzLine    : z.An error occurred while reading line by line: )printospathexistsopen	enumeratestrip	Exception)filenamefline_numlinees        #/home/jorge/python2Nc/EtaLibrary.pyread_ascii_line_by_liner      s    
 
OH:%7
8977>>(#hZ|45D(C A"+A,$hl^2djjl^<= #/ !    D>qcBCCDs6    B 6BB BB B 	B9!B44B9c                     t        d|  d       t        j                  j                  |       st        d|  d       yi }g d}	 t	        | d      5 }|D ]l  }|j                         j                         }|st        d| d	        ddd       y	 |j                  d
      d   j                         }t        |      ||<   n |j                         j                         }|j                         j                         }	|r|	st        d       	 ddd       y	 t        |      |d<   t        |	      |d<   	 ddd       t        d       |j                         D ]  \  }}
t        d| d|
         |S # t        t        f$ r'}t        d| d| d|        Y d}~ ddd       yd}~ww xY w# t        $ r&}t        d| d|	 d|        Y d}~ddd       yd}~ww xY w# 1 sw Y   xY w# t        $ r}t        d|        Y d}~yd}~ww xY w)z
    Reads specific grid information (west, east, north, south, res)
    and two subsequent integer values from an ASCII file.
    z-
--- Reading specific grid information from 'z' ---r   r   N)westeastnorthsouthresr   z-Error: Unexpected end of file while reading 'z'.=r   zError parsing line for 'z': 'z' - z;Error: Unexpected end of file while reading integer values.nlonsnlatszError parsing integer values: 'z', 'z
Parsed Grid Information:z  r   zAn unexpected error occurred: )r	   r
   r   r   r   readliner   splitfloat
IndexError
ValueErrorintitemsr   )r   	grid_infoexpected_keysr   keyr   	value_strr   line1line2values              r   read_specific_grid_infor/      s   
 
:8*E
JK77>>(#hZ|45I=M((C A$zz|))+I#bQR !   $

3 2 8 8 :I%*9%5IcN % JJL&&(EJJL&&(EST- ! 0%(Z	'"%(Z	'"5 !> 	*+#//+JCBse2eW%& , / #J/  4SEdV4sKL !    7wd5'aSQR; ! 67 ! J  .qc23s   G, 6G G, 0E5AG G, F.7=G, 5F+F&G G, &F++G .	G7GG G, GG  G)%G, ,	H5HH)r
   r   r/        r   <module>r2      s    	D"5r1   