From 3d36f66a399ea2900663d03e288131f9112aa227 Mon Sep 17 00:00:00 2001 From: jan Date: Tue, 5 Sep 2017 11:08:06 -0700 Subject: [PATCH] warn if grid is going to be int-typed --- gridlock/grid.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gridlock/grid.py b/gridlock/grid.py index e4787cb..a91585c 100644 --- a/gridlock/grid.py +++ b/gridlock/grid.py @@ -322,6 +322,8 @@ class Grid(object): grids_shape = hstack((num_grids, self.shape)) if is_scalar(initial): + if isinstance(initial, int): + warnings.warn('Initial value is an int, grids will be integer-typed!') self.grids = numpy.full(grids_shape, initial) else: if len(initial) < num_grids: @@ -331,6 +333,8 @@ class Grid(object): for i in range(num_grids): if is_scalar(initial[i]): if initial[i] is not None: + if isinstance(initial[i], int): + warnings.warn('Initial value is an int, grid {} will be integer-typed!'.format(i)) self.grids[i] = numpy.full(self.shape, initial[i]) else: if not numpy.array_equal(initial[i].shape, self.shape):