Example #1
0
    def reconcile(self, axes):
        """Return a grid that is consistent with the axes, or None.
        For curvilinear grids this means that the grid-related axes are
        contained in the 'axes' list. 
        """
        result = self
        selfaxes = self.getAxisList()
        missing = []
        for i in range(2):
            if selfaxes[i] not in axes:
                missing.append(i)
                result = None

        # Some of the grid axes are not in the 'axes' list
        if result is None:
            result = self.clone()
            used = []  # axes already matched
            for i in missing:
                for item in axes:
                    if (item not in used) and len(
                            selfaxes[i]) == len(item) and allclose(
                                selfaxes[i], item):
                        result._lataxis_.setAxis(i, item)
                        result._lonaxis_.setAxis(i, item)
                        used.append(item)
                        break
                else:
                    result = None
                    break

        return result
Example #2
0
    def reconcile(self, axes):
        """Return a grid that is consistent with the axes, or None.
        For curvilinear grids this means that the grid-related axes are
        contained in the 'axes' list. 
        """
        result = self
        selfaxes = self.getAxisList()
        missing = []
        for i in range(1):
            if selfaxes[i] not in axes:
                missing.append(i)
                result = None
            
        # Some of the grid axes are not in the 'axes' list
        if result is None:
            result = self.clone()
            for i in missing:
                for item in axes:
                    if (len(selfaxes[i])==len(item)) and allclose(selfaxes[i], item):
                        result._lataxis_.setAxis(i,item)
                        result._lonaxis_.setAxis(i,item)
                        break
                else:
                    result = None
                    break

        return result