-
Notifications
You must be signed in to change notification settings - Fork 4
/
Nd-arange.py
38 lines (29 loc) · 910 Bytes
/
Nd-arange.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# SPDX-FileCopyrightText: Steven Ward
# SPDX-License-Identifier: OSL-3.0
# pylint: disable=invalid-name
'''
Usage:
Nd-arange x_start x_stop x_step [y_start y_stop y_step [z_start z_stop z_step [...]]]
Nd-arange -90 90 1 -180 180
Nd-arange -90 90 1 -180 180 1 0
Nd-arange -90 90 0.25 -180 180 0.25
Nd-arange -90 90 0.25 -180 180 0.25 0
https://docs.scipy.org/doc/numpy/reference/generated/numpy.arange.html
'''
__author__ = 'Steven Ward'
__license__ = 'OSL-3.0'
import itertools
import sys
import more_itertools
import arange
import remove_exponent
l = []
for g in more_itertools.grouper(sys.argv[1:], 3):
(start, stop, step) = g
a = arange.arange(start, stop, step, endpoint=True)
a = map(remove_exponent.remove_exponent, a)
#l.append(map(str, a))
# pylint: disable=consider-using-f-string
l.append(map('{:f}'.format, a))
for x in itertools.product(*l):
print(' '.join(x))