Skip to content

Commit 3838661

Browse files
put conftest back to where it works.
1 parent 36cc7c3 commit 3838661

File tree

2 files changed

+12
-55
lines changed

2 files changed

+12
-55
lines changed

py_gnome/gnome/basic_types.py

Lines changed: 10 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -33,70 +33,26 @@
3333
oil_status = cbt.oil_status
3434
spill_type = cbt.spill_type
3535

36-
# seconds = cbt.seconds
37-
38-
# numpy 1 did not have a long attribute -- but it matched int
36+
# Here we customize what a 'long' type is....
37+
# NOTE: This is all so we can create numpy arrays that are compatible
38+
# with the structs in the C++ code -- most of which
39+
# use the old-style C types, e.g. int, short, long.
40+
# it turns out that with numpy1 `int` mapped to long on the
41+
# platform you were running on: int32 on *nix32, windows 32 and 64 and
42+
# int64 on *nix64
43+
# but now it maps to int64 everywhere (or all 32 bit platforms anyway)
44+
# recent numpy 1 doesn't have a long attribute -- but it matched int
45+
# numpy 2 has a long attribute, which seems to match the C long.
3946
if int(np.__version__.split(".")[0]) < 2:
4047
seconds = int
4148
np_long = int
4249
else:
4350
seconds = np.long
4451
np_long = np.long
4552

46-
4753
# this is a mapping of oil_status code to the meaningful name:
4854
oil_status_map = {num: name for name, num in oil_status.__members__.items()}
4955

50-
51-
# Here we customize what a numpy 'long' type is....
52-
# We do this because numpy does different things with a long
53-
# that can mismatch what Cython does with the numpy ctypes.
54-
# NOTE: This is all so we can create numpy arrays that are compatible
55-
# with the structs in the C++ code -- most of which
56-
# use the old-style C types, e.g. int, short, long.
57-
# In particular, long is defined differently on Windows and Linux
58-
# so we need to make sure that we are using the right type on each platform
59-
# note: numpy no longer HAS numpy.long or numpy.int
60-
# there is a numpy.compat.long, which maps to int (which is the Python int type)
61-
# however, I *think* that Python uses a C long for int,
62-
# and numpy figures it out for itself at run time, so I think we can
63-
# just do that:
64-
65-
#np_long = int
66-
67-
# THE REST OF THIS IS OUT OF DATE:
68-
# on OSX 64:
69-
# - numpy identifies np.long as int64, which is a Cython ctype 'long'
70-
# on OSX 32:
71-
# - numpy identifies np.long as int64, which is a Cython ctype 'long long'
72-
# on Win32:
73-
# - numpy identifies np.long as int64, which is a Cython ctype 'long long',
74-
# on Win64:
75-
# - unknown what numpy does
76-
# - Presumably an int64 would be a ctype 'long' ???
77-
# we should clean this up! -- on Python3, I think np.compat.long == int
78-
79-
########
80-
# NOTE: all this below was essentially simply setting np_long to int
81-
# on all platforms anyway.
82-
# IF we have future problems, it might be as simple as:
83-
# if sys.platform == 'win32':
84-
# np_long = np.int32
85-
# elif sys.platform in ('darwin', 'linux2', 'linux'):
86-
# np_long = np.int64
87-
########
88-
89-
# if sys.platform == 'win32':
90-
# np_long = np.int
91-
# elif sys.platform in ('darwin', 'linux2', 'linux'):
92-
# if sys.maxsize > 2147483647:
93-
# np_long = np.compat.long
94-
# else:
95-
# np_long = int
96-
# else:
97-
# # untested platforms will just default to what numpy thinks it is.
98-
# np_long = np.compat.long
99-
10056
mover_type = np.float64
10157
world_point_type = np.float64
10258
windage_type = np.float64

py_gnome/tests/unit_tests/test_weatherers/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from gnome.weatherers import FayGravityViscous
88

9-
from ..conftest import test_oil, sample_sc_release
9+
from ..conftest import sample_sc_release
1010

1111
# fixtures used by test_weatherers module - import it here so py.test will find
1212
# when tests are run from test_weatherers/subdirectory
@@ -15,6 +15,7 @@
1515
from gnome.spills.gnome_oil import GnomeOil
1616
from gnome.ops import weathering_array_types
1717

18+
test_oil = 'oil_ans_mp'
1819

1920
def weathering_data_arrays(n_arrays,
2021
water=None,

0 commit comments

Comments
 (0)