View Source NetCDF

Elixir NIF Bindings for the Rust NetCDF library

installation

Installation

If available in Hex, the package can be installed by adding netcdf to your list of dependencies in mix.exs:

def deps do
  [
    {:netcdf, "~> 0.1.0"}
  ]
end

dependencies

Dependencies

Before compiling, you also must ensure that the following dependencies are installed on your system:

  • hdf5
  • libnetcdf

On Ubuntu:

apt install ibhdf5-serial-dev libnetcdf-dev

On macOS:

brew install netcdf-cxx, which will also bring hdf5 as a dependency

utilities

Utilities

Although not necessary for the library to work, ncks is helpful for downloading .nc files in the correct way, as well as reading their contents for header and format exploration.

On Ubuntu, you can install it using: apt install nco On macOS, you can install it using: brew install nco

usage

Usage

A NetCDF file can be loaded into Elixir with the following command:

filename = # Elixir string with the path to the NetCDF file
{:ok, file} = NetCDF.File.open(filename)

We can inspect its variables in the struct's :variables field. Finally, variables can be loaded as follows:

# loading the first variable from the file
variable_name = hd(file.variables)
{:ok, variable} = NetCDF.Variable.load(file, variable_name)

authors

Authors

We are very thankful for the many contributors

versioning

Versioning

This library follows Semantic Versioning

looking-for-help-with-your-elixir-project

Looking for help with your Elixir project?

At DockYard we are ready to help you build your next Elixir project. We have a unique expertise in Elixir and Phoenix development that is unmatched. Get in touch!

At DockYard we love Elixir! You can read our Elixir blog posts

DockYard, Inc. © 2022

@DockYard

Licensed under the MIT license