NetCDF  4.9.3
quickstart_filters.md
1 Appendix D.1. NetCDF-4 Filter QuickStart {#nc_filters_quickstart}
2 ==============================
3 
4 > For full **Filters** documentation, see \ref filters.
5 
6 **The `libnetcdf.so` library cannot talk to plugin libraries directly. Instead, it requires an "interface" library, which acts as a go-between. The interface libraries are built by the netCDF libraries, when the underlying plugin libraries are detected during configure/build.**
7 
8 Building and Installing the Interface Libraries {#nc_filters_qs_building}
9 ----------------------------------
10 
11 ### Configuring
12 
13 When configuring netcdf via either the `configure` script or via `cmake`, you'll need to specify the location to install the interface libraries, as follows:
14 
15 * configure: `--enable-plugins` `--with-plugin-dir=$NCPLUGIN_DIR`
16 * cmake: `-DPLUGIN_INSTALL_DIR=$NCPLUGIN_DIR`
17 
18 where `$NCPLUGIN_DIR` is the path to the user-defined directory, e.g. `/usr/local/nc-plugins`
19 
20 After compiling and installing `libnetcdf`, the interface libraries for those filters detected will be installed in the user-specified `NCPLUGIN_DIR`.
21 
22 > `nc-config --plugindir` will return the location where plugins were installed.
23 
24 Using the Interface Libraries at Run-time {#nc_filters_qs_runtime}
25 ---------------------------------
26 
27 For historical reasons, `libnetcdf` uses the environmental variable `HDF5_PLUGIN_PATH` to locate the interface libraries at run-time. This location should be set to the `$NCPLUGIN_DIR` specified when building and installing `libnetcdf`.
28 
29 
30 Example Workflow (blosc) {#nc_filters_qs_workflow_example}
31 --------------------------------------------------
32 
33 From scratch, the steps to get this to work are as follows, and assumes `libhdf5` was installed.
34 
35 1. Install the filter library, and the associate development headers.
36 2. Configure netCDF with `--enable-plugins` and `--with-plugin-dir=$HOME/netcdf-plugins`
37 3. Ensure `blosc` is specified in the generated `libnetcdf.settings` file.
38 4. Run make, make install.
39 
40 Once built and installed, set the environmental variable `HDF5_PLUGIN_PATH=$HOME/netcdf-plugins`.
41 
42 The reason this works is because:
43 
44 1. NetCDF builds the interface library.
45 2. `ncdump` knows where to find the interface library because `HDF5_PLUGIN_PATH` is set.