Skip to content

Commit 5a893cf

Browse files
committed
Remove argument index fro var1 APIs
Argument index is the argument start
1 parent 2d549ad commit 5a893cf

8 files changed

+298
-269
lines changed

src/pnetcdf/_Variable.pyx

Lines changed: 281 additions & 252 deletions
Large diffs are not rendered by default.

test/tst_file_fill.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ def setUp(self):
5656
f.enddef()
5757
v1 = f.variables['data1']
5858
v2 = f.variables['data2']
59-
v1.put_var_all(np.int32(rank), index = (rank, rank))
60-
v2.put_var_all(np.int32(rank), index = (rank, rank))
59+
v1.put_var_all(np.int32(rank), start = (rank, rank))
60+
v2.put_var_all(np.int32(rank), start = (rank, rank))
6161
f.close()
6262
assert validate_nc_file(os.environ.get('PNETCDF_DIR'), self.file_path) == 0 if os.environ.get('PNETCDF_DIR') is not None else True
6363

test/tst_var_bput_var1.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def setUp(self):
6262
v[:,::-1,:] = data
6363
# each process post 10 requests to write a single element
6464
req_ids = []
65-
index = (rank, rank, rank)
65+
start = (rank, rank, rank)
6666
value = np.int32(rank * 10 + 1)
6767
# estimate the memory buffer size of all requests and attach buffer for buffered put requests
6868
buffsize = num_reqs * 4
@@ -72,7 +72,7 @@ def setUp(self):
7272
for i in range(num_reqs):
7373
v = f.variables[f'data{i}']
7474
# post the request to write a single element
75-
req_id = v.bput_var(value, index = index)
75+
req_id = v.bput_var(value, start)
7676
# track the reqeust ID for each write reqeust
7777
req_ids.append(req_id)
7878

@@ -89,7 +89,7 @@ def setUp(self):
8989
for i in range(num_reqs, num_reqs * 2):
9090
v = f.variables[f'data{i}']
9191
# post the request to write a single element
92-
v.bput_var(value, index = index)
92+
v.bput_var(value, start)
9393

9494
# all processes commit all pending requests to the file at once using wait_all (collective i/o)
9595
f.wait_all(num = pnetcdf.NC_PUT_REQ_ALL)

test/tst_var_def_fill.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def setUp(self):
7272
# enter data mode and write partially values to variables
7373
f.enddef()
7474
for v in [v1,v2,v3,v4]:
75-
v.put_var_all(np.float32(rank + 1), index = (rank, rank))
75+
v.put_var_all(np.float32(rank + 1), (rank, rank))
7676
self.v1_nofill, self.v1_fillvalue = v1.inq_fill()
7777
self.v2_nofill, self.v2_fillvalue = v2.inq_fill()
7878
self.v3_nofill, self.v3_fillvalue = v3.inq_fill()

test/tst_var_get_var1.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,18 @@ def runTest(self):
6161
v1 = f.variables['data1u']
6262
# test collective i/o put var1
6363
# equivalent code to the following using indexer syntax: value = v1[rank][rank][rank]
64-
index = (rank, rank, rank)
64+
start = (rank, rank, rank)
6565
f.begin_indep()
6666
# all processes read the designated cell of the variable using independent i/o
6767
buff = np.empty((), v1.dtype)
68-
v1.get_var(buff, index = index)
68+
v1.get_var(buff, start)
6969
# compare returned value against reference value
7070
assert_equal(buff, datarev[rank][rank][rank])
7171
# test independent i/o put var1
7272
f.end_indep()
7373
# all processes read the designated cell of the variable using collective i/o
7474
buff = np.empty((), v1.dtype)
75-
v1.get_var_all(buff, index = index)
75+
v1.get_var_all(buff, start)
7676
# compare returned value against reference value
7777
assert_equal(buff, datarev[rank][rank][rank])
7878
f.close()

test/tst_var_get_varm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@ def runTest(self):
7878
f.end_indep()
7979
v1 = f.variables['data1']
8080
v1_data = np.empty((2,3), dtype = np.float32)
81-
v1.get_var_all(buff = v1_data, start = starts, count = counts, stride = strides, imap = imap)
81+
v1.get_var_all(data = v1_data, start = starts, count = counts, stride = strides, imap = imap)
8282
assert_array_equal(v1_data, dataref)
8383

8484
# Test reading from the variable in independent mode
8585
f.begin_indep()
8686
v1_data = np.empty((2,3), dtype = np.float32)
87-
v1.get_var(buff = v1_data, start = starts, count = counts, stride = strides, imap = imap)
87+
v1.get_var(data = v1_data, start = starts, count = counts, stride = strides, imap = imap)
8888
assert_array_equal(v1_data, dataref)
8989
f.close()
9090

test/tst_var_iget_var1.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ def setUp(self):
7070
# each process post 10 requests to read a single element
7171
req_ids = []
7272
v_datas.clear()
73-
index = (rank, rank, rank)
73+
start = (rank, rank, rank)
7474
for i in range(num_reqs):
7575
v = f.variables[f'data{i}']
7676
buff = np.empty(shape = (1,), dtype = v.datatype)
7777
# post the request to read one part of the variable
78-
req_id = v.iget_var(buff, index = index)
78+
req_id = v.iget_var(buff, start)
7979
# track the reqeust ID for each read reqeust
8080
req_ids.append(req_id)
8181
# store the reference of variable values
@@ -97,7 +97,7 @@ def setUp(self):
9797
v = f.variables[f'data{i}']
9898
buff = np.empty(shape = (1,), dtype = v.datatype)
9999
# post the request to read a single element of values
100-
v.iget_var(buff, index = index)
100+
v.iget_var(buff, start)
101101
# store the reference of variable values
102102
v_datas.append(buff)
103103

test/tst_var_iput_var1.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ def setUp(self):
6262
v[:,::-1,:] = data
6363
# each process post 10 requests to write a single element
6464
req_ids = []
65-
index = (rank, rank, rank)
65+
start = (rank, rank, rank)
6666
value = np.int32(rank * 10 + 1)
6767
for i in range(num_reqs):
6868
v = f.variables[f'data{i}']
6969
# post the request to write a single element
70-
req_id = v.iput_var(value, index = index)
70+
req_id = v.iput_var(value, start)
7171
# track the reqeust ID for each write reqeust
7272
req_ids.append(req_id)
7373
f.end_indep()
@@ -83,7 +83,7 @@ def setUp(self):
8383
for i in range(num_reqs, num_reqs * 2):
8484
v = f.variables[f'data{i}']
8585
# post the request to write a single element
86-
v.iput_var(value, index = index)
86+
v.iput_var(value, start)
8787

8888
# all processes commit all pending requests to the file at once using wait_all (collective i/o)
8989
f.wait_all(num = pnetcdf.NC_PUT_REQ_ALL)

0 commit comments

Comments
 (0)