package scipy

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type tag = [
  1. | `Netcdf_variable
]
type t = [ `Netcdf_variable | `Object ] Obj.t
val of_pyobject : Py.Object.t -> t
val to_pyobject : [> tag ] Obj.t -> Py.Object.t
val create : ?attributes:Py.Object.t -> ?maskandscale:bool -> data:[> `Ndarray ] Np.Obj.t -> typecode:Py.Object.t -> size:int -> shape:int list -> dimensions:Py.Object.t -> unit -> t

A data object for netcdf files.

`netcdf_variable` objects are constructed by calling the method `netcdf_file.createVariable` on the `netcdf_file` object. `netcdf_variable` objects behave much like array objects defined in numpy, except that their data resides in a file. Data is read by indexing and written by assigning to an indexed subset; the entire array can be accessed by the index ``:`` or (for scalars) by using the methods `getValue` and `assignValue`. `netcdf_variable` objects also have attribute `shape` with the same meaning as for arrays, but the shape cannot be modified. There is another read-only attribute `dimensions`, whose value is the tuple of dimension names.

All other attributes correspond to variable attributes defined in the NetCDF file. Variable attributes are created by assigning to an attribute of the `netcdf_variable` object.

Parameters ---------- data : array_like The data array that holds the values for the variable. Typically, this is initialized as empty, but with the proper shape. typecode : dtype character code Desired data-type for the data array. size : int Desired element size for the data array. shape : sequence of ints The shape of the array. This should match the lengths of the variable's dimensions. dimensions : sequence of strings The names of the dimensions used by the variable. Must be in the same order of the dimension lengths given by `shape`. attributes : dict, optional Attribute values (any type) keyed by string names. These attributes become attributes for the netcdf_variable object. maskandscale : bool, optional Whether to automatically scale and/or mask data based on attributes. Default is False.

Attributes ---------- dimensions : list of str List of names of dimensions used by the variable object. isrec, shape Properties

See also -------- isrec, shape

val __getitem__ : index:Py.Object.t -> [> tag ] Obj.t -> Py.Object.t

None

val __setitem__ : index:Py.Object.t -> data:Py.Object.t -> [> tag ] Obj.t -> Py.Object.t

None

val assignValue : value:[ `F of float | `I of int | `Bool of bool | `S of string ] -> [> tag ] Obj.t -> Py.Object.t

Assign a scalar value to a `netcdf_variable` of length one.

Parameters ---------- value : scalar Scalar value (of compatible type) to assign to a length-one netcdf variable. This value will be written to file.

Raises ------ ValueError If the input is not a scalar, or if the destination is not a length-one netcdf variable.

val getValue : [> tag ] Obj.t -> Py.Object.t

Retrieve a scalar value from a `netcdf_variable` of length one.

Raises ------ ValueError If the netcdf variable is an array of length greater than one, this exception will be raised.

val itemsize : [> tag ] Obj.t -> int

Return the itemsize of the variable.

Returns ------- itemsize : int The element size of the variable (e.g., 8 for float64).

val typecode : [> tag ] Obj.t -> Py.Object.t

Return the typecode of the variable.

Returns ------- typecode : char The character typecode of the variable (e.g., 'i' for int).

val dimensions : t -> string list

Attribute dimensions: get value or raise Not_found if None.

val dimensions_opt : t -> string list option

Attribute dimensions: get value as an option.

val to_string : t -> string

Print the object to a human-readable representation.

val show : t -> string

Print the object to a human-readable representation.

val pp : Format.formatter -> t -> unit

Pretty-print the object to a formatter.

OCaml

Innovation. Community. Security.