NetcdfNif (netcdf_nif v0.1.2)
Documentation for NetcdfNif.
See the c_src/netcdf_nif.c
file for detailed documentation on
functions and parameters.
Also, see the test.exs
file for a sample Elixir script and
test.erl
for the Erlang version.
iex> c "test.exs" NetcdfNif.Test.run()
Inspect the hello.nc
file with
ncdump hello.nc
Link to this section Summary
Functions
Close the NetCDF file.
Create the NetCDF file.
Define a dimension.
Define a variable.
Define a double attribute for a variable.
Define a text attribute for a variable.
Put a single (double) value into given variable.
Put a list of (double) values into given variable.
nc type for a variable
Link to this section Functions
load_nifs()
nc_close(_)
Close the NetCDF file.
Argument is file id.
Returns nil.
example
Example
iex> NetcdfNif.nc_close(6255)
nil
nc_create(_)
Create the NetCDF file.
Argument is file path.
Returns the file id.
example
Example
iex> NetcdfNif.nc_create("hello.nc")
6255
nc_def_dim(_, _, _)
Define a dimension.
Arguments are: file id, dimension name, dimension size.
Returns dimension id.
example
Example
iex> NetcdfNif.nc_def_dim(6255, 'latitude', 6)
111
nc_def_var(_, _, _, _, _)
Define a variable.
Arguments are: file id, variable name, nc type, number of dimensions, dimension id.
Returns variable id.
example
Example
iex> NetcdfNif.nc_def_var(6255, 'latitude', NetcdfNif.nc_type(:double), 1, 111)
222
nc_enddef(_)
nc_put_att_double(_, _, _, _)
Define a double attribute for a variable.
Arguments are: file id, variable id, attribute name, attribute value (double).
Can be used to, e.g., specify _FillValue
as described here:
https://docs.unidata.ucar.edu/netcdf-c/current/fill_values.html
example
Example
iex> NetcdfNif.nc_put_att_double(6255, 222, '_FillValue', 1.0)
nc_put_att_text(_, _, _, _)
Define a text attribute for a variable.
Arguments are: file id, variable id, attribute name, attribute value (string).
example
Example
iex> NetcdfNif.nc_put_att_text(6255, 222, 'units', 'degrees_north')
nc_put_var1_double(_, _, _)
Put a single (double) value into given variable.
Arguments are: file id, variable id, value (of double type).
Returns nil.
NOTE It still needs some work as I'm not sure of the indexp
variable.
example
Example
iex> NetcdfNif.nc_put_var1_double(6255, 222, 1.0)
nil
nc_put_var_double(_, _, _)
Put a list of (double) values into given variable.
Arguments are: file id, variable id, list of doubles.
Returns nil.
example
Example
iex> NetcdfNif.nc_put_var_double(6255, 222, {1.0, 2.0, 3.0})
nil
nc_type(atom)
nc type for a variable
https://docs.unidata.ucar.edu/netcdf-c/current/netcdf_8h.html#afe40bef4fdf46f2820e9cd64c64a11b5