#NEWLINE# @ classmethod #NEWLINE# def from_namfile_header( cls , namefile ) : #NEWLINE# #INDENT# header = [ ] #NEWLINE# with open ( namefile , 'r' ) as f : #NEWLINE# #INDENT# for line in f : #NEWLINE# #INDENT# if ( not line . startswith ( '#' ) ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# header . extend ( line . strip ( ) . replace ( '#' , '' ) . split ( ',' ) ) #NEWLINE# #UNINDENT# #UNINDENT# ( xul , yul ) = ( None , None ) #NEWLINE# rotation = 0.0 #NEWLINE# proj4_str = 'EPSG:4326' #NEWLINE# start_datetime = '1/1/1970' #NEWLINE# for item in header : #NEWLINE# #INDENT# if ( 'xul' in item . lower ( ) ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# xul = float ( item . split ( ':' ) [ 1 ] ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( 'yul' in item . lower ( ) ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# yul = float ( item . split ( ':' ) [ 1 ] ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( 'rotation' in item . lower ( ) ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# rotation = float ( item . split ( ':' ) [ 1 ] ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( 'proj4_str' in item . lower ( ) ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# proj4_str = ':' . join ( item . split ( ':' ) [ 1 : ] ) . strip ( ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( 'start' in item . lower ( ) ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# start_datetime = item . split ( ':' ) [ 1 ] . strip ( ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return ( cls ( xul = xul , yul = yul , rotation = rotation , proj4_str = proj4_str ) , start_datetime )