In [1]:
import yt

ds2 = yt.load("/home/lindsayad/data-yt/MultiRegion/two_region_example_out.e", step=-1)
ad2 = ds2.all_data()
print(ds2.field_list)

slice3 = yt.SlicePlot(ds2, 'z', [('all', 'elem_diffused')])
slice3.show()
slice2 = yt.SlicePlot(ds2, 'z', [('all', 'diffused')])
slice2.show()


yt : [WARNING  ] 2017-01-11 08:59:25,225 name_glo_var not found
yt : [INFO     ] 2017-01-11 08:59:25,262 Loading coordinates
yt : [INFO     ] 2017-01-11 08:59:25,263 Loading connectivity
yt : [INFO     ] 2017-01-11 08:59:25,275 Parameters: current_time              = 1.0
yt : [INFO     ] 2017-01-11 08:59:25,276 Parameters: domain_dimensions         = [1 1 1]
yt : [INFO     ] 2017-01-11 08:59:25,277 Parameters: domain_left_edge          = [-0.1 -0.1  0. ]
yt : [INFO     ] 2017-01-11 08:59:25,279 Parameters: domain_right_edge         = [ 1.1  1.1  1. ]
yt : [INFO     ] 2017-01-11 08:59:25,280 Parameters: cosmological_simulation   = 0
yt : [INFO     ] 2017-01-11 08:59:25,282 Loading coordinates
yt : [INFO     ] 2017-01-11 08:59:25,283 Loading connectivity
yt : [INFO     ] 2017-01-11 08:59:25,558 xlim = -0.100000 1.100000
yt : [INFO     ] 2017-01-11 08:59:25,559 ylim = -0.100000 1.100000
yt : [INFO     ] 2017-01-11 08:59:25,561 xlim = -0.100000 1.100000
yt : [INFO     ] 2017-01-11 08:59:25,562 ylim = -0.100000 1.100000
yt : [INFO     ] 2017-01-11 08:59:25,571 Making a fixed resolution buffer of (('all', 'elem_diffused')) 800 by 800
[('all', 'diffused'), ('all', 'elem_diffused'), ('connect1', 'diffused'), ('connect1', 'elem_diffused'), ('connect2', 'diffused'), ('connect2', 'elem_diffused')]

yt : [INFO     ] 2017-01-11 08:59:27,488 xlim = -0.100000 1.100000
yt : [INFO     ] 2017-01-11 08:59:27,489 ylim = -0.100000 1.100000
yt : [INFO     ] 2017-01-11 08:59:27,495 xlim = -0.100000 1.100000
yt : [INFO     ] 2017-01-11 08:59:27,496 ylim = -0.100000 1.100000
yt : [INFO     ] 2017-01-11 08:59:27,498 Making a fixed resolution buffer of (('all', 'diffused')) 800 by 800


In [ ]:
slice = yt.SlicePlot(ds2, 'z', [('connect1','diffused')])
slice.show()

In [5]:
string = "gadzooks"
i = 0
for char in string:
    i+=1
    print(i)


1
2
3
4
5
6
7
8

In [3]:
print([i+=1 for char in string])


  File "<ipython-input-3-11c108c9211b>", line 3
    print([i+=1 for char in string])
             ^
SyntaxError: invalid syntax

In [1]:
pwd


Out[1]:
'/home/lindsayad/projects/moose/test/tests/interfacekernels/2d_interface/gold'

In [1]:
import yt

In [20]:
import pdb

In [3]:
ds = yt.load("coupled_value_coupled_flux_out.e", step=-1)
ad = ds.all_data()
print(ds.field_list)


yt : [WARNING  ] 2017-01-06 15:39:39,120 name_elem_var not found
yt : [INFO     ] 2017-01-06 15:39:39,123 Loading coordinates
yt : [INFO     ] 2017-01-06 15:39:39,130 Loading connectivity
yt : [INFO     ] 2017-01-06 15:39:39,150 Parameters: current_time              = 1.0
yt : [INFO     ] 2017-01-06 15:39:39,155 Parameters: domain_dimensions         = [1 1 1]
yt : [INFO     ] 2017-01-06 15:39:39,157 Parameters: domain_left_edge          = [-0.2 -0.2  0. ]
yt : [INFO     ] 2017-01-06 15:39:39,159 Parameters: domain_right_edge         = [ 2.2  2.2  1. ]
yt : [INFO     ] 2017-01-06 15:39:39,163 Parameters: cosmological_simulation   = 0
yt : [INFO     ] 2017-01-06 15:39:39,167 Loading coordinates
yt : [INFO     ] 2017-01-06 15:39:39,170 Loading connectivity
yt : [WARNING  ] 2017-01-06 15:39:39,183 name_elem_var not found
[('connect1', 'u'), ('connect1', 'v'), ('connect2', 'u'), ('connect2', 'v')]

In [4]:
print(ad[('connect1','v')])


[[ 0.97193158  0.          0.          1.04608818]
 [ 0.97193158  1.04608818  0.          0.        ]
 [ 1.04608818  0.          0.          0.        ]] dimensionless

In [6]:
print(ad[('connect2','v')])


[[ 0.71001475  0.97193158  1.04608818  0.97193158]] dimensionless

In [19]:
print(ad[('connect1','v')].shape)
print(ad[('connect2','v')].shape)


(3, 4)
(1, 4)

In [9]:
cd /home/lindsayad/projects/moltres/problems


/home/lindsayad/projects/moltres/problems

In [10]:
ds2 = yt.load("two-region-example_out.e", step=-1)
ad2 = ds2.all_data()
print(ds2.field_list)


yt : [WARNING  ] 2017-01-06 16:13:26,656 name_glo_var not found
yt : [WARNING  ] 2017-01-06 16:13:26,704 name_elem_var not found
yt : [INFO     ] 2017-01-06 16:13:26,706 Loading coordinates
yt : [INFO     ] 2017-01-06 16:13:26,707 Loading connectivity
yt : [INFO     ] 2017-01-06 16:13:26,734 Parameters: current_time              = 1.0
yt : [INFO     ] 2017-01-06 16:13:26,735 Parameters: domain_dimensions         = [1 1 1]
yt : [INFO     ] 2017-01-06 16:13:26,751 Parameters: domain_left_edge          = [-0.1 -0.1  0. ]
yt : [INFO     ] 2017-01-06 16:13:26,754 Parameters: domain_right_edge         = [ 1.1  1.1  1. ]
yt : [INFO     ] 2017-01-06 16:13:26,756 Parameters: cosmological_simulation   = 0
yt : [INFO     ] 2017-01-06 16:13:26,757 Loading coordinates
yt : [INFO     ] 2017-01-06 16:13:26,759 Loading connectivity
yt : [WARNING  ] 2017-01-06 16:13:26,763 name_elem_var not found
[('connect1', 'diffused'), ('connect2', 'diffused')]

In [17]:
print(ad2[('connect1','diffused')].shape)
print(ad2[('connect2','diffused')].shape)


(50, 4)
(50, 4)

In [1]:
cd /home/lindsayad/projects/moltres/problems


/home/lindsayad/projects/moltres/problems

Problem

There's a fundamental problem with what I'm trying to do. It's that stupid connect1!!! What I should do is grep for all occurences of mesh_id = int(ftype[-1]) - 1 because any time that code occurs, it's going to disrupt what I'm trying to do. For now, I'm going to try this one more substituion in cartesian_coordinates.py and then it's time to call it a day.


In [ ]:
%debug


> /home/lindsayad/yt-hg/yt/frontends/exodus_ii/io.py(79)_read_fluid_selection()
     77                 for g in objs:
     78                     ci = g.connectivity_indices
---> 79                     data = fdata[self.ds.step][ci]
     80                     ind += g.select(selector, data, rv[field], ind)  # caches
     81             if fname in self.elem_fields:

ipdb> fdata
<class 'netCDF4._netCDF4.Variable'>
float64 vals_nod_var1(time_step, num_nodes)
unlimited dimensions: time_step
current shape = (1, 121)
filling off

ipdb> p self.ds.step
-1
ipdb> p ci
array([[ 11,  13,  14,  12],
       [ 13,  15,  16,  14],
       [ 15,  17,  18,  16],
       [ 17,  19,  20,  18],
       [ 19,  21,  22,  20],
       [ 12,  14,  29,  28],
       [ 14,  16,  30,  29],
       [ 16,  18,  31,  30],
       [ 18,  20,  32,  31],
       [ 20,  22,  33,  32],
       [ 28,  29,  40,  39],
       [ 29,  30,  41,  40],
       [ 30,  31,  42,  41],
       [ 31,  32,  43,  42],
       [ 32,  33,  44,  43],
       [ 39,  40,  51,  50],
       [ 40,  41,  52,  51],
       [ 41,  42,  53,  52],
       [ 42,  43,  54,  53],
       [ 43,  44,  55,  54],
       [ 50,  51,  62,  61],
       [ 51,  52,  63,  62],
       [ 52,  53,  64,  63],
       [ 53,  54,  65,  64],
       [ 54,  55,  66,  65],
       [ 61,  62,  73,  72],
       [ 62,  63,  74,  73],
       [ 63,  64,  75,  74],
       [ 64,  65,  76,  75],
       [ 65,  66,  77,  76],
       [ 72,  73,  84,  83],
       [ 73,  74,  85,  84],
       [ 74,  75,  86,  85],
       [ 75,  76,  87,  86],
       [ 76,  77,  88,  87],
       [ 83,  84,  95,  94],
       [ 84,  85,  96,  95],
       [ 85,  86,  97,  96],
       [ 86,  87,  98,  97],
       [ 87,  88,  99,  98],
       [ 94,  95, 106, 105],
       [ 95,  96, 107, 106],
       [ 96,  97, 108, 107],
       [ 97,  98, 109, 108],
       [ 98,  99, 110, 109],
       [105, 106, 117, 116],
       [106, 107, 118, 117],
       [107, 108, 119, 118],
       [108, 109, 120, 119],
       [109, 110, 121, 120]])
ipdb> p ci.shape
(50, 4)

Ok, here is some stuff going down:

  1. We start off by creating a YTSlice object.
  2. We call YTSlice.get_data() since apparently YTSlice inherits from YTSelectionContainer
  3. The first thing the get_data() routine does is call: self.index._identify_base_chunk(self)
  4. Here's the hierarchy of indexes: ExodusIIUnstructuredIndex(/frontends/exodusii/data_structures) -> UnstructuredIndex(/geometry/unstructured_mesh_handler) -> Index(/geometry/geometry_handler)
  5. The _identify_base_chunk routine is implemented in the UnstructuredIndex class
  6. In that method, the first thing done is: dobj._chunk_info = self.meshes. Recall that dobj refers to the YTSlice object and self currently is the UnstructuredIndex object
  7. The next important piece of code executed is: dobj._current_chunk = list(self._chunk_all(dobj))[0]
  8. This calls the _chunk_all method implemented in the UnstructuredIndex class
  9. The _chunk_all method creates a generator. In this case list(self._chunk_all(dobj)) is a list of length 1, presumably because we're using an "all" method.
  10. _chunk_all creates a a YTDataChunk instance through yield YTDataChunk(dobj, "all", oobjs, dobj.size, cache)
  11. Note that oobjs were created like this: oobjs = getattr(dobj._current_chunk, "objs", dobj._chunk_info). So essentially oobjs = dobj._chunk_info = self.meshes
  12. The YTDataChunk __init__ routine looks like this:
    def __init__(self, dobj, chunk_type, objs, data_size = None,
                 field_type = None, cache = False, fast_index = None):
        self.dobj = dobj
        self.chunk_type = chunk_type
        self.objs = objs
        self.data_size = data_size
        self._field_type = field_type
        self._cache = cache
        self._fast_index = fast_index
  13. So translating: dobj is the YTSlice object, chunk_type = "all" and the objs are equal to the list of UnstructuredMeshes

To summarize, the YTSlice _current_chunk attribute is equal to a YTDataChunk instance with attributes of self.dobj equal to the YTSlice instance and self.objs equal to the list of UnstructuredMeshes.

However, what we actually pass to the the all (or maybe) important io._read_fluid_selection routine is chunks created from the _chunk_io(dobj) routine.

  • The _chunk_io function also creates a generator; this time a generator that if it was converted into a list would be of length equal to the number of meshes.
  • In more detail it (UnstructuredIndex._chunk_io) passes (in list form): chunks = [YTDataChunk_0 with dobj = YTSlice and objs = [UnstructuredMesh0], YTDataChunk_1 with dobj = YTSlice and objs = [UnstructuredMesh1], ..., YTDataChunk_N-1 with dobj = YTSlice and objs = [UnstructuredMeshN-1]
  • While UnstructuredIndex._chunk_all passes (in list form): chunks = [YTDataChunk with dobj = YTSlice and objs = [UnstructuredMesh0, UnstructuredMesh1, ..., UnstructuredMeshN-1]]

Exploring Generators

Just when you think you're starting to make serious progress, you run into another new fundamental concept!

Here's a generator function I think:


In [3]:
def createGenerator():
    mylist = range(3)
    for i in mylist:
        yield i*i
        
my_generator_function = createGenerator()
print(my_generator_function)


<generator object createGenerator at 0x7fb5f799c990>

And here's a regular function:


In [5]:
def createFunction():
    mylist = range(3)
    for i in mylist:
        return i*i
        
my_regular_function = createFunction()
print(my_regular_function)


0

Psych! A function with a regular return returns as soon it hits return the first time.


In [6]:
for i in my_generator_function:
    print(i)


0
1
4

In [8]:
list_from_gen = list(createGenerator())
print(list_from_gen)
print(len(list_from_gen))


[0, 1, 4]
3

In [3]:
slice.show()




In [6]:
print(array1)
print(array2)


[[ 1.   1.   0.9  0.9]
 [ 1.   1.   0.9  0.9]
 [ 1.   1.   0.9  0.9]
 [ 1.   1.   0.9  0.9]
 [ 1.   1.   0.9  0.9]
 [ 0.9  0.9  0.8  0.8]
 [ 0.9  0.9  0.8  0.8]
 [ 0.9  0.9  0.8  0.8]
 [ 0.9  0.9  0.8  0.8]
 [ 0.9  0.9  0.8  0.8]
 [ 0.8  0.8  0.7  0.7]
 [ 0.8  0.8  0.7  0.7]
 [ 0.8  0.8  0.7  0.7]
 [ 0.8  0.8  0.7  0.7]
 [ 0.8  0.8  0.7  0.7]
 [ 0.7  0.7  0.6  0.6]
 [ 0.7  0.7  0.6  0.6]
 [ 0.7  0.7  0.6  0.6]
 [ 0.7  0.7  0.6  0.6]
 [ 0.7  0.7  0.6  0.6]
 [ 0.6  0.6  0.5  0.5]
 [ 0.6  0.6  0.5  0.5]
 [ 0.6  0.6  0.5  0.5]
 [ 0.6  0.6  0.5  0.5]
 [ 0.6  0.6  0.5  0.5]
 [ 0.5  0.5  0.4  0.4]
 [ 0.5  0.5  0.4  0.4]
 [ 0.5  0.5  0.4  0.4]
 [ 0.5  0.5  0.4  0.4]
 [ 0.5  0.5  0.4  0.4]
 [ 0.4  0.4  0.3  0.3]
 [ 0.4  0.4  0.3  0.3]
 [ 0.4  0.4  0.3  0.3]
 [ 0.4  0.4  0.3  0.3]
 [ 0.4  0.4  0.3  0.3]
 [ 0.3  0.3  0.2  0.2]
 [ 0.3  0.3  0.2  0.2]
 [ 0.3  0.3  0.2  0.2]
 [ 0.3  0.3  0.2  0.2]
 [ 0.3  0.3  0.2  0.2]
 [ 0.2  0.2  0.1  0.1]
 [ 0.2  0.2  0.1  0.1]
 [ 0.2  0.2  0.1  0.1]
 [ 0.2  0.2  0.1  0.1]
 [ 0.2  0.2  0.1  0.1]
 [ 0.1  0.1  0.   0. ]
 [ 0.1  0.1  0.   0. ]
 [ 0.1  0.1  0.   0. ]
 [ 0.1  0.1  0.   0. ]
 [ 0.1  0.1  0.   0. ]] dimensionless
[[ 1.   1.   0.9  0.9]
 [ 1.   1.   0.9  0.9]
 [ 1.   1.   0.9  0.9]
 [ 1.   1.   0.9  0.9]
 [ 1.   1.   0.9  0.9]
 [ 0.9  0.9  0.8  0.8]
 [ 0.9  0.9  0.8  0.8]
 [ 0.9  0.9  0.8  0.8]
 [ 0.9  0.9  0.8  0.8]
 [ 0.9  0.9  0.8  0.8]
 [ 0.8  0.8  0.7  0.7]
 [ 0.8  0.8  0.7  0.7]
 [ 0.8  0.8  0.7  0.7]
 [ 0.8  0.8  0.7  0.7]
 [ 0.8  0.8  0.7  0.7]
 [ 0.7  0.7  0.6  0.6]
 [ 0.7  0.7  0.6  0.6]
 [ 0.7  0.7  0.6  0.6]
 [ 0.7  0.7  0.6  0.6]
 [ 0.7  0.7  0.6  0.6]
 [ 0.6  0.6  0.5  0.5]
 [ 0.6  0.6  0.5  0.5]
 [ 0.6  0.6  0.5  0.5]
 [ 0.6  0.6  0.5  0.5]
 [ 0.6  0.6  0.5  0.5]
 [ 0.5  0.5  0.4  0.4]
 [ 0.5  0.5  0.4  0.4]
 [ 0.5  0.5  0.4  0.4]
 [ 0.5  0.5  0.4  0.4]
 [ 0.5  0.5  0.4  0.4]
 [ 0.4  0.4  0.3  0.3]
 [ 0.4  0.4  0.3  0.3]
 [ 0.4  0.4  0.3  0.3]
 [ 0.4  0.4  0.3  0.3]
 [ 0.4  0.4  0.3  0.3]
 [ 0.3  0.3  0.2  0.2]
 [ 0.3  0.3  0.2  0.2]
 [ 0.3  0.3  0.2  0.2]
 [ 0.3  0.3  0.2  0.2]
 [ 0.3  0.3  0.2  0.2]
 [ 0.2  0.2  0.1  0.1]
 [ 0.2  0.2  0.1  0.1]
 [ 0.2  0.2  0.1  0.1]
 [ 0.2  0.2  0.1  0.1]
 [ 0.2  0.2  0.1  0.1]
 [ 0.1  0.1  0.   0. ]
 [ 0.1  0.1  0.   0. ]
 [ 0.1  0.1  0.   0. ]
 [ 0.1  0.1  0.   0. ]
 [ 0.1  0.1  0.   0. ]] dimensionless

In [2]:
slice = yt.SlicePlot(ds2, 'z', [('all','diffused')])


yt : [WARNING  ] 2017-01-09 15:41:09,466 name_glo_var not found
yt : [WARNING  ] 2017-01-09 15:41:09,514 name_elem_var not found
yt : [INFO     ] 2017-01-09 15:41:09,516 Loading coordinates
yt : [INFO     ] 2017-01-09 15:41:09,518 Loading connectivity
yt : [INFO     ] 2017-01-09 15:41:09,530 Parameters: current_time              = 1.0
yt : [INFO     ] 2017-01-09 15:41:09,531 Parameters: domain_dimensions         = [1 1 1]
yt : [INFO     ] 2017-01-09 15:41:09,534 Parameters: domain_left_edge          = [-0.1 -0.1  0. ]
yt : [INFO     ] 2017-01-09 15:41:09,535 Parameters: domain_right_edge         = [ 1.1  1.1  1. ]
yt : [INFO     ] 2017-01-09 15:41:09,536 Parameters: cosmological_simulation   = 0
yt : [INFO     ] 2017-01-09 15:41:09,539 Loading coordinates
yt : [INFO     ] 2017-01-09 15:41:09,540 Loading connectivity
yt : [WARNING  ] 2017-01-09 15:41:09,543 name_elem_var not found
[('all', 'diffused'), ('connect1', 'diffused'), ('connect2', 'diffused')]
> /home/lindsayad/yt-hg/yt/visualization/plot_window.py(2002)SlicePlot()
-> return AxisAlignedSlicePlot(ds, normal, fields, *args, **kwargs)
(Pdb) c
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-2-4883f9fddbcf> in <module>()
      5 print(ds2.field_list)
      6 
----> 7 slice = yt.SlicePlot(ds2, 'z', [('all','diffused')])

/home/lindsayad/yt-hg/yt/visualization/plot_window.py in SlicePlot(ds, normal, fields, axis, *args, **kwargs)
   2000 
   2001         import pdb; pdb.set_trace()
-> 2002         return AxisAlignedSlicePlot(ds, normal, fields, *args, **kwargs)

/home/lindsayad/yt-hg/yt/visualization/plot_window.py in __init__(self, ds, axis, fields, center, width, axes_unit, origin, right_handed, fontsize, field_parameters, window_size, aspect, data_source)
   1324             slc = ds.slice(axis, center[axis], field_parameters=field_parameters,
   1325                            center=center, data_source=data_source)
-> 1326             slc.get_data(fields)
   1327         validate_mesh_fields(slc, fields)
   1328         PWViewerMPL.__init__(self, slc, bounds, origin=origin,

/home/lindsayad/yt-hg/yt/data_objects/data_containers.py in get_data(self, fields)
   1319         # need to be generated.
   1320         read_fluids, gen_fluids = self.index._read_fluid_fields(
-> 1321                                         fluids, self, self._current_chunk)
   1322         for f, v in read_fluids.items():
   1323             self.field_data[f] = self.ds.arr(v, input_units = finfos[f].units)

/home/lindsayad/yt-hg/yt/geometry/geometry_handler.py in _read_fluid_fields(self, fields, dobj, chunk)
    243             selector,
    244             fields_to_read,
--> 245             chunk_size)
    246         return fields_to_return, fields_to_generate
    247 

/home/lindsayad/yt-hg/yt/frontends/exodus_ii/io.py in _read_fluid_selection(self, chunks, selector, fields, size)
     51         for field in fields:
     52             ftype, fname = field
---> 53             ci = self.handler.variables[ftype][:] - self._INDEX_OFFSET
     54             num_elem = ci.shape[0]
     55             if fname in self.node_fields:

KeyError: 'all'

In [4]:
array1 = ad2[('connect1','diffused')]
array2 = ad2[('connect2','diffused')]
print(array1.shape)
print(array2.shape)


> /home/lindsayad/yt-hg/yt/frontends/exodus_ii/io.py(52)_read_fluid_selection()
-> for field in fields:
(Pdb) c
> /home/lindsayad/yt-hg/yt/frontends/exodus_ii/io.py(52)_read_fluid_selection()
-> for field in fields:
(Pdb) c
(50, 4)
(50, 4)

In [7]:
my_io_handler = yt.frontends.exodus_ii.IOHandlerExodusII(ds2)


yt : [WARNING  ] 2017-01-09 16:31:51,513 name_elem_var not found

In [8]:
variables = my_io_handler.handler.variables
print(variables)


OrderedDict([('time_whole', <class 'netCDF4._netCDF4.Variable'>
float64 time_whole(time_step)
unlimited dimensions: time_step
current shape = (1,)
filling off
), ('eb_status', <class 'netCDF4._netCDF4.Variable'>
int32 eb_status(num_el_blk)
unlimited dimensions: 
current shape = (2,)
filling off
), ('eb_prop1', <class 'netCDF4._netCDF4.Variable'>
int32 eb_prop1(num_el_blk)
    name: ID
unlimited dimensions: 
current shape = (2,)
filling off
), ('ns_status', <class 'netCDF4._netCDF4.Variable'>
int32 ns_status(num_node_sets)
unlimited dimensions: 
current shape = (4,)
filling off
), ('ns_prop1', <class 'netCDF4._netCDF4.Variable'>
int32 ns_prop1(num_node_sets)
    name: ID
unlimited dimensions: 
current shape = (4,)
filling off
), ('ss_status', <class 'netCDF4._netCDF4.Variable'>
int32 ss_status(num_side_sets)
unlimited dimensions: 
current shape = (4,)
filling off
), ('ss_prop1', <class 'netCDF4._netCDF4.Variable'>
int32 ss_prop1(num_side_sets)
    name: ID
unlimited dimensions: 
current shape = (4,)
filling off
), ('coordx', <class 'netCDF4._netCDF4.Variable'>
float64 coordx(num_nodes)
unlimited dimensions: 
current shape = (121,)
filling off
), ('coordy', <class 'netCDF4._netCDF4.Variable'>
float64 coordy(num_nodes)
unlimited dimensions: 
current shape = (121,)
filling off
), ('eb_names', <class 'netCDF4._netCDF4.Variable'>
|S1 eb_names(num_el_blk, len_name)
unlimited dimensions: 
current shape = (2, 33)
filling off
), ('ns_names', <class 'netCDF4._netCDF4.Variable'>
|S1 ns_names(num_node_sets, len_name)
unlimited dimensions: 
current shape = (4, 33)
filling off
), ('ss_names', <class 'netCDF4._netCDF4.Variable'>
|S1 ss_names(num_side_sets, len_name)
unlimited dimensions: 
current shape = (4, 33)
filling off
), ('coor_names', <class 'netCDF4._netCDF4.Variable'>
|S1 coor_names(num_dim, len_name)
unlimited dimensions: 
current shape = (2, 33)
filling off
), ('node_num_map', <class 'netCDF4._netCDF4.Variable'>
int32 node_num_map(num_nodes)
unlimited dimensions: 
current shape = (121,)
filling off
), ('connect1', <class 'netCDF4._netCDF4.Variable'>
int32 connect1(num_el_in_blk1, num_nod_per_el1)
    elem_type: QUAD4
unlimited dimensions: 
current shape = (50, 4)
filling off
), ('connect2', <class 'netCDF4._netCDF4.Variable'>
int32 connect2(num_el_in_blk2, num_nod_per_el2)
    elem_type: QUAD4
unlimited dimensions: 
current shape = (50, 4)
filling off
), ('elem_num_map', <class 'netCDF4._netCDF4.Variable'>
int32 elem_num_map(num_elem)
unlimited dimensions: 
current shape = (100,)
filling off
), ('elem_ss1', <class 'netCDF4._netCDF4.Variable'>
int32 elem_ss1(num_side_ss1)
unlimited dimensions: 
current shape = (10,)
filling off
), ('side_ss1', <class 'netCDF4._netCDF4.Variable'>
int32 side_ss1(num_side_ss1)
unlimited dimensions: 
current shape = (10,)
filling off
), ('elem_ss2', <class 'netCDF4._netCDF4.Variable'>
int32 elem_ss2(num_side_ss2)
unlimited dimensions: 
current shape = (10,)
filling off
), ('side_ss2', <class 'netCDF4._netCDF4.Variable'>
int32 side_ss2(num_side_ss2)
unlimited dimensions: 
current shape = (10,)
filling off
), ('elem_ss3', <class 'netCDF4._netCDF4.Variable'>
int32 elem_ss3(num_side_ss3)
unlimited dimensions: 
current shape = (10,)
filling off
), ('side_ss3', <class 'netCDF4._netCDF4.Variable'>
int32 side_ss3(num_side_ss3)
unlimited dimensions: 
current shape = (10,)
filling off
), ('elem_ss4', <class 'netCDF4._netCDF4.Variable'>
int32 elem_ss4(num_side_ss4)
unlimited dimensions: 
current shape = (10,)
filling off
), ('side_ss4', <class 'netCDF4._netCDF4.Variable'>
int32 side_ss4(num_side_ss4)
unlimited dimensions: 
current shape = (10,)
filling off
), ('node_ns1', <class 'netCDF4._netCDF4.Variable'>
int32 node_ns1(num_nod_ns1)
unlimited dimensions: 
current shape = (11,)
filling off
), ('node_ns2', <class 'netCDF4._netCDF4.Variable'>
int32 node_ns2(num_nod_ns2)
unlimited dimensions: 
current shape = (11,)
filling off
), ('node_ns3', <class 'netCDF4._netCDF4.Variable'>
int32 node_ns3(num_nod_ns3)
unlimited dimensions: 
current shape = (11,)
filling off
), ('node_ns4', <class 'netCDF4._netCDF4.Variable'>
int32 node_ns4(num_nod_ns4)
unlimited dimensions: 
current shape = (11,)
filling off
), ('vals_nod_var1', <class 'netCDF4._netCDF4.Variable'>
float64 vals_nod_var1(time_step, num_nodes)
unlimited dimensions: time_step
current shape = (1, 121)
filling off
), ('name_nod_var', <class 'netCDF4._netCDF4.Variable'>
|S1 name_nod_var(num_nod_var, len_name)
unlimited dimensions: 
current shape = (1, 33)
filling off
), ('info_records', <class 'netCDF4._netCDF4.Variable'>
|S1 info_records(num_info, len_line)
unlimited dimensions: 
current shape = (230, 81)
filling off
)])

In [27]:
ci = variables['connect1'][:] - 1
ci2 = variables['connect2'][:] - 1

In [ ]:
print(ci)

In [28]:
print(ci.shape)
print(ci2.shape)


(50, 4)
(50, 4)

In [33]:
import numpy as np

In [36]:
all_array = np.concatenate((ci, ci2))
print(all_array.shape)


(100, 4)

In [37]:
print(variables['vals_nod_var1'][-1][all_array])


[[ 1.   1.   0.9  0.9]
 [ 1.   1.   0.9  0.9]
 [ 1.   1.   0.9  0.9]
 [ 1.   1.   0.9  0.9]
 [ 1.   1.   0.9  0.9]
 [ 0.9  0.9  0.8  0.8]
 [ 0.9  0.9  0.8  0.8]
 [ 0.9  0.9  0.8  0.8]
 [ 0.9  0.9  0.8  0.8]
 [ 0.9  0.9  0.8  0.8]
 [ 0.8  0.8  0.7  0.7]
 [ 0.8  0.8  0.7  0.7]
 [ 0.8  0.8  0.7  0.7]
 [ 0.8  0.8  0.7  0.7]
 [ 0.8  0.8  0.7  0.7]
 [ 0.7  0.7  0.6  0.6]
 [ 0.7  0.7  0.6  0.6]
 [ 0.7  0.7  0.6  0.6]
 [ 0.7  0.7  0.6  0.6]
 [ 0.7  0.7  0.6  0.6]
 [ 0.6  0.6  0.5  0.5]
 [ 0.6  0.6  0.5  0.5]
 [ 0.6  0.6  0.5  0.5]
 [ 0.6  0.6  0.5  0.5]
 [ 0.6  0.6  0.5  0.5]
 [ 0.5  0.5  0.4  0.4]
 [ 0.5  0.5  0.4  0.4]
 [ 0.5  0.5  0.4  0.4]
 [ 0.5  0.5  0.4  0.4]
 [ 0.5  0.5  0.4  0.4]
 [ 0.4  0.4  0.3  0.3]
 [ 0.4  0.4  0.3  0.3]
 [ 0.4  0.4  0.3  0.3]
 [ 0.4  0.4  0.3  0.3]
 [ 0.4  0.4  0.3  0.3]
 [ 0.3  0.3  0.2  0.2]
 [ 0.3  0.3  0.2  0.2]
 [ 0.3  0.3  0.2  0.2]
 [ 0.3  0.3  0.2  0.2]
 [ 0.3  0.3  0.2  0.2]
 [ 0.2  0.2  0.1  0.1]
 [ 0.2  0.2  0.1  0.1]
 [ 0.2  0.2  0.1  0.1]
 [ 0.2  0.2  0.1  0.1]
 [ 0.2  0.2  0.1  0.1]
 [ 0.1  0.1  0.   0. ]
 [ 0.1  0.1  0.   0. ]
 [ 0.1  0.1  0.   0. ]
 [ 0.1  0.1  0.   0. ]
 [ 0.1  0.1  0.   0. ]
 [ 1.   1.   0.9  0.9]
 [ 1.   1.   0.9  0.9]
 [ 1.   1.   0.9  0.9]
 [ 1.   1.   0.9  0.9]
 [ 1.   1.   0.9  0.9]
 [ 0.9  0.9  0.8  0.8]
 [ 0.9  0.9  0.8  0.8]
 [ 0.9  0.9  0.8  0.8]
 [ 0.9  0.9  0.8  0.8]
 [ 0.9  0.9  0.8  0.8]
 [ 0.8  0.8  0.7  0.7]
 [ 0.8  0.8  0.7  0.7]
 [ 0.8  0.8  0.7  0.7]
 [ 0.8  0.8  0.7  0.7]
 [ 0.8  0.8  0.7  0.7]
 [ 0.7  0.7  0.6  0.6]
 [ 0.7  0.7  0.6  0.6]
 [ 0.7  0.7  0.6  0.6]
 [ 0.7  0.7  0.6  0.6]
 [ 0.7  0.7  0.6  0.6]
 [ 0.6  0.6  0.5  0.5]
 [ 0.6  0.6  0.5  0.5]
 [ 0.6  0.6  0.5  0.5]
 [ 0.6  0.6  0.5  0.5]
 [ 0.6  0.6  0.5  0.5]
 [ 0.5  0.5  0.4  0.4]
 [ 0.5  0.5  0.4  0.4]
 [ 0.5  0.5  0.4  0.4]
 [ 0.5  0.5  0.4  0.4]
 [ 0.5  0.5  0.4  0.4]
 [ 0.4  0.4  0.3  0.3]
 [ 0.4  0.4  0.3  0.3]
 [ 0.4  0.4  0.3  0.3]
 [ 0.4  0.4  0.3  0.3]
 [ 0.4  0.4  0.3  0.3]
 [ 0.3  0.3  0.2  0.2]
 [ 0.3  0.3  0.2  0.2]
 [ 0.3  0.3  0.2  0.2]
 [ 0.3  0.3  0.2  0.2]
 [ 0.3  0.3  0.2  0.2]
 [ 0.2  0.2  0.1  0.1]
 [ 0.2  0.2  0.1  0.1]
 [ 0.2  0.2  0.1  0.1]
 [ 0.2  0.2  0.1  0.1]
 [ 0.2  0.2  0.1  0.1]
 [ 0.1  0.1  0.   0. ]
 [ 0.1  0.1  0.   0. ]
 [ 0.1  0.1  0.   0. ]
 [ 0.1  0.1  0.   0. ]
 [ 0.1  0.1  0.   0. ]]

In [35]:
print(all_array)


[[  0   1   2   3]
 [  1   4   5   2]
 [  4   6   7   5]
 [  6   8   9   7]
 [  8  10  11   9]
 [  3   2  22  23]
 [  2   5  24  22]
 [  5   7  25  24]
 [  7   9  26  25]
 [  9  11  27  26]
 [ 23  22  33  34]
 [ 22  24  35  33]
 [ 24  25  36  35]
 [ 25  26  37  36]
 [ 26  27  38  37]
 [ 34  33  44  45]
 [ 33  35  46  44]
 [ 35  36  47  46]
 [ 36  37  48  47]
 [ 37  38  49  48]
 [ 45  44  55  56]
 [ 44  46  57  55]
 [ 46  47  58  57]
 [ 47  48  59  58]
 [ 48  49  60  59]
 [ 56  55  66  67]
 [ 55  57  68  66]
 [ 57  58  69  68]
 [ 58  59  70  69]
 [ 59  60  71  70]
 [ 67  66  77  78]
 [ 66  68  79  77]
 [ 68  69  80  79]
 [ 69  70  81  80]
 [ 70  71  82  81]
 [ 78  77  88  89]
 [ 77  79  90  88]
 [ 79  80  91  90]
 [ 80  81  92  91]
 [ 81  82  93  92]
 [ 89  88  99 100]
 [ 88  90 101  99]
 [ 90  91 102 101]
 [ 91  92 103 102]
 [ 92  93 104 103]
 [100  99 110 111]
 [ 99 101 112 110]
 [101 102 113 112]
 [102 103 114 113]
 [103 104 115 114]
 [ 10  12  13  11]
 [ 12  14  15  13]
 [ 14  16  17  15]
 [ 16  18  19  17]
 [ 18  20  21  19]
 [ 11  13  28  27]
 [ 13  15  29  28]
 [ 15  17  30  29]
 [ 17  19  31  30]
 [ 19  21  32  31]
 [ 27  28  39  38]
 [ 28  29  40  39]
 [ 29  30  41  40]
 [ 30  31  42  41]
 [ 31  32  43  42]
 [ 38  39  50  49]
 [ 39  40  51  50]
 [ 40  41  52  51]
 [ 41  42  53  52]
 [ 42  43  54  53]
 [ 49  50  61  60]
 [ 50  51  62  61]
 [ 51  52  63  62]
 [ 52  53  64  63]
 [ 53  54  65  64]
 [ 60  61  72  71]
 [ 61  62  73  72]
 [ 62  63  74  73]
 [ 63  64  75  74]
 [ 64  65  76  75]
 [ 71  72  83  82]
 [ 72  73  84  83]
 [ 73  74  85  84]
 [ 74  75  86  85]
 [ 75  76  87  86]
 [ 82  83  94  93]
 [ 83  84  95  94]
 [ 84  85  96  95]
 [ 85  86  97  96]
 [ 86  87  98  97]
 [ 93  94 105 104]
 [ 94  95 106 105]
 [ 95  96 107 106]
 [ 96  97 108 107]
 [ 97  98 109 108]
 [104 105 116 115]
 [105 106 117 116]
 [106 107 118 117]
 [107 108 119 118]
 [108 109 120 119]]

In [30]:
newarray = ci + ci2
print(newarray.shape)


(50, 4)

In [31]:
type(ci)


Out[31]:
numpy.ndarray

In [21]:
print(variables['vals_nod_var1'].shape)


(1, 121)

In [23]:
print(variables['vals_nod_var1'][1])


---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-23-383e2adabf09> in <module>()
----> 1 print(variables['vals_nod_var1'][1])

netCDF4/_netCDF4.pyx in netCDF4._netCDF4.Variable.__getitem__ (netCDF4/_netCDF4.c:37923)()

netCDF4/_netCDF4.pyx in netCDF4._netCDF4.Variable._get (netCDF4/_netCDF4.c:47101)()

IndexError: 

In [19]:
print(variables['vals_nod_var1'][-1][:])
print(variables['vals_nod_var1'][-1][:].shape)


[ 1.   1.   0.9  0.9  1.   0.9  1.   0.9  1.   0.9  1.   0.9  1.   0.9  1.
  0.9  1.   0.9  1.   0.9  1.   0.9  0.8  0.8  0.8  0.8  0.8  0.8  0.8  0.8
  0.8  0.8  0.8  0.7  0.7  0.7  0.7  0.7  0.7  0.7  0.7  0.7  0.7  0.7  0.6
  0.6  0.6  0.6  0.6  0.6  0.6  0.6  0.6  0.6  0.6  0.5  0.5  0.5  0.5  0.5
  0.5  0.5  0.5  0.5  0.5  0.5  0.4  0.4  0.4  0.4  0.4  0.4  0.4  0.4  0.4
  0.4  0.4  0.3  0.3  0.3  0.3  0.3  0.3  0.3  0.3  0.3  0.3  0.3  0.2  0.2
  0.2  0.2  0.2  0.2  0.2  0.2  0.2  0.2  0.2  0.1  0.1  0.1  0.1  0.1  0.1
  0.1  0.1  0.1  0.1  0.1  0.   0.   0.   0.   0.   0.   0.   0.   0.   0.
  0. ]
(121,)

In [18]:
print(variables['vals_nod_var1'][-1])
print(variables['vals_nod_var1'][-1].shape)


[ 1.   1.   0.9  0.9  1.   0.9  1.   0.9  1.   0.9  1.   0.9  1.   0.9  1.
  0.9  1.   0.9  1.   0.9  1.   0.9  0.8  0.8  0.8  0.8  0.8  0.8  0.8  0.8
  0.8  0.8  0.8  0.7  0.7  0.7  0.7  0.7  0.7  0.7  0.7  0.7  0.7  0.7  0.6
  0.6  0.6  0.6  0.6  0.6  0.6  0.6  0.6  0.6  0.6  0.5  0.5  0.5  0.5  0.5
  0.5  0.5  0.5  0.5  0.5  0.5  0.4  0.4  0.4  0.4  0.4  0.4  0.4  0.4  0.4
  0.4  0.4  0.3  0.3  0.3  0.3  0.3  0.3  0.3  0.3  0.3  0.3  0.3  0.2  0.2
  0.2  0.2  0.2  0.2  0.2  0.2  0.2  0.2  0.2  0.1  0.1  0.1  0.1  0.1  0.1
  0.1  0.1  0.1  0.1  0.1  0.   0.   0.   0.   0.   0.   0.   0.   0.   0.
  0. ]
(121,)

In [ ]:
print(variables['vals_nod_var1'][-1][ci])
print(variables['vals_nod_var1'][-1][ci].shape)

In [17]:
print(variables['vals_nod_var1'][ci])
print(variables['vals_nod_var1'][ci].shape)


---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-17-62b8c8641153> in <module>()
----> 1 print(variables['vals_nod_var1'][ci])
      2 print(variables['vals_nod_var1'][ci].shape)

netCDF4/_netCDF4.pyx in netCDF4._netCDF4.Variable.__getitem__ (netCDF4/_netCDF4.c:37136)()

/home/lindsayad/miniconda2/envs/yt-devel/lib/python3.5/site-packages/netCDF4/utils.py in _StartCountStride(elem, shape, dimensions, grp, datashape, put)
    197         # Raise error if multidimensional indexing is used.
    198         if ea.ndim > 1:
--> 199             raise IndexError("Index cannot be multidimensional")
    200         # set unlim to True if dimension is unlimited and put==True
    201         # (called from __setitem__)

IndexError: Index cannot be multidimensional

In [11]:
print(my_io_handler.ds.step)


-1

In [ ]: