Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRAFT: wellspec with dtop dbot #751

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion resqpy/well/_blocked_well.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,38 @@ def set_for_column(self, well_name, grid, col_ji0, skip_inactive = True, length_

return self.derive_from_dataframe(df, self.well_name, grid, use_face_centres = True, length_uom = length_uom)

def dtop_dbot_to_layers(self, df, grid):
"""Populates the wellspec dataframe with corresponding L when DTOP and DBOT are specified but L is not
arguments
df (pd.DataFrame): Dataframe of wellspec information
grid (grid.Grid object): Grid where well is located
returns
df_expanded (pd.DataFrame): DataFrame of wellspec information where L is populated with the layers corresponding to the DTOP and DBOT depths
"""
corp = grid.corner_points()
nk,nj,ni = corp.shape[:3]
df_expanded = []

for ix,data in df.iterrows():
if np.isnan(data['L']):
dtop = data['DTOP']
dbot = data['DBOT']
j,i = int(data['JW']), int(data['IW'])
for k in range(nk):
if dbot == 'BOT':
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does DTOP need to be checked when 'BOT' is in use for DBOT? (I haven't looked in the manual!)

data['L'] = k + 1
df_expanded.append(data.copy())
elif (corp[k,j,i,0,:,:,2].min() >= dtop) and (corp[k,j,i,1,:,:,2].max() <= dbot):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will include cells that are fully within the dtop to dbot depth range. It would be better if we included cells that are partially in the range, though ideally with a PPERF being set too. Also, it might be slightly better to use the K-, K+ face mid points, rather than the corner points, as the definition of the cell depth range for this purpose.

The corp z units might be increasing upwards (ie. negative values), in which case the z values should be negated before applying this test. You can check the z axis direction in the boolean attribute: grid.crs.z_inc_down which is usually True but not always.

data['L'] = k + 1
df_expanded.append(data.copy())
else:
df_expanded.append(data.copy())

df_expanded = pd.DataFrame(df_expanded).reset_index(drop = True)
df_expanded[['IW','JW','L']] = df_expanded[['IW','JW','L']].astype(int)

return df_expanded

def derive_from_wellspec(self,
wellspec_file,
well_name,
Expand Down Expand Up @@ -626,7 +658,7 @@ def derive_from_wellspec(self,
name_for_check, col_list = rqwu._derive_from_wellspec_check_grid_name(check_grid_name = check_grid_name,
grid = grid,
col_list = col_list)

wellspec_dict, dates_list = wsk.load_wellspecs(wellspec_file,
well = well_name,
column_list = col_list,
Expand Down Expand Up @@ -757,6 +789,11 @@ def derive_from_dataframe(self,

angles_present = ('ANGLV' in df.columns and 'ANGLA' in df.columns and not pd.isnull(df.iloc[0]['ANGLV']) and
not pd.isnull(df.iloc[0]['ANGLA']))

dtop_dbot_present = ('DTOP' in df.columns and ~pd.isnull(df['DTOP']).all()) and ('DBOT' in df.columns and ~pd.isnull(df['DBOT']).all())

if dtop_dbot_present:
df = self.dtop_dbot_to_layers(df, grid)

if not angles_present and not use_face_centres:
log.warning(f'ANGLV and/or ANGLA data unavailable for well {well_name}: using face centres')
Expand Down
2 changes: 1 addition & 1 deletion resqpy/well/well_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def _derive_from_wellspec_verify_col_list(add_properties):
else:
col_list = []
else:
col_list = ['IW', 'JW', 'L', 'ANGLA', 'ANGLV']
col_list = ['IW', 'JW', 'L', 'ANGLA', 'ANGLV', 'DTOP', 'DBOT']
return col_list


Expand Down