Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
goesr
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ray Garcia
goesr
Commits
0bb9aeca
Commit
0bb9aeca
authored
8 years ago
by
Ray Garcia
Browse files
Options
Downloads
Patches
Plain Diff
X10 speedup from parameterized slicing with slice() objects
previously had been using double swapaxis with axis=0 slice
parent
896fa26d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
goesr/cmi_changer.py
+10
-6
10 additions, 6 deletions
goesr/cmi_changer.py
goesr/rockfall.py
+13
-8
13 additions, 8 deletions
goesr/rockfall.py
with
23 additions
and
14 deletions
goesr/cmi_changer.py
+
10
−
6
View file @
0bb9aeca
...
...
@@ -637,8 +637,8 @@ def main():
help
=
"
number of tiles in X dimension
"
)
parser
.
add_argument
(
'
-p
'
,
'
--pixels
'
,
type
=
int
,
default
=
2000
,
help
=
"
max number of pixels in any direction, for tile counts not specified
"
)
parser
.
add_argument
(
'
-P
'
,
'
--parallel
'
,
type
=
int
,
default
=
0
,
help
=
"
max number of processors to use, default all-available
"
)
parser
.
add_argument
(
'
-P
'
,
'
--parallel
'
,
type
=
int
,
default
=
1
,
help
=
"
max number of processors to use, default
1; 0 for
all-available
"
)
parser
.
add_argument
(
'
-R
'
,
'
--region
'
,
help
=
'
region tag to use in filename, e.g. ECONUS
'
)
parser
.
add_argument
(
'
-E
'
,
'
--environment
'
,
default
=
'
DT
'
,
help
=
'
environment and data type to use in filename, e.g. DT or OR
'
)
...
...
@@ -660,18 +660,22 @@ def main():
environment
=
args
.
environment
[
0
],
data_type
=
args
.
environment
[
1
],
region
=
args
.
region
,
debug
=
args
.
debug
)
if
args
.
parallel
==
0
:
if
args
.
parallel
==
1
or
len
(
args
.
inputs
)
<=
1
:
run_all
=
None
elif
args
.
parallel
==
0
:
multi
=
mp
.
Pool
()
run_all
=
multi
.
map
LOG
.
info
(
'
using {} cores
'
.
format
(
os
.
cpu_count
()))
elif
args
.
parallel
==
1
:
run_all
=
map
else
:
multi
=
mp
.
Pool
(
args
.
parallel
)
run_all
=
multi
.
map
LOG
.
info
(
'
using {} cores
'
.
format
(
args
.
parallel
))
run_all
(
cherrychanga
,
args
.
inputs
)
if
run_all
:
run_all
(
cherrychanga
,
args
.
inputs
)
else
:
for
inp
in
args
.
inputs
:
cherrychanga
(
inp
)
return
0
...
...
This diff is collapsed.
Click to expand it.
goesr/rockfall.py
+
13
−
8
View file @
0bb9aeca
...
...
@@ -199,18 +199,23 @@ def slice_yx(seq, n_tiles=(1,1), dimensions=('y', 'x'), path_format=None):
continue
# where y or x dimension is present, swap that axis to 0 and slice
v
=
V
[:]
# v = V # [:]
shape
=
V
.
shape
knife
=
[
slice
(
0
,
extent
)
for
extent
in
shape
]
if
ydo
is
not
None
:
v
=
np
.
swapaxes
(
v
,
0
,
ydo
)
if
ydo
!=
0
else
v
# there
v
=
v
[
iy
*
nh
:(
iy
+
1
)
*
nh
]
# slice the section we want
v
=
np
.
swapaxes
(
v
,
0
,
ydo
)
if
ydo
!=
0
else
v
# and back again
knife
[
ydo
]
=
slice
(
iy
*
nh
,
(
iy
+
1
)
*
nh
)
# v = np.swapaxes(v, 0, ydo) if ydo!=0 else v # there
# v = v[iy * nh:(iy + 1) * nh] # slice the section we want
# v = np.swapaxes(v, 0, ydo) if ydo!=0 else v # and back again
if
xdo
is
not
None
:
v
=
np
.
swapaxes
(
v
,
0
,
xdo
)
if
xdo
!=
0
else
v
# there
v
=
v
[
ix
*
nw
:(
ix
+
1
)
*
nw
]
# slice the section we want
v
=
np
.
swapaxes
(
v
,
0
,
xdo
)
if
xdo
!=
0
else
v
# and back again
knife
[
xdo
]
=
slice
(
ix
*
nw
,
(
ix
+
1
)
*
nw
)
# v = np.swapaxes(v, 0, xdo) if xdo!=0 else v # there
# v = v[ix * nw:(ix + 1) * nw] # slice the section we want
# v = np.swapaxes(v, 0, xdo) if xdo!=0 else v # and back again
yield
p
,
v
,
d
,
a
yield
p
,
V
[
knife
]
,
d
,
a
def
nc_write
(
seq
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment