#NEWLINE# def createReferencedMD( self ) : #NEWLINE# #INDENT# self . log ( 'Creating reference mosaic datasets:' , self . const_general_text ) #NEWLINE# for k in self . dic_derive_lst . keys ( ) : #NEWLINE# #INDENT# for r in self . dic_derive_lst [ k ] [ 'ref' ] . keys ( ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# mdPath = os . path . join ( self . m_base . m_geoPath , r ) #NEWLINE# inMosaic = self . dic_derive_lst [ k ] [ 'key' ] #NEWLINE# refMosaic = os . path . join ( self . m_base . m_geoPath , r ) #NEWLINE# self . log ( ( 'Creating MD:' + r ) , self . const_general_text ) #NEWLINE# if ( not arcpy . Exists ( mdPath ) ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# if ( len ( self . dic_ref_info ) > 0 ) : #NEWLINE# #INDENT# in_dataset = self . m_base . getInternalPropValue ( self . dic_ref_info , 'in_dataset' ) #NEWLINE# ( _p , _f ) = os . path . split ( in_dataset ) #NEWLINE# if ( ( _p == '' ) and ( _f != '' ) ) : #NEWLINE# #INDENT# in_dataset = os . path . join ( self . m_base . m_geoPath , _f ) #NEWLINE# #UNINDENT# arcpy . CreateReferencedMosaicDataset_management ( in_dataset , refMosaic , self . srs , self . m_numBands , self . pixel_type , self . m_base . getInternalPropValue ( self . dic_ref_info , 'where_clause' ) , self . m_base . getInternalPropValue ( self . dic_ref_info , 'in_template_dataset' ) , self . m_base . getInternalPropValue ( self . dic_ref_info , 'extent' ) , self . m_base . getInternalPropValue ( self . dic_ref_info , 'select_using_features' ) , self . m_base . getInternalPropValue ( self . dic_ref_info , 'lod_field' ) , self . m_base . getInternalPropValue ( self . dic_ref_info , 'minPS_field>' ) , self . m_base . getInternalPropValue ( self . dic_ref_info , 'maxPS_field>' ) , self . m_base . getInternalPropValue ( self . dic_ref_info , 'pixelSize' ) , self . m_base . getInternalPropValue ( self . dic_ref_info , 'build_boundary' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# arcpy . CreateReferencedMosaicDataset_management ( inMosaic , refMosaic , self . srs , '' , self . pixel_type , '' , '' , '' , '' , '' , '' , '' , '' , 'NO_BOUNDARY' ) #NEWLINE# #UNINDENT# #UNINDENT# except : #NEWLINE# #INDENT# self . log ( ( '\tFailed to create refrence MD  ' + r ) , self . const_warning_text ) #NEWLINE# self . log ( arcpy . GetMessages ( ) , self . const_warning_text ) #NEWLINE# #UNINDENT# #UNINDENT# first_time = True #NEWLINE# for fnc in self . dic_derive_lst [ k ] [ 'ref' ] [ r ] : #NEWLINE# #INDENT# self . log ( ( ( ( '\t\tAdding raster function: ' + r ) + '->' ) + os . path . basename ( fnc ) ) , self . const_general_text ) #NEWLINE# try : #NEWLINE# #INDENT# arcpy . EditRasterFunction_management ( refMosaic , 'EDIT_MOSAIC_DATASET' , ( 'REPLACE' if first_time else 'INSERT' ) , fnc ) #NEWLINE# first_time = False #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# self . log ( ( '\t\t\tFailed to add raster function  ' + fnc ) , self . const_warning_text ) #NEWLINE# self . log ( arcpy . GetMessages ( ) , self . const_warning_text ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# except Exception as inst : #NEWLINE# #INDENT# self . log ( ( 'Failed to create/edit raster function reference mosaic dataset: ' + r ) , self . const_critical_text ) #NEWLINE# self . log ( arcpy . GetMessages ( ) , self . const_critical_text ) #NEWLINE# return False #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return True