Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
thopri
PyNEMO
Commits
755d4fdb
Commit
755d4fdb
authored
5 years ago
by
James Harle
Browse files
Options
Download
Email Patches
Plain Diff
Add 'F' to flatten - was using the value 1 before. Not too sure why this
was.
parent
c766adb7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
11 deletions
+11
-11
pynemo/nemo_bdy_extr_tm3.py
pynemo/nemo_bdy_extr_tm3.py
+8
-8
pynemo/nemo_bdy_gen_c.py
pynemo/nemo_bdy_gen_c.py
+2
-2
pynemo/nemo_bdy_zgrv2.py
pynemo/nemo_bdy_zgrv2.py
+1
-1
No files found.
pynemo/nemo_bdy_extr_tm3.py
View file @
755d4fdb
...
...
@@ -280,8 +280,8 @@ class Extract:
ind
[
p
,
:]
=
ind
[
p
,
dist_ind
[
p
,
:]]
if
self
.
key_vec
:
self
.
gcos
=
self
.
gcos
.
flatten
(
1
)[
ind
].
reshape
(
ind
.
shape
,
order
=
'F'
)
self
.
gsin
=
self
.
gsin
.
flatten
(
1
)[
ind
].
reshape
(
ind
.
shape
,
order
=
'F'
)
self
.
gcos
=
self
.
gcos
.
flatten
(
'F'
)[
ind
].
reshape
(
ind
.
shape
,
order
=
'F'
)
self
.
gsin
=
self
.
gsin
.
flatten
(
'F'
)[
ind
].
reshape
(
ind
.
shape
,
order
=
'F'
)
sc_ind
=
{}
sc_ind
[
'ind'
]
=
ind
...
...
@@ -571,11 +571,11 @@ class Extract:
for
dep
in
range
(
sc_z_len
):
tmp_arr
=
[
None
,
None
]
# Consider squeezing
tmp_arr
[
0
]
=
sc_array
[
0
][
0
,
dep
,:,:].
flatten
(
1
)
#[:,:,dep]
tmp_arr
[
0
]
=
sc_array
[
0
][
0
,
dep
,:,:].
flatten
(
'F'
)
#[:,:,dep]
if
not
self
.
key_vec
:
sc_bdy
[
vn
,
dep
,
:,
:]
=
self
.
_flat_ref
(
tmp_arr
[
0
],
ind
)
else
:
tmp_arr
[
1
]
=
sc_array
[
1
][
0
,
dep
,:,:].
flatten
(
1
)
#[:,:,dep]
tmp_arr
[
1
]
=
sc_array
[
1
][
0
,
dep
,:,:].
flatten
(
'F'
)
#[:,:,dep]
# Include in the collapse the rotation from the
# grid to real zonal direction, ie ij -> e
sc_bdy
[
vn
,
dep
,
:]
=
(
tmp_arr
[
0
][
ind
[:]]
*
self
.
gcos
-
...
...
@@ -669,11 +669,11 @@ class Extract:
# Apply 1-2-1 filter along bdy pts using NN ind self.id_121
if
self
.
first
:
tmp_valid
=
np
.
invert
(
np
.
isnan
(
dst_bdy
.
flatten
(
1
)[
self
.
id_121
]))
dst_bdy
.
flatten
(
'F'
)[
self
.
id_121
]))
# Finished first run operations
self
.
first
=
False
dst_bdy
=
(
np
.
nansum
(
dst_bdy
.
flatten
(
1
)[
self
.
id_121
]
*
dst_bdy
=
(
np
.
nansum
(
dst_bdy
.
flatten
(
'F'
)[
self
.
id_121
]
*
self
.
tmp_filt
,
2
)
/
np
.
sum
(
self
.
tmp_filt
*
tmp_valid
,
2
))
# Set land pts to zero
...
...
@@ -688,7 +688,7 @@ class Extract:
# If we have depth dimension
if
not
self
.
isslab
:
# If all else fails fill down using deepest pt
dst_bdy
=
dst_bdy
.
flatten
(
1
)
dst_bdy
=
dst_bdy
.
flatten
(
'F'
)
dst_bdy
+=
((
dst_bdy
==
0
)
*
dst_bdy
[
data_ind
].
repeat
(
sc_z_len
))
# Weighted averaged on new vertical grid
...
...
@@ -732,7 +732,7 @@ class Extract:
alpha -- input array
beta -- index array
"""
return
alpha
.
flatten
(
1
)[
beta
.
flatten
(
1
)].
reshape
(
return
alpha
.
flatten
(
'F'
)[
beta
.
flatten
(
'F'
)].
reshape
(
beta
.
shape
,
order
=
'F'
)
# Convert numeric date from source to dest
...
...
This diff is collapsed.
Click to expand it.
pynemo/nemo_bdy_gen_c.py
View file @
755d4fdb
...
...
@@ -102,8 +102,8 @@ class Boundary:
bdy_i
=
np
.
transpose
(
bdy_i
,
(
1
,
2
,
0
))
bdy_i
=
np
.
reshape
(
bdy_i
,
(
bdy_i
.
shape
[
0
],
bdy_i
.
shape
[
1
]
*
bdy_i
.
shape
[
2
]))
bdy_r
=
bdy_r
.
flatten
(
1
)
bdy_r
=
bdy_r
.
flatten
(
'F'
)
## Remove duplicate and open sea points ##
bdy_i
,
bdy_r
=
self
.
_remove_duplicate_points
(
bdy_i
,
bdy_r
)
...
...
This diff is collapsed.
Click to expand it.
pynemo/nemo_bdy_zgrv2.py
View file @
755d4fdb
...
...
@@ -101,7 +101,7 @@ class Depth:
wshapes
=
[]
wshapes
.
append
(
wrk1
.
shape
)
wshapes
.
append
(
wrk2
.
shape
)
wrk1
,
wrk2
=
wrk1
.
flatten
(
1
),
wrk2
.
flatten
(
1
)
wrk1
,
wrk2
=
wrk1
.
flatten
(
'F'
),
wrk2
.
flatten
(
'F'
)
self
.
zpoints
[
't'
][
k
,:]
=
wrk1
[
t_ind
]
self
.
zpoints
[
'wt'
][
k
,:]
=
wrk2
[
t_ind
]
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment