def sector(self, start_ray, end_ray, start_distance=None, end_distance=None, units='b'):
        """Slices a sector from the selected dataset.
        
        Slice contains the start and end rays. If start and end rays are equal 
        one ray is returned. If the start_ray is greater than the end_ray
        slicing continues over the 359-0 border.  
        
        Parameters
        ----------
        start_ray : int
            Starting ray of of the slice first ray is 0
        end_ray : int
            End ray of the slice, last ray is 359
            
        Keywords
        --------
        start_distance : int
            Starting distance of the slice, if not defined sector starts
            form zero
        end_distance : int
            Ending distance of the slice, if not defined sector continues to
            the end last ray of the dataset
        units : str            
            Units used in distance slicing. Option 'b' means that bin number
            is used as index. Option 'm' means that meters are used and the
            slicing index is calculated using bin width.
             
            
        Returns
        -------
        sector : ndarray
            Numpy array containing the sector values
            
        Examples
        --------
        Get one ray from the selected dataset
        
        >>> pvol = odimPVOL('pvol.h5')
        >>> pvol.select_dataset('A', 'DBZH')
        >>> ray = pvol.sector(10, 10)

        Get sector from selected dataset, rays from 100 to 200
        at distances from 5 km to 10 km.
        
        >>> pvol = odimPVOL('pvol.h5')
        >>> pvol.select_dataset('A', 'DBZH')
        >>> sector = pvol.sector(100, 200, 5000, 10000)                
        """
        if self.dataset is None:
            raise ValueError('Dataset is not selected')

        # Validate parameter values        
        ray_max, distance_max = self.dataset.shape
        if start_ray > ray_max:
            raise ValueError('Value of start_ray is bigger than the number of rays')
        if start_ray < 0:
            raise ValueError('start_ray must be non negative')
            

            
        if start_distance is None:
            start_distance_index = 0
        else:
            if units == 'b':
                start_distance_index = start_distance
            elif units == 'm': 
                try:
                    rscale = next(self.attr_gen('rscale')).value
                except:
                    raise MissingMetadataError            
                start_distance_index = int(start_distance / rscale)
        if end_distance is None:
            end_distance_index = self.dataset.shape[1]
        else:
            if units == 'b':
                end_distance_index = end_distance           
            elif units == 'm':             
                end_distance_index = int(end_distance / rscale) 

        if end_ray is None:
            sector = self.dataset[start_ray, start_distance_index:end_distance_index]
        else:
            if start_ray <= end_ray:
                sector = self.dataset[start_ray:end_ray+1, start_distance_index:end_distance_index]
            else:
                sector1 = self.dataset[start_ray:, start_distance_index:end_distance_index]
                sector2 = self.dataset[:end_ray+1, start_distance_index:end_distance_index]
                sector = np.concatenate((sector1, sector2), axis=0)
        return sector
def sector ( self , start_ray , end_ray , start_distance = None , end_distance = None , units = 'b' ) : if self . dataset is None : raise ValueError ( 'Dataset is not selected' ) ray_max , distance_max = self . dataset . shape if start_ray > ray_max : raise ValueError ( 'Value of start_ray is bigger than the number of rays' ) if start_ray < 0 : raise ValueError ( 'start_ray must be non negative' ) if start_distance is None : start_distance_index = 0 else : if units == 'b' : start_distance_index = start_distance elif units == 'm' : try : rscale = next ( self . attr_gen ( 'rscale' ) ) . value except : raise MissingMetadataError start_distance_index = int ( start_distance / rscale ) if end_distance is None : end_distance_index = self . dataset . shape [ 1 ] else : if units == 'b' : end_distance_index = end_distance elif units == 'm' : end_distance_index = int ( end_distance / rscale ) if end_ray is None : sector = self . dataset [ start_ray , start_distance_index : end_distance_index ] else : if start_ray <= end_ray : sector = self . dataset [ start_ray : end_ray + 1 , start_distance_index : end_distance_index ] else : sector1 = self . dataset [ start_ray : , start_distance_index : end_distance_index ] sector2 = self . dataset [ : end_ray + 1 , start_distance_index : end_distance_index ] sector = np . concatenate ( ( sector1 , sector2 ) , axis = 0 ) return sector
Slices a sector from the selected dataset.
        
        Slice contains the start and end rays. If start and end rays are equal 
        one ray is returned. If the start_ray is greater than the end_ray
        slicing continues over the 359-0 border.  
        
        Parameters
        ----------
        start_ray : int
            Starting ray of of the slice first ray is 0
        end_ray : int
            End ray of the slice, last ray is 359
            
        Keywords
        --------
        start_distance : int
            Starting distance of the slice, if not defined sector starts
            form zero
        end_distance : int
            Ending distance of the slice, if not defined sector continues to
            the end last ray of the dataset
        units : str            
            Units used in distance slicing. Option 'b' means that bin number
            is used as index. Option 'm' means that meters are used and the
            slicing index is calculated using bin width.
             
            
        Returns
        -------
        sector : ndarray
            Numpy array containing the sector values
            
        Examples
        --------
        Get one ray from the selected dataset
        
        >>> pvol = odimPVOL('pvol.h5')
        >>> pvol.select_dataset('A', 'DBZH')
        >>> ray = pvol.sector(10, 10)

        Get sector from selected dataset, rays from 100 to 200
        at distances from 5 km to 10 km.
        
        >>> pvol = odimPVOL('pvol.h5')
        >>> pvol.select_dataset('A', 'DBZH')
        >>> sector = pvol.sector(100, 200, 5000, 10000)