module GDAL::RasterBand::Extensions
Public Instance Methods
each_overview() { |overview(i)| ... }
click to toggle source
@return [Enumerator]
# File lib/gdal/extensions/raster_band/extensions.rb, line 11 def each_overview return enum_for(:each_overview) unless block_given? overview_count.times do |i| yield overview(i) end end
overviews()
click to toggle source
@return [Array]
# File lib/gdal/extensions/raster_band/extensions.rb, line 20 def overviews each_overview.to_a end
pixel_count()
click to toggle source
The total number of pixels in the raster band.
@return [Integer]
# File lib/gdal/extensions/raster_band/extensions.rb, line 70 def pixel_count x_size * y_size end
projected_points()
click to toggle source
Each pixel of the raster projected using the dataset’s geo_transform. The output NArray
is a 3D array where the inner-most array is a the lat an lon, those are contained in an array per pixel line, and finally the outer array contains each of the pixel lines.
@return [NArray]
# File lib/gdal/extensions/raster_band/extensions.rb, line 52 def projected_points narray = GDAL._narray_from_data_type(data_type, 2, x_size, y_size) geo_transform = dataset.geo_transform y_size.times do |y_point| x_size.times do |x_point| coords = geo_transform.apply_geo_transform(x_point, y_point) narray[0, x_point, y_point] = coords[:x_geo] || 0 narray[1, x_point, y_point] = coords[:y_geo] || 0 end end narray end
to_a()
click to toggle source
@return [Array]
# File lib/gdal/extensions/raster_band/extensions.rb, line 25 def to_a read_lines_by_block.to_a end
to_na(to_data_type = nil)
click to toggle source
Iterates through all lines and builds an NArray
of pixels.
@return [NArray]
# File lib/gdal/extensions/raster_band/extensions.rb, line 32 def to_na(to_data_type = nil) narray = NArray.to_na(to_a) return narray unless to_data_type narray_type = GDAL._gdal_data_type_to_narray_type_constant(to_data_type) narray.to_type(narray_type) end
to_nna()
click to toggle source
# File lib/gdal/extensions/raster_band/extensions.rb, line 42 def to_nna Numo::NArray[to_a] end