Beispiel #1
0
        try:
            loc_info = db.location_info_disagg(exposure_db, exposure_name)
            loc_info['ExchangeRate_Original'] = copy.deepcopy(
                loc_info['ExchangeRate'])
            loc_info.loc[loc_info['CurrencyCode'] == 'USD',
                         'ExchangeRate'] = 1.0
            LOGGER.info('Exposure DB: ' + str(exposure_db))
            LOGGER.info('Exposure Name: ' + str(exposure_name))
        except:
            LOGGER.error('Error: Check the exposure db or exposure name')
            file_skeleton(OUTFILE)
            sys.exit()

        try:
            analysis_sid = db.analysis_sid(analysis_name)
            LOGGER.info('Analysis SID: ' + str(analysis_sid))
        except:
            LOGGER.error(
                'Error: Failed to extract the analysis SID from analysis name')
            file_skeleton(OUTFILE)
            sys.exit()

        try:
            staging_output = disaggregation.staging_table(
                analysis_sid, exposure_db)
            staging_output.to_csv(OUTFILE[:-4] + '-StagingTable.csv')
        except:
            LOGGER.error('Error: Failed to extract staging locations table')
            file_skeleton(OUTFILE)
            sys.exit()
        LOGGER.info('\n********** Log header **********\n')
        LOGGER.info('Description:   Analysis Option Validation')
        LOGGER.info('Time Submitted: ' + str(datetime.datetime.now()))
        LOGGER.info('Status:                Completed')

        LOGGER.info('\n********** Log Import Options **********\n')
        # Initialize the connection with the server
        try:
            db = Database(server)
        except:
            LOGGER.error('Error: Check connection to database server')
            file_skeleton(OUTFILE)
            sys.exit()

        try:
            analysis_sid = db.analysis_sid(analysis_name)
            LOGGER.info('Analysis SID: ' + str(analysis_sid))
        except:
            LOGGER.error('Error: Failed to extract the analysis SID from analysis name')
            file_skeleton(OUTFILE)
            sys.exit()

        try:
            analysis_information = db.analysis_option(analysis_sid)
        except:
            LOGGER.error('Error: Unable to fetch analysis option details')
            file_skeleton(OUTFILE)
            sys.exit()

        if analysis_information['AnalysisTypeCode'].values[0] in ['LGRP', 'IMPACT']:
            try:
Beispiel #3
0
            file_skeleton(OUTFILE)
            sys.exit()

        try:
            loc_info = db.location_info_disagg(exposure_db, exposure_name)
            loc_info['ExchangeRate_Original'] = copy.deepcopy(loc_info['ExchangeRate'])
            loc_info.loc[loc_info['CurrencyCode'] == 'USD', 'ExchangeRate'] = 1.0
            LOGGER.info('Exposure DB: ' + str(exposure_db))
            LOGGER.info('Exposure Name: ' + str(exposure_name))
        except:
            LOGGER.error('Error: Check the exposure db or exposure name')
            file_skeleton(OUTFILE)
            sys.exit()

        try:
            analysis_sid = db.analysis_sid(analysis_name)
            LOGGER.info('Analysis SID: ' + str(analysis_sid))
        except:
            LOGGER.error('Error: Failed to extract the analysis SID from analysis name')
            file_skeleton(OUTFILE)
            sys.exit()

        try:
            staging_output = disaggregation.staging_table(analysis_sid, exposure_db)
            staging_output.to_csv(OUTFILE[:-4] + '-StagingTable.csv')
        except:
            LOGGER.error('Error: Failed to extract staging locations table')
            file_skeleton(OUTFILE)
            sys.exit()

        try:
Beispiel #4
0
        LOGGER.info('\n********** Log header **********\n')
        LOGGER.info('Description:   Analysis Option Validation')
        LOGGER.info('Time Submitted: ' + str(datetime.datetime.now()))
        LOGGER.info('Status:                Completed')

        LOGGER.info('\n********** Log Import Options **********\n')
        # Initialize the connection with the server
        try:
            db = Database(server)
        except:
            LOGGER.error('Error: Check connection to database server')
            file_skeleton(OUTFILE)
            sys.exit()

        try:
            analysis_sid = db.analysis_sid(analysis_name)
            LOGGER.info('Analysis SID: ' + str(analysis_sid))
        except:
            LOGGER.error(
                'Error: Failed to extract the analysis SID from analysis name')
            file_skeleton(OUTFILE)
            sys.exit()

        try:
            analysis_information = db.analysis_option(analysis_sid)
        except:
            LOGGER.error('Error: Unable to fetch analysis option details')
            file_skeleton(OUTFILE)
            sys.exit()

        if analysis_information['AnalysisTypeCode'].values[0] in [