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

Close the NetCDF file.

Argument is file id.

Returns nil.

https://docs.unidata.ucar.edu/netcdf-c/current/group__datasets.html#ga07cbeee9c98b5b21713df60310edc3b1

example

Example

iex> NetcdfNif.nc_close(6255)
nil

Create the NetCDF file.

Argument is file path.

Returns the file id.

https://docs.unidata.ucar.edu/netcdf-c/current/group__datasets.html#ga041eacc9554e03d78a154a76e31e5b30

example

Example

iex> NetcdfNif.nc_create("hello.nc")
6255
Link to this function

nc_def_dim(_, _, _)

Define a dimension.

Arguments are: file id, dimension name, dimension size.

Returns dimension id.

https://docs.unidata.ucar.edu/netcdf-c/current/group__dimensions.html#ga6a1e2683ca1acf91437b790979ac7b8a

example

Example

iex> NetcdfNif.nc_def_dim(6255, 'latitude', 6)
111
Link to this function

nc_def_var(_, _, _, _, _)

Define a variable.

Arguments are: file id, variable name, nc type, number of dimensions, dimension id.

Returns variable id.

https://docs.unidata.ucar.edu/netcdf-c/current/group__variables.html#gac7e8662c51f3bb07d1fc6d6c6d9052c8

example

Example

iex> NetcdfNif.nc_def_var(6255, 'latitude', NetcdfNif.nc_type(:double), 1, 111)
222
Link to this function

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

https://docs.unidata.ucar.edu/netcdf-c/current/group__attributes.html#ga4fbf52b467add3788ecbf17d211af079

example

Example

iex> NetcdfNif.nc_put_att_double(6255, 222, '_FillValue', 1.0)
Link to this function

nc_put_att_text(_, _, _, _)

Define a text attribute for a variable.

Arguments are: file id, variable id, attribute name, attribute value (string).

https://docs.unidata.ucar.edu/netcdf-c/current/group__attributes.html#ga4fbf52b467add3788ecbf17d211af079

example

Example

iex> NetcdfNif.nc_put_att_text(6255, 222, 'units', 'degrees_north')
Link to this function

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.

https://docs.unidata.ucar.edu/netcdf-c/current/group__variables.html#ga29e99cbc7ed704a14100e17d9eec8a66

example

Example

iex> NetcdfNif.nc_put_var1_double(6255, 222, 1.0)
nil
Link to this function

nc_put_var_double(_, _, _)

Put a list of (double) values into given variable.

Arguments are: file id, variable id, list of doubles.

Returns nil.

https://docs.unidata.ucar.edu/netcdf-c/current/group__variables.html#ga29e99cbc7ed704a14100e17d9eec8a66

example

Example

iex> NetcdfNif.nc_put_var_double(6255, 222, {1.0, 2.0, 3.0})
nil

nc type for a variable

https://docs.unidata.ucar.edu/netcdf-c/current/netcdf_8h.html#afe40bef4fdf46f2820e9cd64c64a11b5