Skip to content

Commit 6e3d511

Browse files
authored
Merge pull request #56 from wkliao/doc_v4
docs: polishing
2 parents 7f3ef2e + 1020ff1 commit 6e3d511

19 files changed

+573
-317
lines changed

docs/source/api/attribute_api.rst

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
11
===========
2-
Attribute
2+
Attributes
33
===========
44

5-
In the library, netCDF attributes can be created, accessed, and manipulated
6-
using python dictionary-like syntax. A Pythonic interface for metadata operations
7-
is provided both in the ``File`` class (for global attributes) and the
8-
``Variable`` class (for variable attributes).
5+
In `object-oriented programming <https://en.wikipedia.org/wiki/Object-oriented_programming>`_,
6+
a class contains fields (state variables containing data) and methods
7+
(subroutines or procedures defining the object's behavior in code). ``Fields``
8+
may also be known as members, attributes, or properties. To avoid confusion
9+
with NetCDF's terminology of ``attribute``, this document uses `field` to refer
10+
to a class's state variable.
11+
12+
NetCDF attributes are small, supplementary metadata that annotates variables or
13+
files. NetCDF attribute is not a Python class by itself. Instead, it is a
14+
field of python dictionary in class :class:`pnetcdf.File` and class
15+
:class:`pnetcdf.Variable`. Their data types can be any allowed by the classic
16+
NetCDF file formats. The most common data type is `text` for annotation
17+
purpose. NetCDF attributes can be created, accessed, and manipulated using
18+
python dictionary-like syntax. An attribute can be associated to a file,
19+
referred to as ``golbal attribute``, as well as to individual variables,
20+
referred to as ``variable's attribute``. Pythonic interfaces for accessing
21+
attributes are is provided both in class :class:`pnetcdf.File` (for global
22+
attributes) and class :class:`pnetcdf.Variable` (for variable attributes).
23+
Example programs are `examples/global_attribute.py` and `examples/put_var.py`.
24+

docs/source/api/dimension_api.rst

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
11
==============
2-
Dimension
2+
Dimensions
33
==============
44

5-
Dimension defines the shape and structure of variables and stores coordinate
6-
data for multidimensional arrays. The ``Dimension`` object, which is also a key
7-
component of ``File`` class, provides an interface to access dimensions.
5+
Class ``Dimension`` is used to define the shape of NetCDF variables. In NetCDF,
6+
a variable, an instance of :class:`pnetcdf.Variable`, is a multi-dimensional
7+
array. Methods in :class:`pnetcdf.Dimension` provide an interface to access
8+
dimensions objects stored in the file.
89

910
.. autoclass:: pnetcdf::Dimension
1011
:members: getfile, isunlimited
1112
:exclude-members: name, size
1213

13-
Read-only Python Attributes of Dimension Class
14-
The following class members are read-only and should not be modified by the
14+
Read-only python fields of class :class:`pnetcdf.Dimension`
15+
The following class fields are read-only and should not be modified by the
1516
user.
1617

1718
.. attribute:: name
1819

19-
String name of Dimension instance. This class member is read-only and
20+
String name of Dimension instance. This class field is read-only and
2021
should not be modified by the user. To rename a dimension, use
2122
:meth:`File.rename_dim` method.
2223

2324
**Type:** `str`
2425

2526
.. attribute:: size
2627

27-
The current size of Dimension (calls ``len`` on Dimension instance).
28+
The current size of Dimension (its value can be obtained by calling
29+
python function ``len()`` on the Dimension instance).
2830

2931
**Type:** `int`
3032

docs/source/api/file_api.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
================
2-
File
2+
Files
33
================
44

5-
``pnetcdf.File`` is a high-level object representing an netCDF file,
6-
which provides a Pythonic interface to create, read and write within
7-
an netCDF file. A File object serves as the root container for dimensions,
8-
variables, and attributes. Together they describe the meaning of data and
9-
relations among data fields stored in a netCDF file.
5+
An instance of class ``pnetcdf.File`` is a high-level object representing a
6+
netCDF file. The class methods provide a set of Pythonic interfaces to create,
7+
read and write a netCDF file. A ``File`` instance serves as the root container
8+
for dimensions, variables, and attributes. Together they describe the meaning
9+
of data and relations among data objects stored in a netCDF file.
1010

1111
.. autoclass:: pnetcdf::File
1212
:members: __init__, close, filepath, redef, enddef, begin_indep, end_indep,
@@ -17,21 +17,21 @@ relations among data fields stored in a netCDF file.
1717
inq_header_size, inq_put_size, inq_header_extent, inq_nreqs
1818
:exclude-members: dimensions, variables, file_format, indep_mode, path
1919

20-
Read-only Python Attributes of File Class
21-
The following class members are read-only and should not be modified by the
20+
Read-only python fields of class :class:`pnetcdf.File`
21+
The following class fields are read-only and should not be modified by the
2222
user.
2323

2424
.. attribute:: dimensions
2525

2626
The dimensions dictionary maps the names of dimensions defined in this
27-
file as an instance of the ``pnetcdf.Dimension`` class.
27+
file as an instance of the :class:`pnetcdf.Dimension`.
2828

2929
**Type:** `dict`
3030

3131
.. attribute:: variables
3232

3333
The variables dictionary maps the names of variables defined in this file
34-
as an instance of the ``pnetcdf.Variable`` class.
34+
as an instance of the :class:`pnetcdf.Variable`.
3535

3636
**Type:** `dict`
3737

docs/source/api/function_api.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
================
2-
Utility Functions
2+
Other pnetcdf class methods
33
================
44

5+
PnetCDF class methods listed below are not associated with particular
6+
instances of ``File`` or ``Variable``.
7+
58
.. autofunction:: pnetcdf::libver
69
.. autofunction:: pnetcdf::strerror
710
.. autofunction:: pnetcdf::strerrno

docs/source/api/variable_api.rst

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
=========
2-
Variable
2+
Variables
33
=========
44

5-
Variable is a core component of a netCDF file representing an array of data
5+
``Variable`` is a core component of a netCDF file representing an array of data
66
values organized along one or more dimensions, with associated metadata in the
7-
form of attributes. The ``Variable`` object in the library provides operations
8-
to read and write the data and metadata of a variable within a netCDF file.
9-
Particularly, data mode operations have a flexible interface, where reads and
10-
writes can be done through either explicit function-call style methods or
11-
indexer-style (numpy-like) syntax.
7+
form of attributes. An instance of class :class:`pnetcdf.Variable` represents a
8+
NetCDF variable stored in the file. The class methods provide I/O operations to
9+
read and write the data and metadata of a NetCDF variable.
10+
11+
Reading and writing a subarray of a variable can be done through either
12+
explicit function-call style methods or Python indexer-style (numpy-like)
13+
syntax.
1214

1315
.. autoclass:: pnetcdf::Variable
1416
:members: ncattrs, put_att, get_att, del_att, rename_att, get_dims,
@@ -18,8 +20,8 @@ indexer-style (numpy-like) syntax.
1820
chartostring
1921

2022

21-
Read-only Python Attributes of Variable Class
22-
The following class members are read-only and should not be modified
23+
Read-only python fields of class :class:`pnetcdf.Variable`
24+
The following class fields are read-only and should not be modified
2325
directly by the user.
2426

2527
.. attribute:: name

docs/copyright.rst renamed to docs/source/copyright.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
Copyright Statement
33
================
44

5-
::
6-
7-
Copyright (c) 2024 Northwestern University and Argonne National
8-
Laboratory All rights reserved.
5+
Copyright (c) 2024 Northwestern University and Argonne National Laboratory
6+
All rights reserved.
97

108
Portions of this software were developed by the Unidata Program at the
119
University Corporation for Atmospheric Research.

docs/source/index.rst

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@
33
You can adapt this file completely to your liking, but it should at least
44
contain the root `toctree` directive.
55
6-
PnetCDF-Python Documentation
6+
PnetCDF-Python User Guide
77
============================
88

99
**Release:** |release|
1010

11-
.. toctree::
12-
:maxdepth: 2
13-
:caption: Introduction
14-
15-
introduction/overview
11+
PnetCDF-python is a Python interface to PnetCDF, a high-performance parallel
12+
I/O library for accessing netCDF files. This integration with Python allows
13+
for easy manipulation, analysis, and visualization of netCDF data using the
14+
rich ecosystem of Python's scientific computing libraries, making it a valuable
15+
tool for python-based applications that require high-performance access to
16+
netCDF files.
1617

1718
.. toctree::
1819
:maxdepth: 2
@@ -32,16 +33,17 @@ PnetCDF-Python Documentation
3233

3334
.. toctree::
3435
:maxdepth: 3
35-
:caption: API Documentation
36+
:caption: API Reference
3637

3738
api/file_api
3839
api/dimension_api
3940
api/variable_api
41+
api/attribute_api
4042
api/function_api
4143

4244
.. toctree::
43-
:maxdepth: 2
44-
:caption: Copyright Statement
45+
:maxdepth: 1
46+
:caption: Copyright
4547

4648
copyright
4749

0 commit comments

Comments
 (0)