Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
finam
Manage
Activity
Members
Labels
Plan
Issues
32
Issue boards
Milestones
Code
Merge requests
4
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FINAM
finam
Commits
ced7fa2c
Commit
ced7fa2c
authored
4 months ago
by
Sebastian Müller
🐈
Browse files
Options
Downloads
Patches
Plain Diff
gird: to_/from_canonical: allow additional dimensions
parent
f5fb87ef
No related branches found
No related tags found
1 merge request
!286
Add mask to Info object
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/finam/data/grid_base.py
+5
-2
5 additions, 2 deletions
src/finam/data/grid_base.py
with
5 additions
and
2 deletions
src/finam/data/grid_base.py
+
5
−
2
View file @
ced7fa2c
...
...
@@ -519,7 +519,9 @@ class StructuredGrid(Grid):
ValueError
When data has wrong shape.
"""
if
not
np
.
array_equal
(
np
.
shape
(
data
),
self
.
data_shape
):
rev
=
-
1
if
self
.
axes_reversed
else
1
d_shp
,
in_shp
,
shp_len
=
self
.
data_shape
,
np
.
shape
(
data
),
len
(
self
.
data_shape
)
if
not
np
.
array_equal
(
d_shp
[::
rev
],
in_shp
[::
rev
][:
shp_len
]):
msg
=
"
to_canonical: data has wrong shape.
"
raise
ValueError
(
msg
)
if
self
.
axes_reversed
and
np
.
ndim
(
data
)
>
1
:
...
...
@@ -552,7 +554,8 @@ class StructuredGrid(Grid):
When data has wrong shape.
"""
rev
=
-
1
if
self
.
axes_reversed
else
1
if
not
np
.
array_equal
(
np
.
shape
(
data
)[::
rev
],
self
.
data_shape
):
d_shp
,
in_shp
,
shp_len
=
self
.
data_shape
,
np
.
shape
(
data
),
len
(
self
.
data_shape
)
if
not
np
.
array_equal
(
d_shp
[::
rev
],
in_shp
[:
shp_len
]):
msg
=
"
from_canonical: data has wrong shape.
"
raise
ValueError
(
msg
)
for
i
,
inc
in
enumerate
(
self
.
axes_increase
):
...
...
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