You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/tutorial/compare_netcdf4.rst
+19-19Lines changed: 19 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -4,54 +4,54 @@ Comparing with netCDF4-python API
4
4
=================================
5
5
.. warning::
6
6
7
-
Under construction.
7
+
Under construction.
8
8
9
-
PnetCDF-python inherits many features from netCDF4-python, making the transition from the former to the latter a seamless process
10
-
for most netCDF4-python applications. However, there are some exceptions to this as listed below. On the other hand, PnetCDF-python supports
11
-
some new APIs not available in netCDF4-python.
9
+
PnetCDF-python inherits many features from netCDF4-python, making the transition from the former to the latter a seamless process
10
+
for most netCDF4-python applications. However, there are some exceptions to this as listed below. On the other hand, PnetCDF-python supports
11
+
some new APIs not available in netCDF4-python.
12
12
13
13
Supported File Formats
14
14
--------------------------
15
15
16
16
NetCDF4-python supports NETCDF4 formats(HDF5) in addition to classic netCDF formats(NETCDF3_CLASSIC, NETCDF3_64BIT_OFFSET, NETCDF3_64BIT_DATA). However,
17
-
PnetCDF-python library only supports netCDF classic file formats, which means all netCDF4-dependent features are **not** supported, including user-defined types,
17
+
PnetCDF-python library only supports netCDF classic file formats, which means all netCDF4-dependent features are **not** supported, including user-defined types,
18
18
compression, hirarchical structure, etc.
19
19
20
20
Difference in Programming Model
21
21
--------------------------------
22
22
23
23
Data/Define Mode
24
-
NetCDF4-python library automatically switches between data and define mode for the user by calling ``redef`` and ``enddef`` internally within the define-mode
25
-
operation functions, which is **not** implemented in Pnetcdf-python. A manual call to :meth:`File.redef` is compulsory to activate define mode before swtiching
26
-
to define mode opearations, following the C library convention. Similarly, :meth:`File.enddef` is required before switching to data mode operations. This design is based on considerations of
24
+
NetCDF4-python library automatically switches between data and define mode for the user by calling ``redef`` and ``enddef`` internally within the define-mode
25
+
operation functions, which is **not** implemented in Pnetcdf-python. A manual call to :meth:`File.redef` is compulsory to activate define mode before swtiching
26
+
to define mode opearations, following the C library convention. Similarly, :meth:`File.enddef` is required before switching to data mode operations. This design is based on considerations of
27
27
the following aspects:
28
28
29
-
- Minimize overheads during consecutive define operations: Automatically wrapping all define functions with :meth:`File.redef` and :meth:`File.enddef` could introduce
29
+
- Minimize overheads during consecutive define operations: Automatically wrapping all define functions with :meth:`File.redef` and :meth:`File.enddef` could introduce
30
30
significant overhead between consecutive define operations. This approach results in unnecessary data/define mode switches, impacting performance.
31
-
- Avoid potential hanging when performing independent I/O: if :meth:`File.enddef` is automatically embeded in all data mode operation functions, the program will hang when
31
+
- Avoid potential hanging when performing independent I/O: if :meth:`File.enddef` is automatically embeded in all data mode operation functions, the program will hang when
32
32
partial processes are performing independent I/O(while others don't) because :meth:`File.enddef` is a collective call which requires all processes to participate.
33
33
34
34
Independent/Collective I/O Mode
35
35
There are two types of parallel I/O, independent I/O and collective I/O supported both in PnetCDF-python and netCDF4-python. NetCDF4-python toggles back and forth
36
-
between the two types at variable-level. However, PnetCDF-python manages this at file-level through :meth:`File.begin_indep` and :meth:`File.end_indep`. The default I/O mode
36
+
between the two types at variable-level. However, PnetCDF-python manages this at file-level through :meth:`File.begin_indep` and :meth:`File.end_indep`. The default I/O mode
37
37
is collective I/O in PnetCDF-python.
38
-
38
+
39
39
40
40
Alternative Reads and Writes Methods
41
41
------------------------------------------
42
42
43
43
For reading from and writing to netCDF4 variables, PnetCDF-python provides alternative methods in addition to numpy-like indexer syntax. The :meth:`Variable.get_var` and
44
-
:meth:`Variable.put_var` methods are faithfull python-implementations of the put/get_var families from the original PnetCDF-C library. By overloading the input arguments,
45
-
these methods can fulfill specific I/O needs to the target variable depending on the requirements of the applications: the entire variable, a single data value, an
46
-
(subsampled) array of values, a mapped array or a list of subarrays. These methods require an array argument as read/write buffer, which is a prerequisite non-blocking
44
+
:meth:`Variable.put_var` methods are faithfull python-implementations of the put/get_var families from the original PnetCDF-C library. By overloading the input arguments,
45
+
these methods can fulfill specific I/O needs to the target variable depending on the requirements of the applications: the entire variable, a single data value, an
46
+
(subsampled) array of values, a mapped array or a list of subarrays. These methods require an array argument as read/write buffer, which is a prerequisite non-blocking
47
47
I/O as introduced below.
48
48
49
49
For the example program, see ``examples/get_vara.py``.
50
50
51
51
Non-blocking I/O
52
52
------------------------------------------
53
-
In additional to blocking read/writes, PnetCDF also offers the nonblocking API that enables users to initiate multiple requests without actually doing I/O and subsequently
54
-
flush them altogether. This approach is designed to enhance performance by merging small I/O requests and maximizing I/O efficiency. This features is faithfully
55
-
preserved in PnetCDF-python API.
53
+
In additional to blocking read/writes, PnetCDF also offers the nonblocking API that enables users to initiate multiple requests without actually doing I/O and subsequently
54
+
flush them altogether. This approach is designed to enhance performance by merging small I/O requests and maximizing I/O efficiency. This features is faithfully
55
+
preserved in PnetCDF-python API.
56
56
57
-
For the example program, see ``examples/non_blocking_write.py``.
57
+
For the example program, see ``examples/nonblocking/nonblocking_write.py``.
0 commit comments