expreccs.utils.reg_sit_given_decks module#
Create a site deck with boundary pressures projected from existing decks.
The module reads regional and site OPM outputs, identifies corresponding boundary and regional cells, builds spatial and temporal interpolators, and writes BCCON, BCPROP, FIPNUM, and OPERNUM include files. Both rectangular and irregular site contours are supported, with optional FIPNUM-zone matching.
- class Regional(grid, init, rst, rfip, act, rdays)[source]#
Bases:
objectData required by the Regional workflow.
- Attributes:
- gridOpmGrid
Grid.
- initOpmFile
Init.
- rstOpmRestart
Rst.
- rfipNDArray
Rfip.
- actNDArray
Act.
- rdaysNDArray
Rdays.
- Parameters:
grid (EGrid)
init (EclFile)
rst (ERst)
rfip (NDArray)
act (NDArray)
rdays (NDArray)
- grid: EGrid#
- init: EclFile#
- rst: ERst#
- rfip: NDArray#
- act: NDArray#
- rdays: NDArray#
- class Site(grid, init, rst, sfip, sdata)[source]#
Bases:
objectData required by the Site workflow.
- Attributes:
- gridOpmGrid
Grid.
- initOpmFile
Init.
- rstOpmRestart
Rst.
- sfipNDArray
Sfip.
- sdatastr
Sdata.
- Parameters:
grid (EGrid)
init (EclFile)
rst (ERst)
sfip (NDArray)
sdata (str)
- grid: EGrid#
- init: EclFile#
- rst: ERst#
- sfip: NDArray#
- class Config(fol, fsit, explicit, zones, freq, acoeff, boundaries, nonregular)[source]#
Bases:
objectData required by the Config workflow.
- Attributes:
- folstr
Output folder or model location.
- fsitstr
Fsit.
- explicitbool
Explicit.
- zonesbool
Zones.
- freqNDArray
Freq.
- acoeffNDArray
Acoeff.
- boundarieslist[int]
Boundaries.
- nonregularbool
Nonregular.
- Parameters:
- freq: NDArray#
- acoeff: NDArray#
- class InterpData(ri, rx, ry, rz, sx, sy, sz, rf, rk, rt, rkg, sf, st, sai, snum)[source]#
Bases:
objectData required by the InterpData workflow.
- Attributes:
- rilist[NDArray]
Ri.
- rxlist[NDArray]
Rx.
- rylist[NDArray]
Ry.
- rzlist[NDArray]
Rz.
- sxlist[list[float]]
Sx.
- sylist[list[float]]
Sy.
- szlist[list[float]]
Sz.
- rflist[NDArray]
Rf.
- rklist[NDArray]
Rk.
- rtlist[NDArray]
Rt.
- rkglist[list[tuple[float, int]]]
Rkg.
- sflist[list[int]]
Sf.
- stlist[list[float]]
St.
- sailist[int]
Sai.
- snumlist[int]
Snum.
- Parameters:
- class XYMaps(x_i, y_i, z_i, inds, fipr, offset, oprn, rtmin)[source]#
Bases:
objectData required by the XYMaps workflow.
- Attributes:
- x_iNDArray
X i.
- y_iNDArray
Y i.
- z_iNDArray
Z i.
- indslist[int]
Inds.
- fiprNDArray
Fipr.
- offsetlist[float]
Offset.
- oprnNDArray
Oprn.
- rtminfloat
Rtmin.
- Parameters:
- x_i: NDArray#
- y_i: NDArray#
- z_i: NDArray#
- fipr: NDArray#
- oprn: NDArray#
- class BCCon(coords, sbound, spres, ksfips, stmin, sopn)[source]#
Bases:
objectData required by the BCCon workflow.
- Attributes:
- coordslist[list[float]]
Coords.
- sboundlist[str]
Sbound.
- spreslist[float]
Spres.
- ksfipslist[int]
Ksfips.
- stminfloat
Stmin.
- sopnNDArray
Sopn.
- Parameters:
- sopn: NDArray#
- class Borders(sx, sy, sz, sf, st, sbound, sai)[source]#
Bases:
objectData required by the Borders workflow.
- Attributes:
- sxlist[list[float]]
Sx.
- sylist[list[float]]
Sy.
- szlist[list[float]]
Sz.
- sflist[list[int]]
Sf.
- stlist[list[float]]
St.
- sboundlist[str]
Sbound.
- sailist[int]
Sai.
- Parameters:
- class RegionalCells(ri, rx, ry, rz, rf, rt, rk, rkg, sbound)[source]#
Bases:
objectData required by the RegionalCells workflow.
- Attributes:
- rilist
Ri.
- rxlist
Rx.
- rylist
Ry.
- rzlist
Rz.
- rflist[NDArray]
Rf.
- rtlist
Rt.
- rklist
Rk.
- rkglist[list[tuple[float, int]]]
Rkg.
- sboundlist[str]
Sbound.
- Parameters:
- class SiteBorders(spres, sai, sbound, sxn, syn, szn, sfn, stn, sxw, syw, szw, sfw, stw, sxs, syl, szs, sfs, sts, sxe, sye, sze, sfe, ste)[source]#
Bases:
objectData required by the SiteBorders workflow.
- Attributes:
- spreslist[float]
Spres.
- sailist[int]
Sai.
- sboundlist[str]
Sbound.
- sxnlist[float]
Sxn.
- synlist[float]
Syn.
- sznlist[float]
Szn.
- sfnlist[int]
Sfn.
- stnlist[float]
Stn.
- sxwlist[float]
Sxw.
- sywlist[float]
Syw.
- szwlist[float]
Szw.
- sfwlist[int]
Sfw.
- stwlist[float]
Stw.
- sxslist[float]
Sxs.
- syllist[float]
Syl.
- szslist[float]
Szs.
- sfslist[int]
Sfs.
- stslist[float]
Sts.
- sxelist[float]
Sxe.
- syelist[float]
Sye.
- szelist[float]
Sze.
- sfelist[int]
Sfe.
- stelist[float]
Ste.
- Parameters:
- create_deck(fol, explicit, zones, freq, nonregular, acoeff, boundaries, reg, freg, sit, fsit)[source]#
Project regional pressures and create a boundary-driven site deck.
- Parameters:
- folstr
Output folder or model location.
- explicitbool
Explicit.
- zonesbool
Zones.
- freqNDArray
Freq.
- nonregularbool
Nonregular.
- acoeffNDArray
Acoeff.
- boundarieslist[int]
Boundaries.
- regstr
Reg.
- fregstr
Freg.
- sitstr
Sit.
- fsitstr
Fsit.
- Parameters:
- Return type:
None
- get_xymaps(regional, ufip, zones, coords)[source]#
Collect regional interpolation coordinates around site boundaries.
- get_bccon(site, regional, boundaries, explicit, boundary, dire, sopn)[source]#
Build boundary connections and interpolation coordinates for an irregular site.
- Parameters:
- siteSite
Site.
- regionalRegional
Regional.
- boundarieslist[int]
Boundaries.
- explicitbool
Explicit.
- boundaryNDArray
Boundary.
- direlist[int]
Dire.
- sopnNDArray
Sopn.
- Returns:
- BCCon
Site boundary connections and coordinates.
- Parameters:
- Return type:
- compact_format_numeric(v)[source]#
Compress consecutive numeric values using OPM repeated-value notation.
- handle_grid_coord(sgrid, rgrid, sinit, rinit)[source]#
Build site bounds and regional cell-center coordinate arrays.
- Parameters:
- sgridOpmGrid
Sgrid.
- rgridOpmGrid
Rgrid.
- sinitOpmFile
Sinit.
- rinitOpmFile
Rinit.
- Returns:
- tuple
Region arrays, dimensions, and site bounding polygon.
- Parameters:
sgrid (EGrid)
rgrid (EGrid)
sinit (EclFile)
rinit (EclFile)
- Return type:
tuple[NDArray, NDArray, NDArray, NDArray, NDArray, int, int, list[list[float]]]
- add_neigh(gtmp, ijk_n, kval, rgrid, ract, rfip, rnxy, ri, rx, ry, rz, rk, rf, rt, d_z, oprn, n, noise)[source]#
Add one active regional neighbor to an interpolation stencil.
Ignore global indices outside the grid, inactive cells, and active cells already included in the current stencil. For a retained neighbor, append its active index, center coordinates, layer, FIPNUM, and top elevation, then mark its role in the full-grid OPERNUM array.
- Parameters:
- gtmpint
Global index of the candidate regional neighbor.
- ijk_ntuple[int, int, int]
Zero-based I, J, and K indices of the candidate cell.
- kvalint
Layer index assigned to the candidate cell.
- rgridOpmGrid
Regional grid geometry and active/global index mappings.
- ractNDArray
Boolean active-cell mask in global-grid order.
- rfipNDArray
Regional FIPNUM values in active-cell order.
- rnxyint
Number of cells in one regional xy layer.
- rilist[int]
Active regional-cell indices already included in the stencil.
- rxlist[float]
Regional cell-center x coordinates to update.
- rylist[float]
Regional cell-center y coordinates to update.
- rzlist[float]
Regional cell-center z coordinates to update.
- rklist[int]
Regional layer indices to update.
- rflist[int]
Regional FIPNUM values to update.
- rtlist[float]
Regional cell top-face elevations to update.
- d_zNDArray
Half-heights of active regional cells.
- oprnNDArray
Full-grid OPERNUM values to update.
- nint
Site-boundary direction index used to assign OPERNUM.
- noisefloat
Small vertical offset used to avoid duplicate interpolation points.
- Parameters:
- Return type:
None
- check_regional_neighbours(rgrid, ract, rfip, rnxy, ri, rx, ry, rz, rk, rf, rt, gind, n, d_z, oprn)[source]#
Add active neighboring regional cells to an interpolation stencil.
- Parameters:
- rgridOpmGrid
Rgrid.
- ractNDArray
Ract.
- rfipNDArray
Rfip.
- rnxyint
Rnxy.
- rilist[int]
Ri.
- rxlist[float]
Rx.
- rylist[float]
Ry.
- rzlist[float]
Rz.
- rklist[int]
Rk.
- rflist[int]
Rf.
- rtlist[float]
Rt.
- gindint
Gind.
- nint
- d_zNDArray
D z.
- oprnNDArray
Oprn.
- Returns:
- NDArray
Updated OPERNUM array.
- Parameters:
- Return type:
NDArray
- find_regional_cells(rgrid, sgrid, sinit, rinit, rfip, zones, borders, ract)[source]#
Find regional interpolation cells for each site border.
- Parameters:
- rgridOpmGrid
Rgrid.
- sgridOpmGrid
Sgrid.
- sinitOpmFile
Sinit.
- rinitOpmFile
Rinit.
- rfipNDArray
Rfip.
- zonesbool
Zones.
- bordersBorders
Borders.
- ractNDArray
Ract.
- Returns:
- tuple[RegionalCells, list[int]]
Regional interpolation cells and retained site indices.
- Parameters:
- Return type:
- temporal_interpolation(freq, acoeff, sdays, isdays, rdays, rp, explicit, spres)[source]#
Create site report times and interpolate boundary pressures.
- Parameters:
- freqNDArray
Freq.
- acoeffNDArray
Acoeff.
- sdaysNDArray
Sdays.
- isdaysNDArray
Isdays.
- rdaysNDArray
Rdays.
- rplist[list[tuple[int, float]]]
Rp.
- explicitbool
Explicit.
- spreslist[float]
Spres.
- Returns:
- tuple[NDArray, NDArray, list[str]]
Site times, time steps, and boundary records.
- Parameters:
- Return type:
- update_boundary(key, z_b, sbound, c_c, s_s, rp_out, i, rgrid, sgrid, sopn)[source]#
Store one projected pressure and update its boundary connection.
Append a finite projected pressure to the current restart-step results. At the first restart step, renumber retained one-layer boundary connections and mark their site cells in OPERNUM. If interpolation returns NaN, remove the corresponding connection during the first restart step.
- Parameters:
- keyint
One-based boundary-connection identifier.
- z_bfloat
Interpolated boundary pressure or scalar NumPy result.
- sboundlist[str]
Current BCCON records.
- c_cint
Counter used to renumber retained one-layer boundary connections.
- s_sint
Number of skipped boundary connections since the last retained entry.
- rp_outlist[tuple[int, float]]
Projected boundary-pressure pairs for the current restart step.
- iint
Regional restart-step index.
- rgridOpmGrid
Regional grid used to distinguish one- and multi-layer models.
- sgridOpmGrid
Site grid used to map retained BCCON records to global cells.
- sopnNDArray
Full-grid site OPERNUM values to update.
- Returns:
- tuple[list[str], int, int]
Updated BCCON records, retained-connection counter, and skipped counter.
- Parameters:
- Return type:
- project_pressures(rrst, rgrid, sgrid, data, sbound, ufip, explicit, zones, sopn, i)[source]#
Project one regional restart step onto the site boundary.
- Parameters:
- rrstOpmRestart
Rrst.
- rgridOpmGrid
Rgrid.
- sgridOpmGrid
Sgrid.
- dataInterpData
Values to plot.
- sboundlist[str]
Sbound.
- ufipNDArray
Ufip.
- explicitbool
Explicit.
- zonesbool
Zones.
- sopnNDArray
Sopn.
- iint
Index of the current quantity, boundary, or report step.
- Returns:
- tuple[list[tuple[int, float]], list[str]]
Projected pressures and updated boundary definitions.
- Parameters:
- Return type:
- write_files(fol, fsit, freq, ddays, sdata, sbound, sbc, sdays, sopn)[source]#
Write projected deck and boundary-condition include files.
- Parameters:
- folstr
Output folder or model location.
- fsitstr
Fsit.
- freqNDArray
Freq.
- ddaysNDArray
Ddays.
- sdatastr
Sdata.
- sboundlist[str]
Sbound.
- sbclist[str]
Sbc.
- sdaysNDArray
Sdays.
- sopnNDArray
Sopn.
- Parameters:
- Return type:
None
- extract_site_borders(sgrid, sdim, sinit, srst, boundaries, explicit, mly, mlx, sfip)[source]#
Extract active cells and properties along rectangular site borders.
- Parameters:
- sgridOpmGrid
Sgrid.
- sdimNDArray
Sdim.
- sinitOpmFile
Sinit.
- srstOpmRestart
Srst.
- boundarieslist[int]
Boundaries.
- explicitbool
Explicit.
- mlyint
Mly.
- mlxint
Mlx.
- sfipNDArray
Sfip.
- Returns:
- SiteBorders
Extracted site-border coordinates and properties.
- Parameters:
- Return type: