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
983c9aa3
Commit
983c9aa3
authored
11 months ago
by
Sebastian Müller
🐈
Browse files
Options
Downloads
Patches
Plain Diff
grid: add check_location to compatible_with method
parent
5bff58fa
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!280
Optional location check
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/finam/data/grid_base.py
+8
-4
8 additions, 4 deletions
src/finam/data/grid_base.py
src/finam/data/grid_spec.py
+3
-1
3 additions, 1 deletion
src/finam/data/grid_spec.py
with
11 additions
and
5 deletions
src/finam/data/grid_base.py
+
8
−
4
View file @
983c9aa3
...
...
@@ -190,7 +190,7 @@ class Grid(GridBase):
def
__repr__
(
self
):
return
f
"
{
self
.
__class__
.
__name__
}
(
{
self
.
dim
}
D)
{
self
.
data_shape
}
"
def
compatible_with
(
self
,
other
):
def
compatible_with
(
self
,
other
,
check_location
=
True
):
"""
Check for compatibility with other Grid.
...
...
@@ -198,6 +198,8 @@ class Grid(GridBase):
----------
other : instance of Grid
Other grid to compatibility with.
check_location : bool, optional
Whether to check location for equality, by default True
Returns
-------
...
...
@@ -214,7 +216,7 @@ class Grid(GridBase):
self
.
dim
==
other
.
dim
and
self
.
crs
==
other
.
crs
and
self
.
order
==
other
.
order
and
self
.
data_location
==
other
.
data_location
and
(
not
check_location
or
self
.
data_location
==
other
.
data_location
)
):
return
False
...
...
@@ -393,7 +395,7 @@ class StructuredGrid(Grid):
np
.
maximum
(
dims
-
1
,
1
)
if
self
.
data_location
==
Location
.
CELLS
else
dims
)
def
compatible_with
(
self
,
other
):
def
compatible_with
(
self
,
other
,
check_location
=
True
):
"""
Check for compatibility with other Grid.
...
...
@@ -401,6 +403,8 @@ class StructuredGrid(Grid):
----------
other : instance of Grid
Other grid to compatibility with.
check_location : bool, optional
Whether to check location for equality, by default True
Returns
-------
...
...
@@ -416,7 +420,7 @@ class StructuredGrid(Grid):
if
not
(
self
.
dim
==
other
.
dim
and
self
.
crs
==
other
.
crs
and
self
.
data_location
==
other
.
data_location
and
(
not
check_location
or
self
.
data_location
==
other
.
data_location
)
):
return
False
...
...
This diff is collapsed.
Click to expand it.
src/finam/data/grid_spec.py
+
3
−
1
View file @
983c9aa3
...
...
@@ -42,7 +42,7 @@ class NoGrid(GridBase):
return
f
"
{
self
.
__class__
.
__name__
}
(
{
self
.
dim
}
D)
"
# pylint: disable-next=unused-argument
def
compatible_with
(
self
,
other
):
def
compatible_with
(
self
,
other
,
check_location
=
True
):
"""
Check for compatibility with other Grid.
...
...
@@ -50,6 +50,8 @@ class NoGrid(GridBase):
----------
other : instance of Grid
Other grid to compatibility with.
check_location : bool, optional
Whether to check location for equality, by default True
Returns
-------
...
...
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