Skip to content

Commit

Permalink
CLN: Use xtgeoviz for quickplots
Browse files Browse the repository at this point in the history
  • Loading branch information
mferrera committed Dec 13, 2023
1 parent b72340c commit c8b268d
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 9 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ dependencies = [
"tables;platform_system != 'Darwin' and python_version > '3.8'", # TODO: mac...
"tables<3.9;platform_system != 'Darwin' and python_version == '3.8'", # TODO: mac...
"typing_extensions",
"xtgeoviz",
]

[project.urls]
Expand Down
8 changes: 6 additions & 2 deletions src/xtgeo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@


import os
import sys
import timeit
import warnings

Expand Down Expand Up @@ -38,10 +39,10 @@ def _xprint(msg):
ROXAR = True
try:
import roxar
except Exception:
except ImportError:
ROXAR = False

if not ROXAR:
if sys.platform == "linux" and not ROXAR:
_display = os.environ.get("DISPLAY", "")
_hostname = os.environ.get("HOSTNAME", "")
_host = os.environ.get("HOST", "")
Expand Down Expand Up @@ -169,3 +170,6 @@ def _xprint(msg):
warnings.filterwarnings("default", category=DeprecationWarning, module="xtgeo")

_xprint("XTGEO __init__ done")

# Remove symbols imported for internal use
del os, sys, timeit, warnings, TIME0, DEBUG, ROXAR, _timer, _xprint
2 changes: 1 addition & 1 deletion src/xtgeo/grid3d/_roff_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def xtgeo_subgrids(self) -> dict[str, range] | None:

@staticmethod
def _from_xtgeo_subgrids(
xtgeo_subgrids: MutableMapping[str, range | Sequence]
xtgeo_subgrids: MutableMapping[str, range | Sequence],
) -> np.ndarray:
"""
Args:
Expand Down
4 changes: 2 additions & 2 deletions src/xtgeo/surface/regular_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -3046,9 +3046,9 @@ def quickplot(
xtg.warn(f"None or too few map nodes for plotting. Skip output {filename}!")
return

import xtgeo.plot
import xtgeoviz.plot

mymap = xtgeo.plot.Map()
mymap = xtgeoviz.plot.Map()

logger.info("Infotext is <%s>", infotext)
mymap.canvas(title=title, subtitle=subtitle, infotext=infotext)
Expand Down
4 changes: 2 additions & 2 deletions src/xtgeo/well/wells.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,9 @@ def quickplot(self, filename=None, title="QuickPlot"):
title (str): Title of plot
"""
import xtgeo.plot
import xtgeoviz.plot

mymap = xtgeo.plot.Map()
mymap = xtgeoviz.plot.Map()

mymap.canvas(title=title)

Expand Down
4 changes: 2 additions & 2 deletions src/xtgeo/xyz/polygons.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,9 +860,9 @@ def quickplot(
linewidth (float): Width of line.
color (str): Name of color (may use matplotib shortcuts, e.g. 'r' for 'red')
"""
import xtgeo.plot
import xtgeoviz.plot

mymap = xtgeo.plot.Map()
mymap = xtgeoviz.plot.Map()
mymap.canvas(title=title, subtitle=subtitle, infotext=infotext)

if others:
Expand Down
1 change: 1 addition & 0 deletions tests/test_plot/test_matplotlib_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def test_that_mpl_dynamically_imports():
assert "matplotlib.pyplot" in sys.modules


@mock.patch.object(sys, "platform", "linux")
@mock.patch.dict(sys.modules)
@mock.patch.dict(os.environ, {"LSB_JOBID": "1"})
def test_that_agg_backend_set_when_lsf_job():
Expand Down

0 comments on commit c8b268d

Please sign in to comment.