pyfas
pyfas copied to clipboard
Filetring data in tpl file
Hello i have an issue with filtering data in tpl file, i have used the same tpl file shown in the examples, hereafter my code lines : import pyfas as fa import pandas as pd import matplotlib.pyplot as plt tpl_path = 'XX/XX/XX' fname = '11_2022_BD.tpl' tpl=fa.Tpl(tpl_path+fname) tpl.filter_data("PT") i got the error 'Tpl' object has no attribute 'filter_data' all the steps are working except the last one.
Hi, just checked. The documentation is not updated, for consistency the the filter_data
method has been modified and renamed view_trends
. It works like below:
In [6]: import pyfas as fa
In [7]: tpl = fa.Tpl('125.tpl')
In [8]: tpl.view_trends()
Out[8]:
Index Variable Position Unit Description
Filter:
0 1 VOLGBL GLOBAL - Global max volume error since last write
1 2 HT GLOBAL S Time step
2 3 HOL SECTION - Br - PIPELINE - PIPE - PIPE-1 - NR - 1 - Holdup (liquid volume fraction including solids)
3 4 HOLWT SECTION - Br - PIPELINE - PIPE - PIPE-1 - NR - 1 - Water volume fraction
4 5 ID BOUNDARY - Br - PIPELINE - PIPE - PIPE-1 - NR (-)
5 6 PT SECTION - Br - PIPELINE - PIPE - PIPE-1 - NR - 1 PA Pressure
6 7 OILC Br - PIPELINE M3 Total oil content in branch
7 8 WATC Br - PIPELINE M3 Total water content in branch
8 9 GASC Br - PIPELINE M3 Gas content in branch
9 10 OILCFR Br - PIPELINE - Oil volume fraction in branch
10 11 WATCFR Br - PIPELINE - Water volume fraction in branch
11 12 GASCFR Br - PIPELINE - Gas volume fraction in branch
12 13 QT BOUNDARY - Br - PIPELINE - PIPE - PIPE-1 - NR - 2 M3/S Total volume flow
13 14 QG BOUNDARY - Br - PIPELINE - PIPE - PIPE-1 - NR - 2 M3/S Gas volume flow
14 15 QLT BOUNDARY - Br - PIPELINE - PIPE - PIPE-1 - NR - 2 M3/S Total liquid volume flow
15 16 QLTHL BOUNDARY - Br - PIPELINE - PIPE - PIPE-1 - NR - 2 M3/S Volumetric flow rate oil
16 17 QLTWT BOUNDARY - Br - PIPELINE - PIPE - PIPE-1 - NR - 2 M3/S Volumetric flow rate water
17 18 QGST BOUNDARY - Br - PIPELINE - PIPE - PIPE-1 - NR - 2 SM3/S Gas volume flow at standard conditions
18 19 QOST BOUNDARY - Br - PIPELINE - PIPE - PIPE-1 - NR - 2 SM3/S Oil volume flow at standard conditions
19 20 QWTST BOUNDARY - Br - PIPELINE - PIPE - PIPE-1 - NR - 2 SM3/S Total water (liquid and vapour) volume flow at...
20 21 GT BOUNDARY - Br - PIPELINE - PIPE - PIPE-1 - NR - 2 KG/S Total mass flow
21 22 GG BOUNDARY - Br - PIPELINE - PIPE - PIPE-1 - NR - 2 KG/S Gas mass flow
22 23 GL BOUNDARY - Br - PIPELINE - PIPE - PIPE-1 - NR - 2 KG/S Liquid bulk mass flow
23 24 GTSOUR SOURCE - OIL_SOURCE KG/S Source mass rate
24 25 GTSOUR SOURCE - WATER_SOURCE KG/S Source mass rate
In [9]: tpl.view_trends('Q')
Out[9]:
Index Variable Position Unit Description
Filter: Q
0 13 QT BOUNDARY - Br - PIPELINE - PIPE - PIPE-1 - NR - 2 M3/S Total volume flow
1 14 QG BOUNDARY - Br - PIPELINE - PIPE - PIPE-1 - NR - 2 M3/S Gas volume flow
2 15 QLT BOUNDARY - Br - PIPELINE - PIPE - PIPE-1 - NR - 2 M3/S Total liquid volume flow
3 16 QLTHL BOUNDARY - Br - PIPELINE - PIPE - PIPE-1 - NR - 2 M3/S Volumetric flow rate oil
4 17 QLTWT BOUNDARY - Br - PIPELINE - PIPE - PIPE-1 - NR - 2 M3/S Volumetric flow rate water
5 18 QGST BOUNDARY - Br - PIPELINE - PIPE - PIPE-1 - NR - 2 SM3/S Gas volume flow at standard conditions
6 19 QOST BOUNDARY - Br - PIPELINE - PIPE - PIPE-1 - NR - 2 SM3/S Oil volume flow at standard conditions
7 20 QWTST BOUNDARY - Br - PIPELINE - PIPE - PIPE-1 - NR - 2 SM3/S Total water (liquid and vapour) volume flow at...
In [10]:
Thank you for your reply, it is working now indeed, however i still have an issue when using the command :
tpl.view_trends('PT')
i can not see the pressure trend position, only dots, as you see below :
Index Variable ... Unit Description
Filter: PT ...
0 3 PT ... PA Pressure
1 5 PT ... PA Pressure
2 9 PT ... PA Pressure
A bit difficult to understand like this, what are you using to call view_trends
, a plane python console or maybe ipython?
view_trends
returns a pandas dataframe, you can check whether other data-frames are correctly visualized.
To force the full visualization you can use this:
import pandas as pd
pd.set_option('display.max_columns', None)