Skip to content

Commit 4483fa7

Browse files
authored
Merge pull request #129 from jcrivenaes/roxar-matplotlib
Roxar matplotlib
2 parents 6b1cf4e + 941d94f commit 4483fa7

File tree

7 files changed

+39
-26
lines changed

7 files changed

+39
-26
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ env:
2525
- PLAT=x86_64
2626
- MB_PYTHON_VERSION=$TRAVIS_PYTHON_VERSION
2727
- VERSION=$(echo $TRAVIS_TAG)
28-
- BUILD_DEPENDS="cmake"
28+
- BUILD_DEPENDS="cmake==3.13.3"
2929
- CONFIG_PATH=scripts/config.sh
3030
- TEST_DEPENDS="pytest"
3131

@@ -38,6 +38,7 @@ matrix:
3838
env: MB_PYTHON_VERSION=2.7
3939
- os: linux
4040
env: MB_PYTHON_VERSION=3.4
41+
if: tag IS present
4142
- os: linux
4243
env: MB_PYTHON_VERSION=3.5
4344
- os: linux

HISTORY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Version 2
44

5+
### 2.0.6
6+
7+
* Corrected issues with matplotlib when loading xtgeo in RMS
8+
59
### 2.0.5
610

711
* Fixed a bug when reading grids in ROXAR API, the subgrids were missing

docs/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake
1+
cmake==3.13.3
22
setuptools_scm
33
sphinxcontrib-apidoc
44
m2r

requirements_dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake
1+
cmake==3.13.3
22
pip>=8.1.2
33
wheel>=0.29.0
44
flake8==2.6.0

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def parse_requirements(filename):
4646
setup_requirements = [
4747
NUMPYVER,
4848
"pytest-runner",
49-
"cmake",
49+
"cmake==3.13.3",
5050
"wheel",
5151
"setuptools_scm>=3.2.0",
5252
]

src/xtgeo/__init__.py

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -43,28 +43,36 @@ def _xprint(msg):
4343

4444
_xprint("XTGEO __init__ ...")
4545

46+
ROXAR = True
47+
try:
48+
import roxar
49+
except Exception:
50+
ROXAR = False
51+
52+
4653
# to avoid problems in batch runs when no DISPLAY is set:
4754
_xprint("Import matplotlib etc...")
48-
import matplotlib as mplib
55+
if not ROXAR:
56+
import matplotlib as mplib
4957

50-
display = os.environ.get("DISPLAY", "")
51-
host1 = os.environ.get("HOSTNAME", "")
52-
host2 = os.environ.get("HOST", "")
53-
dhost = host1 + host2 + display
58+
display = os.environ.get("DISPLAY", "")
59+
host1 = os.environ.get("HOSTNAME", "")
60+
host2 = os.environ.get("HOST", "")
61+
dhost = host1 + host2 + display
5462

55-
ertbool = "LSB_JOBID" in os.environ
63+
ertbool = "LSB_JOBID" in os.environ
5664

57-
if display == "" or "grid" in dhost or "lgc" in dhost or ertbool:
65+
if display == "" or "grid" in dhost or "lgc" in dhost or ertbool:
5866

59-
_xprint("")
60-
_xprint("=" * 79)
67+
_xprint("")
68+
_xprint("=" * 79)
6169

62-
_xprint(
63-
"XTGeo info: No display found or a batch (e.g. ERT) server. "
64-
"Using non-interactive Agg backend for matplotlib"
65-
)
66-
mplib.use("Agg")
67-
_xprint("=" * 79)
70+
_xprint(
71+
"XTGeo info: No display found or a batch (e.g. ERT) server. "
72+
"Using non-interactive Agg backend for matplotlib"
73+
)
74+
mplib.use("Agg")
75+
_xprint("=" * 79)
6876

6977
#
7078
# Order matters!
@@ -103,11 +111,11 @@ def _xprint(msg):
103111
_xprint("Import various XTGeo modules... wells...")
104112

105113
from xtgeo.surface import regular_surface
114+
from xtgeo.surface.regular_surface import RegularSurface
106115

107116
_xprint("Import various XTGeo modules... surface...")
108117

109118
from xtgeo.cube import cube1
110-
111119
from xtgeo.cube.cube1 import Cube
112120

113121
_xprint("Import various XTGeo modules... cube...")
@@ -130,11 +138,11 @@ def _xprint(msg):
130138

131139
_xprint("Import various XTGeo modules... xyz...")
132140

133-
134-
from xtgeo.plot import baseplot
135-
from xtgeo.plot import xsection
136-
from xtgeo.plot import xtmap
137-
from xtgeo.plot import grid3d_slice
141+
if not ROXAR:
142+
from xtgeo.plot import baseplot
143+
from xtgeo.plot import xsection
144+
from xtgeo.plot import xtmap
145+
from xtgeo.plot import grid3d_slice
138146

139147
_xprint("Import various XTGeo modules... plots...")
140148

src/xtgeo/common/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@
1818
UNDEF_INT_LIMIT = xtgeo.cxtgeo.cxtgeo.UNDEF_INT_LIMIT
1919
VERYLARGENEGATIVE = xtgeo.cxtgeo.cxtgeo.VERYLARGENEGATIVE
2020
VERYLARGEPOSITIVE = xtgeo.cxtgeo.cxtgeo.VERYLARGEPOSITIVE
21-
except NameError:
21+
except AttributeError:
2222
print("Dummy settings")

0 commit comments

Comments
 (0)