...: [ 4, -1],

    ...: [ 4, -1],

    ...: [ 5, 7],

    ...: [ 4, 5],

    ...: [ 6, 7],

    ...: [ 7, 8]])

    ...:

    ...:

    ...: print(r)

    ...:

    ...: p = np.array([[ 0.6, 0.4 ],

    ...: [ 0.85, 0.15],

    ...: [ 0.65, 0.35],

    ...: [ 0.9, 0.1 ],

    ...: [ 1., 0. ],

    ...: [ 1., 0. ],

    ...: [ 0.75, 0.25],

    ...: [ 0.55, 0.45],

    ...: [ 0.8, 0.2 ],

    ...: [ 0.95, 0.05]])

    ...:

    ...: print(p)

    ...: #print p.sum(axis=1)

    ...:

    ...: b = np.array([4])

    ...:

    ...:

[[1 2]

[4 5]

[1 5]

...,

[4 5]

[6 7]

[7 8]]

[[ 0.6 0.4 ]

[ 0.85 0.15]

[ 0.65 0.35]

...,

[ 0.55 0.45]

[ 0.8 0.2 ]

[ 0.95 0.05]]


In [2]: s = flow_accum_bw.make_ordered_node_array(r)

   ...:

   ...:

Traceback (most recent call last):


File "<ipython-input-2-4908218c4ed1>", line 1, in <module>

s = flow_accum_bw.make_ordered_node_array(r)


File "/Users/katybarnhart/git/landlab/landlab/components/flow_accum/flow_accum_bw.py", line 235, in make_ordered_node_array

nd = _make_number_of_donors_array(receiver_nodes)


File "/Users/katybarnhart/git/landlab/landlab/components/flow_accum/flow_accum_bw.py", line 113, in _make_number_of_donors_array

nd[:(max_index + 1)] = numpy.bincount(r)


ValueError: object too deep for desired array



In [3]: import numpy


In [4]: receiver_nodes = r


In [5]: node_id = numpy.arange(receiver_nodes.size)


In [6]: node_id

Out[6]: array([ 0, 1, 2, ..., 17, 18, 19])


In [7]: baselevel_nodes = numpy.where(node_id==receiver_nodes)

/Users/katybarnhart/anaconda/lib/python3.5/site-packages/spyder/utils/ipython/start_kernel.py:1: DeprecationWarning: elementwise == comparison failed; this will raise an error in the future.

# -*- coding: utf-8 -*-


In [8]: receiver_nodes

Out[8]:

array([[1, 2],

[4, 5],

[1, 5],

...,

[4, 5],

[6, 7],

[7, 8]])


In [9]: r = np.array([2, 5, 2, 7, 5, 5, 6, 5, 7, 8])-1


In [10]: receiver_nodes = r


In [11]: baselevel_nodes = numpy.where(node_id==receiver_nodes)

/Users/katybarnhart/anaconda/lib/python3.5/site-packages/spyder/utils/ipython/start_kernel.py:1: DeprecationWarning: elementwise == comparison failed; this will raise an error in the future.

# -*- coding: utf-8 -*-


In [12]: node_id = numpy.arange(receiver_nodes.size)


In [13]: baselevel_nodes = numpy.where(node_id==receiver_nodes)


In [14]: baselevel_nodes

Out[14]: (array([4]),)


In [15]: baselevel_nodes = numpy.where(node_id==receiver_nodes)[0]


In [16]: baselevel_nodes

Out[16]: array([4])


In [17]: for k in baselevel_nodes:

    ...: print(k)

    ...:

4


In [18]: """

    ...: Created on Thu Nov 3 10:58:51 2016

    ...:

    ...: @author: katherinebarnhart

    ...: """

    ...:

    ...: import numpy as np

    ...:

    ...:

    ...: from landlab.components.flow_accum import flow_accum_to_n

    ...: from landlab.components.flow_accum import flow_accum_bw

    ...:

    ...:

    ...: r = np.array([[ 1, 2],

    ...: [ 4, 5],

    ...: [ 1, 5],

    ...: [ 6, 2],

    ...: [ 4, -1],

    ...: [ 4, -1],

    ...: [ 5, 7],

    ...: [ 4, 5],

    ...: [ 6, 7],

    ...: [ 7, 8]])

    ...:

    ...:

    ...: print(r)

    ...:

    ...: p = np.array([[ 0.6, 0.4 ],

    ...: [ 0.85, 0.15],

    ...: [ 0.65, 0.35],

    ...: [ 0.9, 0.1 ],

    ...: [ 1., 0. ],

    ...: [ 1., 0. ],

    ...: [ 0.75, 0.25],

    ...: [ 0.55, 0.45],

    ...: [ 0.8, 0.2 ],

    ...: [ 0.95, 0.05]])

    ...:

    ...: print(p)

    ...: #print p.sum(axis=1)

    ...:

    ...: b = np.array([4])

    ...:

    ...:


In [18]: [[1 2]

[4 5]

[1 5]

...,

[4 5]

[6 7]

[7 8]]

[[ 0.6 0.4 ]

[ 0.85 0.15]

[ 0.65 0.35]

...,

[ 0.55 0.45]

[ 0.8 0.2 ]

[ 0.95 0.05]]



In [18]:


In [19]: r

Out[19]:

array([[1, 2],

[4, 5],

[1, 5],

...,

[4, 5],

[6, 7],

[7, 8]])


In [20]: r.shape

Out[20]: (10, 2)


In [21]: r
Restarting kernel...



runfile('/Users/katybarnhart/git/landlab/landlab/components/sink_fill/tests/test_sink_filler.py', wdir='/Users/katybarnhart/git/landlab/landlab/components/sink_fill/tests')

Out[21]: array([1, 4, 1, 6, 4, 4, 5, 4, 6, 7])


In [1]:


In [2]: test_filler_flat()

Traceback (most recent call last):


File "<ipython-input-2-3fb20d3847b8>", line 1, in <module>

test_filler_flat()


File "/Users/katybarnhart/git/landlab/landlab/components/sink_fill/tests/test_sink_filler.py", line 291, in test_filler_flat

hf.fill_pits()


NameError: name 'hf' is not defined



In [3]: global hf, mg

   ...: global z, depr_outlet_target

   ...: global lake, outlet, lake_code, outlet_array

   ...:

   ...: lake = np.array([44, 45, 46, 54, 55, 56, 64, 65, 66])

   ...: outlet = 35 # shouldn't be needed

   ...: lake_code = 44

   ...: outlet_array = np.array([outlet])

   ...:

   ...: mg = RasterModelGrid(10, 10, 1.)

   ...:

   ...: z = np.ones(100, dtype=float)

   ...: z[lake] = 0.

   ...:

   ...: depr_outlet_target = np.empty(100, dtype=float)

   ...: depr_outlet_target.fill(XX)

   ...: depr_outlet_target = XX # not well defined in this simplest case...?

   ...:

   ...: mg.add_field('node', 'topographic__elevation', z, units='-')

   ...:

   ...: hf = SinkFiller(mg)

   ...:


In [4]: hf.fill_pits()

Traceback (most recent call last):


File "<ipython-input-4-a1ee6debbabd>", line 1, in <module>

hf.fill_pits()


File "/Users/katybarnhart/git/landlab/landlab/components/sink_fill/fill_sinks.py", line 204, in fill_pits

self.run_one_step(**kwds)


File "/Users/katybarnhart/git/landlab/landlab/components/sink_fill/fill_sinks.py", line 269, in run_one_step

self._grid.delete_field('node', delete_me)


File "/Users/katybarnhart/git/landlab/landlab/field/grouped.py", line 858, in delete_field

del self._groups[group].units[name]


KeyError: 'flow__x_flag'



In [5]: """

   ...: Created on Thu Nov 3 10:58:51 2016

   ...:

   ...: @author: katherinebarnhart

   ...: """

   ...:

   ...: import numpy as np

   ...:

   ...:

   ...: from landlab.components.flow_accum import flow_accum_to_n

   ...: from landlab.components.flow_accum import flow_accum_bw

   ...:

   ...:

   ...: r = np.array([[ 1, 2],

   ...: [ 4, 5],

   ...: [ 1, 5],

   ...: [ 6, 2],

   ...: [ 4, -1],

   ...: [ 4, -1],

   ...: [ 5, 7],

   ...: [ 4, 5],

   ...: [ 6, 7],

   ...: [ 7, 8]])

   ...:

   ...:

   ...: print(r)

   ...:

   ...: p = np.array([[ 0.6, 0.4 ],

   ...: [ 0.85, 0.15],

   ...: [ 0.65, 0.35],

   ...: [ 0.9, 0.1 ],

   ...: [ 1., 0. ],

   ...: [ 1., 0. ],

   ...: [ 0.75, 0.25],

   ...: [ 0.55, 0.45],

   ...: [ 0.8, 0.2 ],

   ...: [ 0.95, 0.05]])

   ...:

   ...: print(p)

   ...: #print p.sum(axis=1)

   ...:

   ...: b = np.array([4])

   ...:

   ...:

[[1 2]

[4 5]

[1 5]

...,

[4 5]

[6 7]

[7 8]]

[[ 0.6 0.4 ]

[ 0.85 0.15]

[ 0.65 0.35]

...,

[ 0.55 0.45]

[ 0.8 0.2 ]

[ 0.95 0.05]]


In [6]: s = flow_accum_bw.make_ordered_node_array(r)

   ...:

   ...:

Traceback (most recent call last):


File "<ipython-input-6-4908218c4ed1>", line 1, in <module>

s = flow_accum_bw.make_ordered_node_array(r)


File "/Users/katybarnhart/git/landlab/landlab/components/flow_accum/flow_accum_bw.py", line 235, in make_ordered_node_array

delta = _make_delta_array(nd)


File "/Users/katybarnhart/git/landlab/landlab/components/flow_accum/flow_accum_bw.py", line 113, in _make_number_of_donors_array

nd[:(max_index + 1)] = numpy.bincount(r)


ValueError: object too deep for desired array



In [7]: a, q, s = flow_accum_to_n.flow_accumulation_to_n(r, p)

   ...:

   ...: print(a)

   ...:

   ...:

   ...: s = flow_accum_to_n.make_ordered_node_array_to_n(r, p)

   ...:

   ...:

Traceback (most recent call last):


File "<ipython-input-7-b3aada4166a7>", line 1, in <module>

a, q, s = flow_accum_to_n.flow_accumulation_to_n(r, p)


File "/Users/katybarnhart/git/landlab/landlab/components/flow_accum/flow_accum_to_n.py", line 600, in flow_accumulation_to_n

return a, q, s


File "/Users/katybarnhart/git/landlab/landlab/components/flow_accum/flow_accum_to_n.py", line 499, in find_drainage_area_and_discharge_to_n

for v in range(q):


IndexError: list index out of range



In [8]: import numpy as np

   ...: from landlab.components.flow_accum.flow_accum_to_N import _DrainageStack

   ...: delta = np.array([0, 0, 2, 4, 4, 8, 12, 14, 17, 18, 18])

   ...: D = np.array([0, 2, 0, 3, 1, 4, 5, 7, 6, 1, 2, 7, 3, 8, 9, 6, 8, 9])

   ...: ds = _DrainageStack(delta, D)

   ...: ds.construct__stack(4)

   ...:

   ...:

   ...:

Traceback (most recent call last):


File "<ipython-input-8-3a2774b8d346>", line 2, in <module>

from landlab.components.flow_accum.flow_accum_to_N import _DrainageStack


ImportError: No module named 'landlab.components.flow_accum.flow_accum_to_N'



In [9]: import numpy as np

   ...: from landlab.components.flow_accum.flow_accum_to_n import _DrainageStack

   ...: delta = np.array([0, 0, 2, 4, 4, 8, 12, 14, 17, 18, 18])

   ...: D = np.array([0, 2, 0, 3, 1, 4, 5, 7, 6, 1, 2, 7, 3, 8, 9, 6, 8, 9])

   ...: ds = _DrainageStack(delta, D)

   ...: ds.construct__stack(4)

   ...:

   ...:

   ...:

Traceback (most recent call last):


File "<ipython-input-9-463933f82692>", line 2, in <module>

from landlab.components.flow_accum.flow_accum_to_n import _DrainageStack


ImportError: cannot import name '_DrainageStack'



In [10]: import numpy as np

    ...: from landlab.components.flow_accum.flow_accum_to_n import _DrainageStack_to_n

    ...: delta = np.array([0, 0, 2, 4, 4, 8, 12, 14, 17, 18, 18])

    ...: D = np.array([0, 2, 0, 3, 1, 4, 5, 7, 6, 1, 2, 7, 3, 8, 9, 6, 8, 9])

    ...: ds = _DrainageStack_to_n(delta, D)

    ...: ds.construct__stack(4)

    ...:

    ...:

    ...:


In [11]: import numpy as np

    ...: nd = np.array([0, 2, 2, 0, 4, 4, 2, 3, 1, 0])

    ...: from landlab.components.flow_accum.flow_accum_to_n import _make_delta_array_to_n

    ...: delta = _make_delta_array_to_n(nd)

    ...: print(delta)

    ...:

    ...:

[ 0 0 2 ..., 17 18 18]


In [12]: import numpy as np

    ...: from landlab.components.flow_accum.flow_accum_to_n import _make_array_of_donors_to_n

    ...:

    ...: delta = np.array([ 0, 0, 2, 4, 4, 8, 12, 14, 17, 18, 18])

    ...: D = _make_array_of_donors_to_n(r, p, delta)

    ...:

    ...: print(D)

    ...:

    ...:

[0 2 0 ..., 6 8 9]


In [13]: from landlab.components.flow_accum.flow_accum_to_n import make_ordered_node_array_to_n

    ...: b = np.array([4])

    ...: s = make_ordered_node_array_to_n(r, p)

    ...:

    ...:


In [14]: s

Out[14]: []


In [15]: r

Out[15]:

array([[1, 2],

[4, 5],

[1, 5],

...,

[4, 5],

[6, 7],

[7, 8]])


In [16]: p

Out[16]:

array([[ 0.6 , 0.4 ],

[ 0.85, 0.15],

[ 0.65, 0.35],

...,

[ 0.55, 0.45],

[ 0.8 , 0.2 ],

[ 0.95, 0.05]])


In [17]: delta

Out[17]: array([ 0, 0, 2, ..., 17, 18, 18])


In [18]: d

Traceback (most recent call last):


File "<ipython-input-18-e29311f6f1bf>", line 1, in <module>

d


NameError: name 'd' is not defined



In [19]: D

Out[19]: array([0, 2, 0, ..., 6, 8, 9])


In [20]: receiver_nodes = r


In [21]: node_id = numpy.arange(receiver_nodes.size)

Traceback (most recent call last):


File "<ipython-input-21-4006414a88d1>", line 1, in <module>

node_id = numpy.arange(receiver_nodes.size)


NameError: name 'numpy' is not defined



In [22]: import numpy


In [23]: node_id = numpy.arange(receiver_nodes.size)


In [24]: node_id

Out[24]: array([ 0, 1, 2, ..., 17, 18, 19])


In [25]: baselevel_nodes = numpy.where(node_id==receiver_nodes[:,0])[0]

__main__:1: DeprecationWarning: elementwise == comparison failed; this will raise an error in the future.


In [26]: node_id==receiver_nodes[:,0]

__main__:1: DeprecationWarning: elementwise == comparison failed; this will raise an error in the future.

Out[26]: False


In [27]: receiver_nodes[:,0]

Out[27]: array([1, 4, 1, 6, 4, 4, 5, 4, 6, 7])


In [28]: receiver_nodes.shape[1]

Out[28]: 2


In [29]: node_id = numpy.arange(receiver_nodes.shape[2])

Traceback (most recent call last):


File "<ipython-input-29-3db30ca9421c>", line 1, in <module>

node_id = numpy.arange(receiver_nodes.shape[2])


IndexError: tuple index out of range



In [30]: node_id = numpy.arange(receiver_nodes.shape[0])


In [31]: node_id

Out[31]: array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])


In [32]: baselevel_nodes = numpy.where(node_id==receiver_nodes[:,0])[0]


In [33]: baselevel_nodes

Out[33]: array([4])


In [34]: