#NEWLINE# def ReloadMD( ) : #NEWLINE# #INDENT# arcpy . AddMessage ( 'Removing previous forecast data from mosaic dataset...' ) #NEWLINE# arcpy . RemoveRastersFromMosaicDataset_management ( inputMD , '1=1' ) #NEWLINE# arcpy . AddMessage ( 'Adding new forecast data to mosaic dataset...' ) #NEWLINE# arcpy . AddRastersToMosaicDataset_management ( inputMD , 'Raster Dataset' , forecastGDBPath ) #NEWLINE# result = int ( arcpy . GetCount_management ( inputMD ) . getOutput ( 0 ) ) #NEWLINE# if ( result > 0 ) : #NEWLINE# #INDENT# arcpy . AddMessage ( 'Calculating statistics on the newly loaded mosaic dataset' ) #NEWLINE# arcpy . CalculateStatistics_management ( inputMD ) #NEWLINE# arcpy . AddMessage ( 'Calculating the time fields on the mosaic dataset' ) #NEWLINE# locale . setlocale ( locale . LC_TIME , '' ) #NEWLINE# mdLayer = 'mdLayer' #NEWLINE# arcpy . MakeMosaicLayer_management ( inputMD , mdLayer , 'Category = 1' ) #NEWLINE# arcpy . CalculateField_management ( mdLayer , dateForecastImportedField , 'time.strftime("%c")' , 'PYTHON' , '#' ) #NEWLINE# arcpy . CalculateField_management ( mdLayer , dateForecastEffectiveFromField , ( ( ( 'time.strftime("%c", time.strptime(!Name!,' + '"' ) + weatherName ) + '%Y%m%dT%H%M"))' ) , 'PYTHON' , '#' ) #NEWLINE# arcpy . CalculateField_management ( mdLayer , dateForecastEffectiveToField , ( ( '!' + dateForecastEffectiveFromField ) + '!' ) , 'PYTHON' , '#' )