pvt
Extracts PVT related keyword data from the PROPS section in a .DATA file,
typically the keywords PVTO
, PVDG
, DENSITY
and ROCK
. Data from
all keywords will be merged into one common dataframe.
Example usage:
from res2df import pvt, ResdataFiles
resdatafiles = ResdataFiles("MYDATADECK.DATA")
dframe = pvt.df(resdatafiles)
Alternatively, we may also read directly from an include file if we read the contents of the file and supply it as a string:
dframe = pvt.df(open("pvt.inc").read())
PRESSURE |
VOLUMEFACTOR |
VISCOSITY |
RS |
PVTNUM |
KEYWORD |
OILDENSITY |
WATERDENSITY |
GASDENSITY |
COMPRESSIBILITY |
VISCOSIBILITY |
---|---|---|---|---|---|---|---|---|---|---|
225.0 |
0.005337 |
0.024823 |
1 |
PVDG |
||||||
250.0 |
0.004914 |
0.026682 |
1 |
PVDG |
||||||
275.0 |
0.004584 |
0.028475 |
1 |
PVDG |
||||||
300.0 |
0.00432 |
0.030194 |
1 |
PVDG |
||||||
325.0 |
0.004104 |
0.031837 |
1 |
PVDG |
||||||
350.0 |
0.003925 |
0.033408 |
1 |
PVDG |
||||||
375.0 |
0.003773 |
0.034915 |
1 |
PVDG |
||||||
400.0 |
0.003643 |
0.036365 |
1 |
PVDG |
||||||
420.0 |
0.003551 |
0.03749 |
1 |
PVDG |
||||||
500.0 |
0.00333 |
0.04208 |
1 |
PVDG |
||||||
600.0 |
0.003232 |
0.0466 |
1 |
PVDG |
||||||
700.0 |
0.0032059 |
0.050177 |
1 |
PVDG |
||||||
1 |
DENSITY |
827.64 |
999.04 |
1.1427 |
||||||
327.3 |
1 |
ROCK |
4.5e-05 |
|||||||
327.3 |
1.03 |
0.25 |
1 |
PVTW |
4.51e-05 |
0.0 |
If your PVT data resides in multiple include files, but you can’t import the entire deck, you have to merge the dataframes in Python like this:
import pandas as pd
pvto = pvt.df(open("pvto.inc").read())
density = pvt.df(open("density.inc").read())
pvt_df = pd.concat([pvto, density], ignore_index=True)
Transforming PVT data
Care should be taken when perturbing PVT data, as a lot of the data values depend on each other for physical consistency.
A simple example could be to scale the viscosity values up or down with some scalar amount:
# Scale up all viscosity values by 10%
dframe["VISCOSITY"] = dframe["VISCOSITY"] * 1.1
Possibly, different viscosity scaling pr. PVTNUM is needed
# Scale up all viscosity values by 10% in PVTNUM 1 and by 5% in 2
pvtnum1_rows = dframe["PVTNUM"] == 1
pvtnum2_rows = dframe["PVTNUM"] == 2
dframe.loc[pvtnum1_rows, "VISCOSITY"] = dframe.loc[pvtnum1_rows, "VISCOSITY"] * 1.05
(there are many ways of doing operation on specific PVTNUMs in Pandas, pick your favourite).
Density values are easier to scale up or down to whatever is needed.
Re-exporting tables to include files
When you are done with the table, you can generate new include files from your modified data by issuing
pvt.df2res(dframe, filename="pvt.inc")
When injecting this produced pvt.inc
into any new .DATA file, ensure you
check which keywords have been written out, compared to what you gave in to
res2df.pvt above. Any non-supported keywords will get lost in the import phase
and need to be catered for outside res2df.
The last step can also be done using the csv2res
command line utility
if you dump to CSV from your Python code instead.