diff --git a/README.md b/README.md index 5b055e0cd..fa6dbf978 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ ![XTGeo](https://github.com/equinor/xtgeo/blob/main/docs/images/xtgeo-logo-wide.png) ![builds](https://github.com/equinor/xtgeo/workflows/builds/badge.svg) ![linting](https://github.com/equinor/xtgeo/workflows/linting/badge.svg) -[![Codacy Badge](https://api.codacy.com/project/badge/Grade/c209aeed6a2a40b08ea859aeadf31cb0)](https://www.codacy.com/app/jcrivenaes/xtgeo?utm_source=github.com&utm_medium=referral&utm_content=equinor/xtgeo&utm_campaign=Badge_Grade) [![codecov](https://codecov.io/gh/equinor/xtgeo/branch/main/graph/badge.svg)](https://codecov.io/gh/equinor/xtgeo) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/python/black) [![PyPI version](https://badge.fury.io/py/xtgeo.svg)](https://badge.fury.io/py/xtgeo) @@ -49,12 +48,12 @@ the documentation. ## Getting started ```python -from xtgeo.surface import RegularSurface +import xtgeo # create an instance of a surface, read from file -mysurf = RegularSurface("myfile.gri") # Irap binary as default +mysurf = xtgeo.surface_from_file("myfile.gri") # Irap binary as default -print("Mean is {}".format(mysurf.values.mean())) +print(f"Mean is {mysurf.values.mean()}") # change date so all values less than 2000 becomes 2000 # The values attribute gives the Numpy array diff --git a/docs/readme.rst b/docs/readme.rst index 7c039cc6e..aacf412db 100644 --- a/docs/readme.rst +++ b/docs/readme.rst @@ -14,7 +14,7 @@ XTGeo main environment is as stand-alone Python script or notebook, but can Feature summary --------------- -- Python 3.7+ (Linux, Windows and MacOS). +- Python 3.8+ (Linux, Windows and MacOS). - Focus on high speed, using `numpy`_ and `pandas`_ with C backend - Regular surfaces, i.e. 2D maps with regular sampling and rotation - 3D grids (corner-point), supporting several formats such as RMS and @@ -47,7 +47,7 @@ Getting started import xtgeo # create an instance of a surface, read from file - mysurf = xtgeo.RegularSurface("myfile.gri") # Irap binary as default + mysurf = xtgeo.surface_from_file("myfile.gri") # Irap binary as default print(f"Mean is {mysurf.values.mean()}") diff --git a/docs/usage.rst b/docs/usage.rst index 36c9fa77f..8e33fbb79 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -118,12 +118,12 @@ and 30 from back. The applied order of these routines matters... import xtgeo - big = xtgeo.cube_from_file('troll.segy') # alt. for xtgeo.cube.Cube('troll.segy') + big = xtgeo.cube_from_file("troll.segy") big.do_thinning(2, 2, 1) # keep every second inline and xline big.do_cropping((20, 30), (250, 20), (0, 0)) # crop ilines and xlines # export a much smaller file to SEGY - big.to_file('much_smaller.segy') + big.to_file("much_smaller.segy") Reduce or change cube (e.g. SEGY) data by resampling @@ -141,7 +141,7 @@ Also, another small cube with another rotation is made: import xtgeo - big = xtgeo.Cube('troll.segy') + big = xtgeo.cube_from_file("troll.segy") # make a cube of every second iline and xline newcube = xtgeo.Cube(xori=big.xori, yori=big.yori, zori=big.zori, diff --git a/src/xtgeo/grid3d/grid.py b/src/xtgeo/grid3d/grid.py index 52d083fe5..fe314d878 100644 --- a/src/xtgeo/grid3d/grid.py +++ b/src/xtgeo/grid3d/grid.py @@ -2272,9 +2272,9 @@ def reverse_row_axis(self, ijk_handedness=None): Example:: - grd = xtgeo.Grid("somefile.roff") - prop1 = xtgeo.GridProperty("somepropfile1.roff") - prop2 = xtgeo.GridProperty("somepropfile2.roff") + grd = xtgeo.grid_from_file("somefile.roff") + prop1 = xtgeo.gridproperty_from_file("somepropfile1.roff") + prop2 = xtgeo.gridproperty_from_file("somepropfile2.roff") grd.props = [prop1, prop2] @@ -2469,13 +2469,13 @@ def report_zone_mismatch( Example:: - g1 = xtgeo.Grid("gullfaks2.roff") + g1 = xtgeo.grid_from_file("gullfaks2.roff") - z = xtgeo.GridProperty(gullfaks2_zone.roff", name="Zone") + z = xtgeo.gridproperty_from_file(gullfaks2_zone.roff", name="Zone") - w2 = xtgeo.Well("34_10-1.w", zonelogname="Zonelog") + w2 = xtgeo.well_from_file("34_10-1.w", zonelogname="Zonelog") - w3 = xtgeo.Well("34_10-B-21_B.w", zonelogname="Zonelog")) + w3 = xtgeo.well_from_file("34_10-B-21_B.w", zonelogname="Zonelog")) wells = [w2, w3] @@ -2561,9 +2561,9 @@ def get_randomline( Example:: - mygrid = xtgeo.Grid("somegrid.roff") - poro = xtgeo.GridProperty("someporo.roff") - mywell = xtgeo.Well("somewell.rmswell") + mygrid = xtgeo.grid_from_file("somegrid.roff") + poro = xtgeo.gridproperty_from_file("someporo.roff") + mywell = xtgeo.well_from_file("somewell.rmswell") fence = mywell.get_fence_polyline(sampling=5, tvdmin=1750, asnumpy=True) (hmin, hmax, vmin, vmax, arr) = mygrid.get_randomline( fence, poro, zmin=1750, zmax=1850, zincrement=0.5, diff --git a/src/xtgeo/surface/regular_surface.py b/src/xtgeo/surface/regular_surface.py index ea81dd6b9..63ecd2572 100644 --- a/src/xtgeo/surface/regular_surface.py +++ b/src/xtgeo/surface/regular_surface.py @@ -2838,9 +2838,9 @@ def get_randomline( Example:: - fence = xtgeo.Polygons("somefile.pol") + fence = xtgeo.polygons_from_file("somefile.pol") fspec = fence.get_fence(distance=20, nextend=5, asnumpy=True) - surf = xtgeo.RegularSurface("somefile.gri") + surf = xtgeo.surface_from_file("somefile.gri") arr = surf.get_randomline(fspec) diff --git a/src/xtgeo/well/well1.py b/src/xtgeo/well/well1.py index a1af541aa..2a6121531 100644 --- a/src/xtgeo/well/well1.py +++ b/src/xtgeo/well/well1.py @@ -1171,7 +1171,7 @@ def create_surf_distance_log( Example:: mywell.rescale() # optional - thesurf = xtgeo.RegularSurface("some.gri") + thesurf = xtgeo.surface_from_file("some.gri") mywell.create_surf_distance_log(thesurf, name="sdiff") """ diff --git a/src/xtgeo/xyz/points.py b/src/xtgeo/xyz/points.py index eb26cd3b5..1b330c1d6 100644 --- a/src/xtgeo/xyz/points.py +++ b/src/xtgeo/xyz/points.py @@ -287,7 +287,7 @@ def points_from_wells( Example:: - wells = [xtgeo.Well("w1.w"), xtgeo.Well("w2.w")] + wells = [xtgeo.well_from_file("w1.w"), xtgeo.well_from_file("w2.w")] points = xtgeo.points_from_wells(wells) Note: @@ -338,7 +338,7 @@ def points_from_wells_dfrac( Example:: - wells = [xtgeo.Well("w1.w"), xtgeo.Well("w2.w")] + wells = [xtgeo.well_from_file("w1.w"), xtgeo.well_from_file("w2.w")] points = xtgeo.points_from_wells_dfrac( wells, dlogname="Facies", dcodes=[4], zonelogname="ZONELOG" ) @@ -702,7 +702,7 @@ def from_dataframe(self, dfr, east="X", north="Y", tvdmsl="Z", attributes=None): if attributes: for target, source in attributes.items(): - input[target] = dfr[source] + input_[target] = dfr[source] df = pd.DataFrame(input) df.dropna(inplace=True) @@ -951,14 +951,10 @@ def from_surface(self, surf, zname="Z_TVDSS"): Example:: - topx = RegularSurface('topx.gri') - topx_aspoints = Points() - topx_aspoints.from_surface(topx) + topx = xtgeo.surface_from_file("topx.gri") + topx_aspoints = xtgeo.points_from_surface(topx) - # alternative shortform: - topx_aspoints = Points(topx) # get an instance directly - - topx_aspoints.to_file('mypoints.poi') # export as XYZ file + topx_aspoints.to_file("mypoints.poi") # export as XYZ file .. deprecated:: 2.16 Use xtgeo.points_from_surface() instead. """