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
a724e7b3
Commit
a724e7b3
authored
2 years ago
by
Martin Lange
Browse files
Options
Downloads
Patches
Plain Diff
check axes equality in structured grids instead of points, check for arg type in has_time_axis
parent
63fbd79a
No related branches found
No related tags found
1 merge request
!237
Optimize units etc.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/finam/data/grid_tools.py
+16
-1
16 additions, 1 deletion
src/finam/data/grid_tools.py
src/finam/data/tools.py
+11
-1
11 additions, 1 deletion
src/finam/data/tools.py
with
27 additions
and
2 deletions
src/finam/data/grid_tools.py
+
16
−
1
View file @
a724e7b3
...
...
@@ -585,7 +585,6 @@ class Grid(GridBase):
if
isinstance
(
self
,
StructuredGrid
)
!=
isinstance
(
other
,
StructuredGrid
):
return
False
# Might comparison of data_points be sufficient here?
return
(
self
.
dim
==
other
.
dim
and
self
.
crs
==
other
.
crs
...
...
@@ -765,6 +764,22 @@ class StructuredGrid(Grid):
np
.
maximum
(
dims
-
1
,
1
)
if
self
.
data_location
==
Location
.
CELLS
else
dims
)
def
__eq__
(
self
,
other
):
if
not
isinstance
(
other
,
Grid
):
return
False
if
not
isinstance
(
other
,
StructuredGrid
):
return
False
return
(
self
.
dim
==
other
.
dim
and
self
.
crs
==
other
.
crs
and
self
.
order
==
other
.
order
and
self
.
data_location
==
other
.
data_location
and
self
.
data_shape
==
other
.
data_shape
and
all
(
np
.
allclose
(
a
,
b
)
for
a
,
b
in
zip
(
self
.
axes
,
other
.
axes
))
)
def
export_vtk
(
self
,
path
,
...
...
This diff is collapsed.
Click to expand it.
src/finam/data/tools.py
+
11
−
1
View file @
a724e7b3
...
...
@@ -146,7 +146,17 @@ def has_time_axis(xdata, grid):
bool
Whether the data has a time axis.
"""
grid_dim
=
len
(
grid
.
data_shape
)
if
isinstance
(
grid
,
Grid
)
else
grid
.
dim
grid_dim
=
None
if
isinstance
(
grid
,
Grid
):
grid_dim
=
len
(
grid
.
data_shape
)
elif
isinstance
(
grid
,
grid_spec
.
NoGrid
):
grid_dim
=
grid
.
dim
else
:
raise
ValueError
(
f
"
Expected type Grid or NoGrid, got
{
grid
.
__class__
.
__name__
}
.
"
)
if
xdata
.
ndim
==
grid_dim
:
return
False
...
...
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