New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GUI cannot switch dimensions #1375

Closed
doutriaux1 opened this Issue Jun 9, 2015 · 12 comments

Comments

Projects
None yet
4 participants
@doutriaux1
Member

doutriaux1 commented Jun 9, 2015

When trying to switch/reorder the dimensions from the GUI, I get a popup window with the following message:

error executing pipeline. See log for details

The log says:

Traceback (most recent call last):
  File "/usr/local/uvcdat/2.2.0/vistrails/vistrails/core/modules/vistrails_module.py", line 327, in update
    self.compute()
  File "/usr/local/uvcdat/2.2.0/vistrails/vistrails/packages/uvcdat_cdms/init.py", line 378, in compute
    self.var = self.to_python()
  File "/usr/local/uvcdat/2.2.0/vistrails/vistrails/packages/uvcdat_cdms/init.py", line 237, in to_python
    var = cdmsfile.__call__(varName, **kwargs)
  File "/usr/local/uvcdat/2.2.0/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cdms2/cudsinterface.py", line 45, in __call__
    return v(*args, **kwargs)
  File "/usr/local/uvcdat/2.2.0/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cdms2/avariable.py", line 155, in __call__
    grid=grid)
  File "/usr/local/uvcdat/2.2.0/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cdms2/selectors.py", line 195, in unmodified_select
    raw=raw)
  File "/usr/local/uvcdat/2.2.0/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cdms2/avariable.py", line 759, in subRegion
    return self.subSlice(*slicelist, **d)
  File "/usr/local/uvcdat/2.2.0/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cdms2/avariable.py", line 616, in subSlice
    result = result.reorder(order).regrid(grid)
  File "/usr/local/uvcdat/2.2.0/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cdms2/avariable.py", line 950, in reorder
    permutation = order2index(axes, order)
  File "/usr/local/uvcdat/2.2.0/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cdms2/avariable.py", line 1580, in order2index
    (item,order)
CDMSError: Index 2 out of range in order 102
ERROR:root:Uncaught exception: "Index 2 out of range in order 102"
None

The command line equivalent is:

In [1]: s=f("clt",order='ytx')

and works.

@remram44 assigned to you but feel free to reassign appropriately

Picture on how to get the bug:
switch_dims
then click load and close.

@doutriaux1 doutriaux1 added this to the 2.3 milestone Jun 9, 2015

@remram44

This comment has been minimized.

Contributor

remram44 commented Jun 9, 2015

Duplicate of #1277? Also looks related to #1280

@doutriaux1

This comment has been minimized.

Member

doutriaux1 commented Jun 9, 2015

it is similar to #1277 but not the same. #1277 is getting the values while this re-orders the axes. But it's probably a similar fix. #1280 is vcs issue not vistrials/gui related.

@remram44

This comment has been minimized.

Contributor

remram44 commented Jun 11, 2015

I can't reproduce your error, although plotting the variable leads to an exception (I assume the crazy-looking plot is expected; screenshot).

@aashish24 aashish24 assigned chaosphere2112 and unassigned remram44 Oct 15, 2015

@aashish24

This comment has been minimized.

Contributor

aashish24 commented Oct 15, 2015

@chaosphere2112 do we care about this bug?

@chaosphere2112

This comment has been minimized.

Contributor

chaosphere2112 commented Oct 15, 2015

@aashish24 Sure!

@doutriaux1 The problem is that Vistrails is by default applying a squeeze argument of 1, which is removing the axis you've shrunk. I'll remove that argument.

@doutriaux1

This comment has been minimized.

Member

doutriaux1 commented Oct 16, 2015

as @chaosphere2112 discovered this is really an underlying issue with cdms2, i will open a separate issue for the cdms2 bug.

@doutriaux1

This comment has been minimized.

Member

doutriaux1 commented Oct 16, 2015

actually @chaosphere2112 it seems to work in cdms

u=f("u",squeeze=1,order="yx...",time=slice(0,1),level=slice(0,1))

but the (kind of user error really folowing doesn't:

u=f("u",squeeze=1,order="yzx",time=slice(0,1),level=slice(0,1))

Indeed if you "sqeeze out" levels you can't ask for them in the ordering

@chaosphere2112

This comment has been minimized.

Contributor

chaosphere2112 commented Oct 16, 2015

Right, but order also takes indices:

In [1]: import vcs, cdms2

In [2]: f = cdms2.open(vcs.sample_data + "/clt.nc")

In [3]: u = f("u", squeeze=1, order="0321")
---------------------------------------------------------------------------
CDMSError                                 Traceback (most recent call last)
<ipython-input-3-267c0c987ea2> in <module>()
----> 1 u = f("u", squeeze=1, order="0321")

/Users/fries2/bin/uvcdat/2.4-rc2/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cdms2/cudsinterface.pyc in __call__(self, id, *args, **kwargs)
     31             except ( AttributeError, TypeError ):
     32                 raise CDMSError, "No such variable, " + id
---> 33         return v(*args, **kwargs)
     34 
     35     def __getitem__(self, key):

/Users/fries2/bin/uvcdat/2.4-rc2/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cdms2/avariable.pyc in __call__(self, *args, **kwargs)
    157                                          squeeze=squeeze,
    158                                          order=order,
--> 159                                          grid=grid)
    160 
    161     select = __call__

/Users/fries2/bin/uvcdat/2.4-rc2/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cdms2/selectors.pyc in unmodified_select(self, variable, raw, squeeze, order, grid)
    193      # result is variable when there are no components, for example.
    194             return result.subRegion(squeeze=squeeze, order=order, grid=grid,
--> 195                                     raw=raw)
    196         else:
    197             return result

/Users/fries2/bin/uvcdat/2.4-rc2/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cdms2/avariable.pyc in subRegion(self, *specs, **keys)
    765                  'grid':grid,
    766                 }
--> 767             return self.subSlice(*slicelist, **d)
    768 
    769         #

/Users/fries2/bin/uvcdat/2.4-rc2/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cdms2/avariable.pyc in subSlice(self, *specs, **keys)
    622                 elif order != order2:
    623                     raise CDMSError, 'grid, order options not compatible.'
--> 624             result = result.reorder(order).regrid(grid)
    625             if raw == 0:
    626                 return result

/Users/fries2/bin/uvcdat/2.4-rc2/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cdms2/avariable.pyc in reorder(self, order)
    956             return self
    957         axes = self.getAxisList()
--> 958         permutation = order2index(axes, order)
    959         if permutation == range(len(axes)):
    960             return self

/Users/fries2/bin/uvcdat/2.4-rc2/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cdms2/avariable.pyc in order2index(axes, order)
   1587             if item >= n:
   1588                 raise CDMSError, 'Index %d out of range in order %s' %\
-> 1589                                  (item,order)
   1590             permutation[pos] = item
   1591             pos += 1

CDMSError: Index 3 out of range in order 0321

which is what the GUI does to reorder the dimensions.

@chaosphere2112

This comment has been minimized.

Contributor

chaosphere2112 commented Oct 16, 2015

@doutriaux1 I can just disable the auto-squeeze in the GUI; that would resolve the issue easily enough.

@doutriaux1

This comment has been minimized.

Member

doutriaux1 commented Oct 16, 2015

an option to turn it on/off is better, so if user run into this werid case they can turn it off. I think users prefer squeeze=1 by default.

@chaosphere2112

This comment has been minimized.

Contributor

chaosphere2112 commented Oct 16, 2015

Yeah; it looks like there's a preference to toggle it on/off globally for the app. I think a checkbox in the variable editor would be simple enough to add. I'll take a quick whack at it.

@chaosphere2112

This comment has been minimized.

Contributor

chaosphere2112 commented Oct 16, 2015

OK, accidentally pushed to uvcdat-master, but this issue should now be resolved. I added a "Squeeze Dimensions" checkbox into the load variable window, and now the indices for the order argument are calculated based off of whether squeeze is set or not (and will correctly eliminate squeezed axes from the order list).

@doutriaux1 doutriaux1 closed this Oct 16, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment