package gdal

  1. Overview
  2. Docs

Block IO

These functions should generally be faster than the more generic read and write functions.

exception Wrong_dimensions
type offset_t = {
  1. block : int * int;
  2. offset : int * int;
}
val make_block_offset : block:(int * int) -> offset:(int * int) -> offset_t
val pixel_of_block_offset : (_, _) t -> offset_t -> int * int

pixel_of_block_offset t returns a function which may be used to convert offsets within a block to pixel offsets within the band t.

  • returns

    f: A function which, given a block index block and an offset within that block offset returns the index of the matching pixel.

val block_of_pixel_offset : (_, _) t -> int -> int -> offset_t

block_of_pixel_offset t returns a function which returns the block_offset_t matching the pixel offset provided.

val get_block_count : (_, _) t -> int * int

get_block_count t returns (nx, ny) giving the number of blocks in the band's x direction (nx) and the number of blocks in the band's y direction (ny).

val get_size : (_, _) t -> int * int

get_size t returns the native (x, y) dimensions of the individual blocks making up t.

val read : ?data:('v, 'e, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Array2.t -> ('v, 'e) t -> column:int -> row:int -> ('v, 'e, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Array2.t

read ?data t ~column ~row returns the block at given offset in t.

  • parameter data

    will be written to and returned if it is provided, otherwise a fresh Bigarray.Array2.t will be allocated. data must be large enough to hold at least on block of values.

  • raises Wrong_dimensions

    if data is provided and does not have enough elements to hold a block.

val write : ('v, 'e) t -> column:int -> row:int -> ('v, 'e, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Array2.t -> unit

write t ~column ~row data writes data to the block at the given offset in t.

val iter : ('v, 'e) t -> read:bool -> write:bool -> (int -> int -> ('v, 'e, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Array2.t -> unit) -> unit

iter t ~read ~write f applies f to each block in t. The read and write arguments determine if values are from t, written to t or both.

  • parameter f

    gets three arguments: the i index, j index and a bigarray with the contents of the current block. If read is true then the bigarray will contain the current contents of the block at (i, j). If write is true then the contents of the bigarray will be written to the block at (i, j) after f returns.

val iter_read : ('v, 'e) t -> (int -> int -> ('v, 'e, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Array2.t -> unit) -> unit

iter_read t f applies f to each block in t.

  • parameter f

    gets three arguments: the column index, row index and a bigarray with the contents of the current block.

val iter_write : ('v, 'e) t -> (int -> int -> ('v, 'e, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Array2.t -> unit) -> unit

iter_write t f applies f to each block in t.

  • parameter f

    gets three arguments: the column index, row index and a bigarray which should be filled with the values meant for the current block.

OCaml

Innovation. Community. Security.