Skip to content

Commit 0a0e664

Browse files
authored
Merge pull request #3276 from edhartnett/ejh_more_docs_0219
documentation fixes for liblib and examples
2 parents ba366c1 + b912c9c commit 0a0e664

21 files changed

+196
-179
lines changed

examples/C/file.c

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
1-
/*! \file
2-
3-
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
4-
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
5-
2015, 2016, 2017, 2018
6-
University Corporation for Atmospheric Research/Unidata.
7-
8-
See \ref copyright file for more info.
9-
10-
*/
11-
12-
13-
/* This example program is part of Unidata's netCDF library for
14-
scientific data access.
15-
16-
This program demonstrates various ways to create a netCDF file,
17-
open an existing file, and close a file.
18-
19-
Ed Hartnett, 5/29/4
20-
$Id: file.c,v 1.1 2004/07/26 14:04:42 ed Exp $
21-
*/
1+
/* Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
2+
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
3+
2015, 2016, 2017, 2018 University Corporation for Atmospheric
4+
Research/Unidata. See COPYRIGHT file for conditions of use. */
5+
/**
6+
* @file
7+
* Demonstrate the full create, write, reopen, and read cycle.
8+
*
9+
* This example program is part of Unidata's netCDF library for
10+
* scientific data access. It creates a netCDF file, writes a
11+
* variable, closes the file, then reopens it and reads the data
12+
* back for verification.
13+
*
14+
* @author Edward Hartnett, 5/29/4
15+
*/
2216

2317
#include <netcdf.h>
2418
#include <stdio.h>

examples/C/filter_example.c

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
1-
/*
2-
Copyright 2018, UCAR/Unidata
3-
See COPYRIGHT file for copying and redistribution conditions.
4-
*/
5-
/*
6-
This file is the same as nc_test4/test_filter.c
7-
*/
8-
9-
/*! \file
10-
Example program for write then read of a variable using bzip2 compression.
11-
12-
@ingroup tutorial
13-
14-
This is an example which
15-
creates a file with a variable that is compressed using bzip2.
16-
Then it reads that file and verifies that it returned the correct
17-
uncompressed data.
18-
19-
The meta-data (.cdl) for the created file is as follows:
1+
/* Copyright 2018, UCAR/Unidata.
2+
See COPYRIGHT file for conditions of use. */
3+
/**
4+
* @file
5+
* @ingroup tutorial
6+
* Example program for writing and reading a variable using bzip2
7+
* compression.
8+
*
9+
* This example creates a file with a variable that is compressed
10+
* using bzip2, then reads it back and verifies that the
11+
* uncompressed data is correct.
12+
*
13+
* The meta-data (.cdl) for the created file is as follows:
14+
* @author Dennis Heimbigner
15+
*/
16+
/**
2017
\code
2118
netcdf bzip2 {
2219
dimensions:
@@ -121,7 +118,7 @@ verifychunks(void)
121118
size_t chunksizes[NDIMS];
122119
memset(chunksizes,0,sizeof(chunksizes));
123120
CHECK(nc_inq_var_chunking(ncid, varid, &store, chunksizes));
124-
/* Storate must be chunked, not contiguous */
121+
/* Storage must be chunked, not contiguous */
125122
if(store != NC_CHUNKED) {
126123
fprintf(stderr,"bad chunk store\n");
127124
return NC_ESTORAGE;

examples/C/format.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* This example shows how to create and deal with files of different
1212
* netcdf formats (i.e. classic vs. 64-bit-offset).
1313
*
14-
* @author Ed Hartnett, 7/13/4
14+
* @author Edward Hartnett, 7/13/4
1515
*/
1616

1717
#include <config.h>

examples/C/large_files.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
/*! \file
2-
3-
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
4-
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
5-
2015, 2016, 2017, 2018
6-
University Corporation for Atmospheric Research/Unidata.
7-
8-
See \ref copyright file for more info.
9-
10-
*/
1+
/* Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
2+
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
3+
2015, 2016, 2017, 2018 University Corporation for Atmospheric
4+
Research/Unidata. See COPYRIGHT file for conditions of use. */
5+
/**
6+
* @file
7+
* Example of writing and reading a large netCDF file using
8+
* 64-bit offset format.
9+
*
10+
* @author Russ Rew
11+
*/
1112

1213
#include <stdio.h>
1314
#include <stdlib.h>

examples/C/met4D.c

Lines changed: 25 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,28 @@
1-
/*! \file
2-
3-
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
4-
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
5-
2015, 2016, 2017, 2018
6-
University Corporation for Atmospheric Research/Unidata.
7-
8-
See \ref copyright file for more info.
9-
10-
*/
11-
12-
/* This example program is part of Unidata's netCDF library for
13-
scientific data access.
14-
15-
This program demonstrates various ways to create netCDF dimensions
16-
and variables.
17-
18-
We will create a dataset with 4 variables. We'll store a 3D surface
19-
temperature (lat x lon x timestep), 4D pressure (lat x lon x height x
20-
timestep), a 2D initial temperature (lat x lon) and a 3D initial
21-
pressure (lat x lon x height). All variables will be stored as
22-
single precision floating point.
23-
24-
All variables are intended to share dimensions. For example, the
25-
latitude axis is the same for all of them.
26-
27-
We'll also include the coordinate axis data for three of the four
28-
dimensions, that is, labels for the lat, lon, and height axes.
29-
30-
Finally, we'll use some attributes to store some metadata about the
31-
variables, the units. Also we'll use a file-level, or global,
32-
attribute to record some information about the dataset as a whole.
33-
34-
Ed Hartnett, 6/3/4
35-
$Id: met4D.c,v 1.1 2004/07/26 14:04:42 ed Exp $
36-
*/
1+
/* Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
2+
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
3+
2015, 2016, 2017, 2018 University Corporation for Atmospheric
4+
Research/Unidata. See COPYRIGHT file for conditions of use. */
5+
/**
6+
* @file
7+
* Demonstrate creating netCDF dimensions and variables for 4D
8+
* meteorological data.
9+
*
10+
* This example program is part of Unidata's netCDF library for
11+
* scientific data access. It demonstrates various ways to create
12+
* netCDF dimensions and variables.
13+
*
14+
* We create a dataset with 4 variables: a 3D surface temperature
15+
* (lat x lon x timestep), 4D pressure (lat x lon x height x
16+
* timestep), a 2D initial temperature (lat x lon), and a 3D initial
17+
* pressure (lat x lon x height). All variables are stored as single
18+
* precision floating point and share dimensions.
19+
*
20+
* We also include coordinate axis data for three of the four
21+
* dimensions (lat, lon, and height), and use attributes to store
22+
* units metadata and a global history attribute.
23+
*
24+
* @author Edward Hartnett, 6/3/4
25+
*/
3726

3827
#include <netcdf.h>
3928
#include <stdio.h>

examples/C/parallel_vara.c

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,50 +4,46 @@
44
* See COPYRIGHT notice in top-level directory.
55
*
66
*********************************************************************/
7-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
8-
* This example shows how to use nc_put_vara_int() to write a 2D 4-byte integer
9-
* array in parallel and read it back using the same array partitioning pattern.
10-
* It first defines a netCDF variable of size global_nx * global_ny where
11-
* global_ny == NY and
12-
* global_nx == (NX * number of MPI processes).
13-
* The data partitioning pattern is a column-wise partitioning across all
14-
* processes. Each process writes a subarray of size ny * nx.
7+
/**
8+
* @file
9+
* Example of parallel I/O using nc_put_vara_int() and nc_get_vara_int().
1510
*
16-
* To compile:
17-
* mpicc -O2 parallel_vara.c -o parallel_vara -lnetcdf -lpnetcdf
11+
* This example shows how to use nc_put_vara_int() to write a 2D
12+
* 4-byte integer array in parallel and read it back using the same
13+
* array partitioning pattern. It first defines a netCDF variable of
14+
* size global_nx * global_ny where global_ny == NY and global_nx ==
15+
* (NX * number of MPI processes). The data partitioning pattern is a
16+
* column-wise partitioning across all processes. Each process writes a
17+
* subarray of size ny * nx.
18+
*
19+
* To compile:
20+
* mpicc -O2 parallel_vara.c -o parallel_vara -lnetcdf -lpnetcdf
1821
*
1922
* Example commands for MPI run and outputs from running ncdump on the
2023
* NC file produced by this example program:
2124
*
22-
* % mpiexec -n 4 ./parallel_vara /pvfs2/wkliao/testfile.nc
25+
* % mpiexec -n 4 ./parallel_vara /pvfs2/wkliao/testfile.nc
26+
*
27+
* % ncdump /pvfs2/wkliao/testfile.nc
28+
* netcdf testfile {
29+
* dimensions:
30+
* y = 10 ;
31+
* x = 16 ;
32+
* variables:
33+
* int var(y, x) ;
34+
* var:str_att_name = "example attribute of type text." ;
35+
* var:float_att_name = 0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f ;
36+
* // global attributes:
37+
* :history = "Wed Apr 30 11:18:58 2014" ;
38+
* data:
2339
*
24-
* % ncdump /pvfs2/wkliao/testfile.nc
25-
* netcdf testfile {
26-
* dimensions:
27-
* y = 10 ;
28-
* x = 16 ;
29-
* variables:
30-
* int var(y, x) ;
31-
* var:str_att_name = "example attribute of type text." ;
32-
* var:float_att_name = 0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f ;
33-
* // global attributes:
34-
* :history = "Wed Apr 30 11:18:58 2014\n",
35-
* "" ;
36-
* data:
40+
* var =
41+
* 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,
42+
* ...
43+
* }
3744
*
38-
* var =
39-
* 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,
40-
* 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,
41-
* 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,
42-
* 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,
43-
* 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,
44-
* 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,
45-
* 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,
46-
* 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,
47-
* 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,
48-
* 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3 ;
49-
* }
50-
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
45+
* @author Edward Hartnett
46+
*/
5147

5248
#include <stdio.h>
5349
#include <stdlib.h>

examples/C/pres_temp_4D_rd.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Research/Unidata. See COPYRIGHT file for conditions of use. */
1313
* This is part of the netCDF package. Full documentation of the netCDF can be found at
1414
* https://docs.unidata.ucar.edu/netcdf-c.
1515
*
16-
* @author Ed Hartnett
16+
* @author Edward Hartnett
1717
*/
1818

1919
#include <stdio.h>
@@ -49,7 +49,6 @@ Research/Unidata. See COPYRIGHT file for conditions of use. */
4949
#define START_LON -125.0
5050

5151
/* For the units attributes. */
52-
#define UNITS "units"
5352
#define PRES_UNITS "hPa"
5453
#define TEMP_UNITS "celsius"
5554
#define LAT_UNITS "degrees_north"

examples/C/pres_temp_4D_wr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
/**
44
* @file
55
* @defgroup tutorial Tutorial Examples
6+
*
67
* A more complex example of writing a netCDF file.
78
*
89
* This is an example program which writes some 4D pressure and
910
* temperatures. It is intended to illustrate the use of the netCDF C
1011
* API. The companion program pres_temp_4D_rd.c shows how to read the
1112
* netCDF data file created by this program.
1213
*
13-
* @author Ed Hartnett
14+
* @author Edward Hartnett
1415
*/
1516

1617
#include <stdio.h>
@@ -46,7 +47,6 @@
4647
#define START_LON -125.0f
4748

4849
/* For the units attributes. */
49-
#define UNITS "units"
5050
#define PRES_UNITS "hPa"
5151
#define TEMP_UNITS "celsius"
5252
#define LAT_UNITS "degrees_north"

examples/C/quick_large_files.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* This program (quickly, but not thoroughly) tests the large file
1313
* features.
1414
*
15-
* @author Ed Hartnett, 8/11/4
15+
* @author Edward Hartnett, 8/11/4
1616
*/
1717

1818
#include <netcdf.h>

examples/C/quick_small_files.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ info. */
1717
* and the offset to the beginning of this variable must be less than
1818
* about 2 Gbytes."
1919
*
20-
* @author Ed Hartnett
20+
* @author Edward Hartnett
2121
*/
2222

2323
#include <netcdf.h>

0 commit comments

Comments
 (0)