Reorganized files to reduce clutter and to make things a little more coherent. This is an ongoing process.

This commit is contained in:
Ward Fisher 2014-02-24 16:06:09 -07:00
parent 976bc707f3
commit 56e2d0349d
10 changed files with 173 additions and 188 deletions

1
.gitignore vendored
View File

@ -14,3 +14,4 @@ scan-build
*.zip
*.gz
Makefile
.DS_Store

View File

@ -1,25 +1,15 @@
\page netCDF-CMake Build Instructions for netCDF-C using CMake
# Table of Contents
[TOC]
* [Overview](#overview)
* [Requirements](#requirements)
* [Build Process](#buildprocess)
* [Building](#building)
* [Testing](#testing)
* [FAQ](#FAQ)
# <a id="overview"></a>Overview
# Overview {#cmake_overview}
Starting with netCDF-C 4.3.0, we are happy to announce the inclusion of CMake support. CMake will allow for building netCDF on a wider range of platforms, include Microsoft Windows with Visual Studio. CMake support also provides robust unit and regression testing tools. We will also maintain the standard autotools-based build system in parallel.
In addition to providing new build options for netCDF-C, we will also provide pre-built binary downloads for the shared versions of netCDF for use with Visual Studio.
# <a id="requirements"></a> Requirements
# Requirements {#cmake_requirements}
The following packages are required to build netCDF-C using CMake.
* netCDF-C Source Code
@ -32,7 +22,7 @@ The following packages are required to build netCDF-C using CMake.
<img src="deptree.jpg" height="250px" />
</center>
# <a id="buildprocess"></a>The CMake Build Process
# The CMake Build Process {#cmake_build}
There are four steps in the Build Process when using CMake
@ -43,7 +33,7 @@ There are four steps in the Build Process when using CMake
For users who prefer pre-built binaries, installation packages are available at \ref winbin
## <a id="configuration"></a>Configuration
## Configuration {#cmake_configuration}
The output of the configuration step is a project file based on the appropriate configurator specified. Common configurators include:
@ -52,7 +42,7 @@ The output of the configuration step is a project file based on the appropriate
* CodeBlocks
* ... and others
### Common CMake Options
### Common CMake Options {#cmake_common_options}
| **Option** | **Autotools** | **CMake** |
| :------- | :---- | :----- |
@ -66,7 +56,7 @@ Specify a custom library location | Use *CFLAGS* and *LDFLAGS* | -D"CMAKE\_PREFI
A full list of *basic* options can be found by invoking `cmake [Source Directory] -L`. To enable a list of *basic* and *advanced* options, one would invoke `cmake [Source Directory] -LA`.
### Configuring your build from the command line.
### Configuring your build from the command line. {#cmake_command_line}
The easiest configuration case would be one in which all of the dependent libraries are installed on the system path (in either Unix/Linux or Windows) and all the default options are desired. From the build directory (often, but not required to be located within the source directory):
@ -76,9 +66,7 @@ If you have libraries installed in a custom directory, you may need to specify t
> $ cmake [Source Directory] -DCMAKE\_PREFIX\_PATH=/usr/custom_libraries/
## <a id="building"></a>Building
## Building {#cmake_building}
The compiler can be executed directly with 'make' or the appropriate command for the configurator which was used.
@ -88,9 +76,7 @@ Building can also be executed indirectly via cmake:
> $ cmake --build [Build Directory]
## <a id="testing"></a>Testing
## Testing {#cmake_testing}
Testing can be executed several different ways:
@ -104,7 +90,7 @@ or
> $ cmake --build [Build Directory] --target test
## <a id="installation"></a>Installation
## Installation {#cmake_installation}
Once netCDF has been built and tested, it may be installed using the following commands:
@ -114,107 +100,6 @@ or
> $ cmake --build [Build Directory] --target install
# <a id="FAQ"></a> CMake Frequently Asked Questions (FAQ)
# See Also {#cmake_see_also}
## <a id="faqtoc"></a> Table of Contents
* [How can I see the options available to CMake?](#listoptions)
* [How do I specify how to build a shared or static library?](#sharedstatic)
* [Can I build both shared and static libraries at the same time with cmake?](#sharedstaticboth)
* [What if I want to link against multiple libraries in a non-standard location?](#nonstdloc)
* [How can I specify a Parallel Build using HDF5](#parallelhdf)
## Frequently Asked Questions
* **How can I see the options available to CMake?** <a id="listoptions"></a>
$ cmake [path to source tree] -L - This will show the basic options.
$ cmake [path to source tree] -LA - This will show the basic and advanced options.
[Back to the top of the FAQ](#faqtoc)
--
* **How do I specify how to build a shared or static library?** <a id="sharedstatic"></a>
This is controlled with the internal `cmake` option, `BUILD_SHARED_LIBS`.
$ cmake [Source Directory] -DBUILD_SHARED_LIBS=[ON/OFF]
[Back to the top of the FAQ](#faqtoc)
--
* **Can I build both shared and static libraries at the same time with cmake?** <a id="sharedstaticboth"></a>
Not at this time; it is required to instead build first one version, and then the other, if you need both.
[Back to the top of the FAQ](#faqtoc)
--
* **How can I specify linking against a particular library?** <a id="partlib"></a>
It depends on the library. To specify a custom `ZLib`, for example, you would do the following:
$ cmake [Source Directory] -DZLIB_LIBRARY=/path/to/my/zlib.lib
`HDF5` is more complex, since it requires both the `hdf5` and `hdf5_hl` libraries. You would specify custom `HDF5` libraries as follows:
$ cmake [Source Directory] -DHDF5_LIB=/path/to/hdf5.lib \
-DHDF5_HL_LIB=/path/to/hdf5_hl.lib \
-DHDF5_INCLUDE_DIR=/path/to/hdf5/include
Alternatively, you may specify:
$ cmake [Source Directory] \
-DHDF5_LIBRARIES="/path/to/hdf5.lib;/path/to/hdf5_hl.lib" \
-DHDF5_INCLUDE_DIRS=/path/to/hdf5/include/
[Back to the top of the FAQ](#faqtoc)
--
* **What if I want to link against multiple libraries in a non-standard location?**<a id="nonstdloc"></a>
You can specify the path to search when looking for dependencies and header files using the `CMAKE_PREFIX_PATH` variable:
* Windows:
$ cmake [Source Directory] -DCMAKE_PREFIX_PATH=c:\shared\libs\
* Linux/Unix/OSX:
$ cmake [Source Directory] -DCMAKE_PREFIX_PATH=/usr/custom_library_locations/
[Back to the top of the FAQ](#faqtoc)
--
* **How can I specify a Parallel Build using HDF5** <a id="parallelhdf"></a>
If cmake is having problems finding the parallel `HDF5` install, you can specify the location manually:
$ cmake [Source Directory] -DENABLE_PARALLEL=ON \
-DHDF5_LIB=/usr/lib64/openmpi/lib/libhdf5.so \
-DHDF5_HL_LIB=/usr/lib64/openmpi/lib/libhdf5.hl.so \
-DHDF5_INCLUDE_DIR=/usr/include/openmpi-x86_64 \
You will, of course, need to use the location of the libraries specific to your development environment.
[Back to the top of FAQ](#faqtoc)
For further information regarding NetCDF and CMake, see \ref cmake_faq

View File

@ -577,6 +577,7 @@ INPUT = \
@abs_top_srcdir@/man4/Building-with-CMake.md \
@abs_top_srcdir@/man4/windows-binaries.md \
@abs_top_srcdir@/man4/all-error-codes.md \
@abs_top_srcdir@/man4/cmake_faq.md \
@abs_top_srcdir@/man4/guide.dox \
@abs_top_srcdir@/man4/types.dox \
@abs_top_srcdir@/man4/notes.dox \

72
man4/cmake_faq.md Normal file
View File

@ -0,0 +1,72 @@
CMake-Related Frequently-Asked-Questions (FAQ) {#cmake_faq}
==============================================
[TOC]
# CMake Frequently Asked Questions (FAQ) {#cmake_faq_2}
Below are a list of commonly-asked questions regarding NetCDF and CMake.
## How can I see the options available to CMake? {#listoptions}
$ cmake [path to source tree] -L - This will show the basic options.
$ cmake [path to source tree] -LA - This will show the basic and advanced options.
## How do I specify how to build a shared or static library? {#sharedstatic}
This is controlled with the internal `cmake` option, `BUILD_SHARED_LIBS`.
$ cmake [Source Directory] -DBUILD_SHARED_LIBS=[ON/OFF]
## Can I build both shared and static libraries at the same time with cmake? {#sharedstaticboth}
Not at this time; it is required to instead build first one version, and then the other, if you need both.
## How can I specify linking against a particular library? {#partlib}
It depends on the library. To specify a custom `ZLib`, for example, you would do the following:
$ cmake [Source Directory] -DZLIB_LIBRARY=/path/to/my/zlib.lib
`HDF5` is more complex, since it requires both the `hdf5` and `hdf5_hl` libraries. You would specify custom `HDF5` libraries as follows:
$ cmake [Source Directory] -DHDF5_LIB=/path/to/hdf5.lib \
-DHDF5_HL_LIB=/path/to/hdf5_hl.lib \
-DHDF5_INCLUDE_DIR=/path/to/hdf5/include
Alternatively, you may specify:
$ cmake [Source Directory] \
-DHDF5_LIBRARIES="/path/to/hdf5.lib;/path/to/hdf5_hl.lib" \
-DHDF5_INCLUDE_DIRS=/path/to/hdf5/include/
## What if I want to link against multiple libraries in a non-standard location? {#nonstdloc}
You can specify the path to search when looking for dependencies and header files using the `CMAKE_PREFIX_PATH` variable:
* Windows:
$ cmake [Source Directory] -DCMAKE_PREFIX_PATH=c:\shared\libs\
* Linux/Unix/OSX:
$ cmake [Source Directory] -DCMAKE_PREFIX_PATH=/usr/custom_library_locations/
## How can I specify a Parallel Build using HDF5 {#parallelhdf}
If cmake is having problems finding the parallel `HDF5` install, you can specify the location manually:
$ cmake [Source Directory] -DENABLE_PARALLEL=ON \
-DHDF5_LIB=/usr/lib64/openmpi/lib/libhdf5.so \
-DHDF5_HL_LIB=/usr/lib64/openmpi/lib/libhdf5.hl.so \
-DHDF5_INCLUDE_DIR=/usr/include/openmpi-x86_64 \
You will, of course, need to use the location of the libraries specific to your development environment.

View File

@ -1,9 +1,11 @@
/** \file
Documentation of error handling.
\page Programming Notes
\page programming_notes Programming Notes
\section error_handling Error Handling
\tableofcontents
\section error_handling_notes Error Handling
Each netCDF function returns an integer status value. Non-zero values
indicate error.

View File

@ -11,6 +11,8 @@ library.
\page getting Getting NetCDF
\tableofcontents
\section sec_get_pre_built Getting pre-built netCDF-C libraries.
The easiest way to get netCDF is through a package management program,
@ -22,6 +24,9 @@ When getting netCDF from a software repository, you will wish to get
the development version of the package ("netcdf-devel"). This includes
the netcdf.h header file.
\note If you are interested in building NetCDF-C on Windows, please see \ref winbin and \ref netCDF-CMake.
\section sec_get_source Getting the latest netCDF-C Source Code
Starting with netCDF-C version 4.3.1, the netCDF-C source code is hosted at the

View File

@ -3,13 +3,15 @@ This header file holds the documentation for the main page.
\mainpage
\tableofcontents
\section NetCDF
NetCDF is a set of software libraries and self-describing,
machine-independent data formats that support the creation, access,
and sharing of array-oriented scientific data. The NetCDF homepage may be found at <a href="http://www.unidata.ucar.edu/netcdf">http://www.unidata.ucar.edu/netcdf</a>. The NetCDF source-code is hosted at <a href="http://github.com">GitHub</a>, and may be found directly at <a href="http://github.com/Unidata/netcdf-c">http://github.com/Unidata/netcdf-c</a>.
\subsection credits Credits
\section credits Credits
<p>NetCDF was developed and is maintained
at <a href="http://www.unidata.ucar.edu">Unidata</a>, part of the
@ -20,17 +22,20 @@ Foundation.
\authors Russ Rew, Glenn Davis, Steve Emmerson, Harvey Davies, Ed
Hartnett, Dennis Heimbigner and Ward Fisher
\subsection learn-more Learn more about NetCDF
\section this_release Learn more about the current NetCDF-C Release
- \ref release_notes
- \ref getting
- \ref building
\section learn-more Learn more about using NetCDF-C
- \ref tutorial
- \ref user_guide
- <a class="el" href="http://www.unidata.ucar.edu/software/netcdf/docs/index-413.html">Other Documentation</a>
- <a class="el" href="http://www.unidata.ucar.edu/software/netcdf/docs/index-413.html">Older Documentation, plus details regarding netcdf-fortran and netcdf-cxx.</a>
\subsection netcdf-cmake-windows NetCDF CMake and Windows support:
\section netcdf-cmake-windows NetCDF CMake and Windows support:
- \ref netCDF-CMake
- \ref winbin

View File

@ -1,7 +1,9 @@
/** \file
Documentation of error handling.
\page Programming Notes
\page programming_notes Programming Notes
\tableofcontents
\section error_handling Error Handling
@ -26,7 +28,7 @@ available, you may get an error from a layer below the netCDF library,
but the resulting write error will still be reflected in the returned
status value.
\page ignored_if_null Ignored if NULL
\section ignored_if_null Ignored if NULL
Many of the argurments of netCDF functions are pointers. For example,
the nc_inq() functions takes four pointers:
@ -51,12 +53,12 @@ if (nc_inq(ncid, &ndims, NULL, NULL, NULL))
User must allocate space for the result of an inq function before the
function is called.
\page specify_hyperslab Specify a Hyperslab
\section specify_hyperslab Specify a Hyperslab
The NetCDF allows specification of hyperslabs to be read or written
with vectors which specify the start, count, stride, and mapping.
\section start_vector A Vector Specifying Start Index for Each Dimension
\subsection start_vector A Vector Specifying Start Index for Each Dimension
A vector of size_t integers specifying the index in the
variable where the first of the data values will be read.
@ -68,7 +70,7 @@ The length of start vector must be the same as the number of
dimensions of the specified variable. The elements of start
correspond, in order, to the variable's dimensions.
\section count_vector A Vector Specifying Count for Each Dimension
\subsection count_vector A Vector Specifying Count for Each Dimension
A vector of size_t integers specifying the edge lengths
along each dimension of the block of data values to be read.
@ -82,7 +84,7 @@ variable's dimensions.
Setting any element of the count array to zero causes the function to
exit without error, and without doing anything.
\section stride_vector A Vector Specifying Stride for Each Dimension
\subsection stride_vector A Vector Specifying Stride for Each Dimension
A vector of size_t integers specifying the interval between selected
indices.
@ -96,7 +98,7 @@ variable's dimensions.
A NULL stride argument is treated as (1, 1, ... , 1).
\section map_vector A Vector Specifying Mapping for Each Dimension
\subsection map_vector A Vector Specifying Mapping for Each Dimension
A vector of integers that specifies the mapping between the dimensions
of a netCDF variable and the in-memory structure of the internal data
@ -115,7 +117,7 @@ type-independent units of elements.
memory locations is 1 and not the element's byte-length as in netCDF
2.
\page ncid NetCDF ID
\section ncid NetCDF ID
Most netCDF function require the netCDF ID as a first parameter.

View File

@ -12,7 +12,7 @@ This page contains refrences to various other NetCDF background and tutorial pag
- \ref netcdf_documentation
\subsection sub_sec_netcdf_data_model NetCDF Data Model:
- \ref netcdf_data_model \todo Update the name of the netcdf data model page.
- \ref netcdf_data_model
- \ref classic_model
- \ref enhanced_model
- \ref unlimited_dims
@ -168,7 +168,9 @@ The latest version of all netCDF documentation can always be found at
the <a href="http://www.unidata.ucar.edu/netcdf/docs">netCDF
documentation page</a>.
\page netcdf_data_model
\page netcdf_data_model The NetCDF Data Model
\tableofcontents
The netCDF data model is the way that we think about data. The data
model of dimensions, variables, and attributes, which define the \ref
@ -183,7 +185,8 @@ created with the \ref classic_model.
<p>\image html nc4-model.png "The NetCDF Enhanced Data Model"
\page classic_model The Classic Model
\section classic_model The Classic Model
The classic netCDF data model consists of variables, dimensions, and
attributes. This way of thinking about data was introduced with the
@ -224,44 +227,7 @@ small.
</table>
\section met_example Meteorological Example
NetCDF can be used to store many kinds of data, but it was originally
developed for the Earth science community.
NetCDF views the world of scientific data in the same way that an
atmospheric scientist might: as sets of related arrays. There are
various physical quantities (such as pressure and temperature) located
at points at a particular latitude, longitude, vertical level, and
time.
A scientist might also like to store supporting information, such as
the units, or some information about how the data were produced.
The axis information (latitude, longitude, level, and time) would be
stored as netCDF dimensions. Dimensions have a length and a name.
The physical quantities (pressure, temperature) would be stored as
netCDF variables. Variables are N-dimensional arrays of data, with a
name and an associated set of netCDF dimensions.
It is also customary to add one variable for each dimension, to hold
the values along that axis. These variables are called “coordinate
variables.” The latitude coordinate variable would be a
one-dimensional variable (with latitude as its dimension), and it
would hold the latitude values at each point along the axis.
The additional bits of metadata would be stored as netCDF attributes.
Attributes are always single values or one-dimensional arrays. (This
works out well for a string, which is a one-dimensional array of ASCII
characters.)
The pres_temp_4D_wr.c/pres_temp_4D_rd.c examples show
how to write and read a file containing some four-dimensional pressure
and temperature data, including all the metadata needed.
\page enhanced_model The Enhanced Data Model
\section enhanced_model The Enhanced Data Model
With netCDF-4, the netCDF data model has been extended, in a backwards
compatible way.
@ -312,6 +278,43 @@ model. That is, these files are in HDF5, but will not support multiple
unlimited dimensions, user-defined types, groups, etc. They act just
like a classic netCDF file.
\section met_example Meteorological Example
NetCDF can be used to store many kinds of data, but it was originally
developed for the Earth science community.
NetCDF views the world of scientific data in the same way that an
atmospheric scientist might: as sets of related arrays. There are
various physical quantities (such as pressure and temperature) located
at points at a particular latitude, longitude, vertical level, and
time.
A scientist might also like to store supporting information, such as
the units, or some information about how the data were produced.
The axis information (latitude, longitude, level, and time) would be
stored as netCDF dimensions. Dimensions have a length and a name.
The physical quantities (pressure, temperature) would be stored as
netCDF variables. Variables are N-dimensional arrays of data, with a
name and an associated set of netCDF dimensions.
It is also customary to add one variable for each dimension, to hold
the values along that axis. These variables are called “coordinate
variables.” The latitude coordinate variable would be a
one-dimensional variable (with latitude as its dimension), and it
would hold the latitude values at each point along the axis.
The additional bits of metadata would be stored as netCDF attributes.
Attributes are always single values or one-dimensional arrays. (This
works out well for a string, which is a one-dimensional array of ASCII
characters.)
The pres_temp_4D_wr.c/pres_temp_4D_rd.c examples show
how to write and read a file containing some four-dimensional pressure
and temperature data, including all the metadata needed.
\page fill_values Fill Values
Sometimes there are missing values in the data, and some value is
@ -344,6 +347,11 @@ information about the CF conventions, see http://cf-pcmdi.llnl.gov.
\page error_handling Error Handling
See Also:
- \ref nc-error-codes
- Function \ref nc_strerror
Each netCDF function in the C, Fortran 77, and Fortran 90 APIs returns
0 on success, in the tradition of C.
@ -401,6 +409,8 @@ variable's list of dimension IDs.
\page examples1 NetCDF Example Programs
\tableofcontents
The netCDF example programs show how to use netCDF.
In the netCDF distribution, the “examples” directory contains examples
@ -437,7 +447,7 @@ The corresponding examples in each language create identical netCDF
data files. For example, the C program sfc_pres_temp_wr.c produces the
same data file as the Fortran 77 program sfc_pres_temp_wr.f.
\page example_simple_xy The simple_xy Example
\section example_simple_xy The simple_xy Example
This example is an unrealistically simple netCDF file, to demonstrate
the minimum operation of the netCDF APIs. Users should seek to make
@ -474,7 +484,7 @@ ncdump and ncgen see NetCDF Utilities.
}
\endcode
\page example_sfc_pres_temp The sfc_pres_temp Example
\section example_sfc_pres_temp The sfc_pres_temp Example
This example has been constructed for the meteorological mind.
@ -539,7 +549,7 @@ The CDL version of the data file, generated by ncdump, is shown below
}
\endcode
\page example_pres_temp_4D The pres_temp_4D Example
\section example_pres_temp_4D The pres_temp_4D Example
This example expands on the previous example by making our
two-dimensional data into four-dimensional data, adding a vertical
@ -630,7 +640,7 @@ the utility ncdump (see \ref netcdf_utilities).
}
\endcode
\page example_simple_nc4 The simple_nc4 Example
\section example_simple_nc4 The simple_nc4 Example
This example, like the simple_xy netCDF-3 example above, is an overly simplified example which demonstrates how to use groups in a netCDF-4 file.
@ -642,7 +652,7 @@ The example program simple_nc4_wr.c creates the example data file simple_nc4.nc.
- simple_nc4_wr.c
- simple_nc4_rd.c
\page example_simple_xy_nc4 The simple_xy_nc4 Example
\section example_simple_xy_nc4 The simple_xy_nc4 Example
This example, like the simple_xy netCDF-3 example above, is an overly simplified example. It is based on the simple_xy example, but used data chunking, compression, and the fletcher32 filter.

View File

@ -3,7 +3,9 @@ Installing and Using netCDF-C Libraries in Windows {#winbin}
\brief NetCDF-C Libraries in a Windows Environment may be used under multiple sets of circumstances.
[TOC]
\tableofcontents
There are several development environments available for programmers who develop on Windows.