Metadata-Version: 2.4
Name: pygridsio3d
Version: 0.1.0
Summary: can make I,J,K slice plots of grdecl files and create samples of the grid for use in pygridsio
License: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pygridsio>=1.1.3
Dynamic: license-file

# pygridsio3d

## Introduction

This is a lightweight library to read VOXET and GRDECL ASCII files and to plot the grid in 2D sections and map view.
It can only read simple GRDECL files that use COORD and ZCORN. 
It is primarily intended for quick visualization and exploration of simple GRDECL files, 
and is not a full-featured GRDECL parser or grid engine.

## Installation

pygridsio3d is available via the pypi package registry:

`pip install pygridsio3d`

## Usage

examples code to read a grdecl file and plot i,j,k sections:

```python
from pygridsio3d import read_grid3d
from pygridsio3d import plot_vertical_jslice, plot_vertical_islice, plot_horizontal_kslice
from pathlib import Path

read_keys = ['PERMX', 'PORO', 'FACIES']
demo_path = Path(__file__).resolve().parent / 'demo_data' / 'your_grdecl_file.grdecl'
g = read_grid3d(demo_path, read_keys=read_keys)

i_index = 16
j_index = 16
k_index = 100

output_data_path = Path(__file__).resolve().parent / 'output_data'
output_data_path.mkdir(parents=True, exist_ok=True)

proplabel = 'PERMX'

out_jslice = output_data_path / f'{proplabel}_jslice{j_index}.png'
out_islice = output_data_path / f'{proplabel}_islice{i_index}.png'
out_kslice = output_data_path / f'{proplabel}_kslice{k_index}.png'

plot_vertical_jslice(g,j_index=j_index, proplabel=proplabel, out=out_jslice,
                       title=f'J-slice {j_index} colored by {proplabel}')
plot_vertical_islice(g, i_index=i_index, proplabel=proplabel, out=out_islice,
                       title=f'I-slice {i_index} colored by {proplabel}')
plot_horizontal_kslice(g, k_index=k_index, proplabel=proplabel, out=out_kslice,
                         title=f'K-slice {k_index} colored by {proplabel}')
```

In extension to evaluate a summation of thickness weighted permeability in the vertical direction:

```python
from pygridsio3d import Grid3dFunc
from pygridsio import plot_grid

gr_func = Grid3dFunc(g)
# create a basemask which ignores the first layer of the grid
basemask = gr_func.init_basemask(klow=1)
# modify the Grdecl actnum for plotting sections as well
g.set_mask(basemask)
masklabel = 'FACIES'
mask = gr_func.get_custom_mask(property_key=masklabel, property_value=2)
grid_thick = gr_func.get_sumthick(mask)
grid_d = gr_func.get_average_depth(mask)
plot_grid(grid_thick)
plot_grid(grid_d)
proplabel = 'PERMX'
grid_kh = gr_func.get_sumthick_prop(mask, property_key=proplabel)
grid_kh_d = gr_func.get_average_depth_prop(mask, property_key=proplabel)
plot_grid(grid_kh)
plot_grid(grid_kh_d)
```

