ocean-transport / floater

For working with lagrangian float data
http://floater.readthedocs.io
15 stars 17 forks source link

FloatSet object is sensitive to numpy version #61

Open geosciz opened 7 years ago

geosciz commented 7 years ago

A recent update of numpy package to version 1.13.0 changes the behavior of generators.py. See an example as follows.

import numpy as np
from floater.generators import FloatSet

lon = np.arange(0, 9, dtype=np.float32)
lat = np.arange(-4, 5, dtype=np.float32)
land_mask = np.full(81, True, dtype=bool)
land_mask.shape = (len(lat), len(lon))
land_mask[:,0:2] = False
land_mask
array([[False, False,  True,  True,  True,  True,  True,  True,  True],
       [False, False,  True,  True,  True,  True,  True,  True,  True],
       [False, False,  True,  True,  True,  True,  True,  True,  True],
       [False, False,  True,  True,  True,  True,  True,  True,  True],
       [False, False,  True,  True,  True,  True,  True,  True,  True],
       [False, False,  True,  True,  True,  True,  True,  True,  True],
       [False, False,  True,  True,  True,  True,  True,  True,  True],
       [False, False,  True,  True,  True,  True,  True,  True,  True],
       [False, False,  True,  True,  True,  True,  True,  True,  True]], dtype=bool)
model_grid = {'lon': lon, 'lat': lat, 'land_mask': land_mask}
fs = FloatSet(xlim=(0, 9), ylim=(-4, 5), model_grid=model_grid)
fs.get_rectmesh()
np.__version__
'1.12.0'
fs.ocean_bools
array([False, False,  True,  True,  True,  True,  True,  True,  True,
       False,  True,  True,  True,  True,  True,  True,  True,  True,
       False,  True,  True,  True,  True,  True,  True,  True,  True,
       False,  True,  True,  True,  True,  True,  True,  True,  True,
       False,  True,  True,  True,  True,  True,  True,  True,  True,
       False,  True,  True,  True,  True,  True,  True,  True,  True,
       False,  True,  True,  True,  True,  True,  True,  True,  True,
       False, False,  True,  True,  True,  True,  True,  True,  True,
       False, False,  True,  True,  True,  True,  True,  True,  True], dtype=bool)
np.__version__
'1.13.0'
fs.ocean_bools
array([False,  True,  True,  True,  True,  True,  True,  True,  True,
       False,  True,  True,  True,  True,  True,  True,  True,  True,
       False,  True,  True,  True,  True,  True,  True,  True,  True,
       False,  True,  True,  True,  True,  True,  True,  True,  True,
       False,  True,  True,  True,  True,  True,  True,  True,  True,
       False,  True,  True,  True,  True,  True,  True,  True,  True,
       False,  True,  True,  True,  True,  True,  True,  True,  True,
       False,  True,  True,  True,  True,  True,  True,  True,  True,
       False,  True,  True,  True,  True,  True,  True,  True,  True], dtype=bool)

cc: @rabernat, @nathanieltarshish

nathanieltarshish commented 7 years ago

Huh, do you think it is related to the cKDTree? Do dist and neighbor_indices agree between versions?

rabernat commented 7 years ago

@geosciz can you tell us the scipy version on each environment?

geosciz commented 7 years ago

@rabernat 0.19.0 for both.