Beispiel #1
0
 def test_axis_header(self):
     templ = uio.project_templates(PlotTestCase.wp.project_table)
     fig, ax = plt.subplots()
     log_types = ['P velocity', 'Density', 'Caliper', 'Resistivity']
     limits = [[templ[x]['min'], templ[x]['max']] for x in log_types]
     legends = ['test [{}]'.format(templ[x]['unit']) for x in log_types]
     styles = [{
         'lw': templ[x]['line width'],
         'color': templ[x]['line color'],
         'ls': templ[x]['line style']
     } for x in log_types]
     header_plot(ax, limits, legends, styles)
     plt.show()
     with self.subTest():
         self.assertTrue(True)
Beispiel #2
0
 def test_plot_logs(self):
     from blixt_utils.io.io import invert_well_table
     w = PlotTestCase.w
     templates = uio.project_templates(PlotTestCase.wp.project_table)
     ppl.plot_logs(w,
                   invert_well_table(PlotTestCase.well_table,
                                     'WELL_D',
                                     rename=False),
                   PlotTestCase.wis,
                   "SAND E",
                   templates,
                   buffer=50.)
     #savefig='C:/users/mblixt/PycharmProjects/blixt_rp/results_folder/test.png')
     #savefig='C:/Users/marten/PycharmProjects/blixt_rp/results_folder/test.png')
     with self.subTest():
         self.assertTrue(True)
Beispiel #3
0
    def test_axis_plot(self):
        templ = uio.project_templates(PlotTestCase.wp.project_table)
        fig = plt.figure()
        ax = fig.add_subplot(2, 2, 1)
        log_types = ['Gamma ray', 'Caliper']
        limits = [[templ[x]['min'], templ[x]['max']] for x in log_types]
        data = [PlotTestCase.w.get_logs_of_type(x)[0].data for x in log_types]
        y = PlotTestCase.w.block['Logs'].logs['depth'].data
        styles = [{
            'lw': templ[x]['line width'],
            'color': templ[x]['line color'],
            'ls': templ[x]['line style']
        } for x in log_types]
        axis_plot(ax, y, data, limits, styles, nxt=2)

        plt.show()
def main():
    # Create a project
    wp = Project(
        name='FluidSub',
        project_table='excels/project_table.xlsx')

    # Load wells
    wells = wp.load_all_wells(block_name='FBlock')
    w = wells['WELL_F']

    # Load working intervals and templates
    wis = uio.project_working_intervals(wp.project_table)
    templates = uio.project_templates(wp.project_table)

    # Load fluids
    myfluids = FluidMix()
    myfluids.read_excel(wp.project_table)
    print(myfluids.print_all_fluids())

    # Load minerals
    mymins = MineralMix()
    mymins.read_excel(wp.project_table)
    print(mymins.print_all_minerals())

    # Fluid substitution
    cutoffs = {'Volume': ['<', 0.5], 'Porosity': ['>', 0.1]}
    log_table = {'P velocity': 'vp_dry', 'S velocity': 'vs_dry', 'Density': 'rho_dry',
                 'Porosity': 'phie', 'Volume': 'vcl'}

    tag = 'fs'  # tag the resulting logs after fluid substitution
    rp.run_fluid_sub(wells, log_table, mymins, myfluids, cutoffs, wis, tag, templates=templates, block_name='FBlock')

    # plot results
    fig, ax = plt.subplots(figsize=(10, 8))
    log_table = {'P velocity': 'vp_dry', 'S velocity': 'vs_dry', 'Density': 'rho_dry',
                 'Porosity': 'phie', 'Volume': 'vcl'}
    templates['WELL_F']['color'] = 'b'
    prp.plot_rp(wells, log_table, wis, 'SAND E', cutoffs, templates, fig=fig, ax=ax, edge_color=False, show_masked=True,
                block_name='FBlock')

    # specify the new logs coming from the fluid substitution
    log_table = {'P velocity': 'vp_dry_fs', 'S velocity': 'vs_dry_fs', 'Density': 'rho_dry_fs',
                 'Porosity': 'phie', 'Volume': 'vcl'}
    templates['WELL_F']['color'] = 'r'
    prp.plot_rp(wells, log_table, wis, 'SAND E', cutoffs, templates, fig=fig, ax=ax, edge_color=False,
                block_name='FBlock')

    # specify the new logs coming from the RokDoc fluid substitution stored in the las file
    log_table = {'P velocity': 'vp_so08', 'S velocity': 'vs_so08', 'Density': 'rho_so08',
                 'Porosity': 'phie', 'Volume': 'vcl'}
    templates['WELL_F']['color'] = 'g'
    prp.plot_rp(wells, log_table, wis, 'SAND E', cutoffs, templates, fig=fig, ax=ax, edge_color=False,
                block_name='FBlock')

    del(wells['WELL_F'].block['FBlock'].logs['rho_so08'])
    del(wells['WELL_F'].block['FBlock'].logs['rho_sg08'])
    wells['WELL_F'].depth_plot('Density')


    # Save results
    for well in wells.values():
        uio.write_las(
            os.path.join(wp.working_dir, 'results_folder', '{}.las'.format(well.well)),
            well.header,
            well.block['FBlock'].header,
            well.block['FBlock'].logs
        )

    plt.show()
Beispiel #5
0
def test():
    from core.well import Project
    import blixt_utils.io.io as uio
    from core.minerals import MineralMix
    wi_name = 'SAND E'

    plot_type = 'AI-VpVs'
    ref_val = [2695., 1340., 2.35]  # Kvitnos shale

    fig, ax = plt.subplots()

    wp = Project()
    log_table = {
        'P velocity': 'vp_dry',
        'S velocity': 'vs_dry',
        'Density': 'rho_dry',
        'Porosity': 'phie',
        'Volume': 'vcl'
    }
    wis = uio.project_working_intervals(wp.project_table)
    templates = uio.project_templates(wp.project_table)
    cutoffs = {'Volume': ['<', 0.4], 'Porosity': ['>', 0.1]}
    wells = wp.load_all_wells()
    plot_rp(wells,
            log_table,
            wis,
            wi_name,
            cutoffs,
            templates,
            plot_type=plot_type,
            ref_val=ref_val,
            fig=fig,
            ax=ax)

    # Calculate average properties of mineral mix in desired working interval
    mm = MineralMix()
    mm.read_excel(wp.project_table)
    _rho_min = np.ones(0)  # zero length empty array
    _k_min = np.ones(0)
    _mu_min = np.ones(0)
    for well in wells.values():
        # calculate the mask for the given cut-offs, and for the given working interval
        well.calc_mask(cutoffs,
                       wis=wis,
                       wi_name=wi_name,
                       name='this_mask',
                       log_table=log_table)
        mask = well.block['Logs'].masks['this_mask'].data

        _rho_min = np.append(
            _rho_min,
            well.calc_vrh_bounds(mm, param='rho', wis=wis,
                                 method='Voigt')[wi_name][mask])
        _k_min = np.append(
            _k_min,
            well.calc_vrh_bounds(mm,
                                 param='k',
                                 wis=wis,
                                 method='Voigt-Reuss-Hill')[wi_name][mask])
        _mu_min = np.append(
            _mu_min,
            well.calc_vrh_bounds(mm,
                                 param='mu',
                                 wis=wis,
                                 method='Voigt-Reuss-Hill')[wi_name][mask])

    rho_min = np.nanmean(_rho_min)
    k_min = np.nanmean(_k_min)
    mu_min = np.nanmean(_mu_min)

    phi = np.linspace(0.05, 0.3, 6)
    sw = np.array([0.8, 0.95, 1.])
    sizes = np.empty((sw.size, phi.size))
    colors = np.array([np.ones(6) * 100 * (i + 1)**2 for i in range(3)]) / 900.
    # iterate over all phi values
    for i, val in enumerate(phi):
        sizes[:, i] = 10 + (40 * val)**2

    xx, yy = plot_rpt(phi,
                      rpt_phi_sw,
                      sw, {
                          'plot_type': plot_type,
                          'ref_value': ref_val,
                          'model': 'stiff',
                          'rho_min': rho_min,
                          'k_min': k_min,
                          'mu_min': mu_min
                      },
                      sizes,
                      colors,
                      fig=fig,
                      ax=ax)

    # Annotate rpt
    dx = 0
    dy = 0.0
    plt.text(xx[-1][-1] + dx, yy[-1][-1] + dy,
             '$\phi={:.02f}$'.format(phi[-1]), **opt1)
    plt.text(xx[-1][0] + dx, yy[-1][0] + dy, '$\phi={:.02f}$'.format(phi[0]),
             **opt1)
    for i, _sw in enumerate(sw):
        plt.text(xx[i][-1] + dx, yy[i][-1] + dy, '$S_w={:.02f}$'.format(_sw),
                 **opt2)

    plt.show()