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
3
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
0c9e4a9b
Commit
0c9e4a9b
authored
1 year ago
by
Sebastian Müller
🐈
Browse files
Options
Downloads
Patches
Plain Diff
info: better fail info for mask missmatch
parent
928f1991
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!258
Grid mask support
Pipeline
#181255
failed with stages
in 2 minutes and 43 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/finam/data/grid_tools.py
+8
-2
8 additions, 2 deletions
src/finam/data/grid_tools.py
src/finam/data/tools.py
+14
-0
14 additions, 0 deletions
src/finam/data/tools.py
with
22 additions
and
2 deletions
src/finam/data/grid_tools.py
+
8
−
2
View file @
0c9e4a9b
...
...
@@ -24,8 +24,14 @@ def check_mask_equal(grid1, grid2):
if
mask1
is
None
and
mask2
is
None
:
return
True
# only one None is not fine
if
mask1
is
None
or
mask2
is
None
:
return
False
# if mask1 is None or mask2 is None:
# return False
# None mask and no masked values are equally fine
if
mask1
is
None
:
return
not
np
.
any
(
mask2
)
if
mask2
is
None
:
return
not
np
.
any
(
mask1
)
# compare
return
np
.
all
(
grid1
.
to_canonical
(
mask1
)
==
grid2
.
to_canonical
(
mask2
))
...
...
This diff is collapsed.
Click to expand it.
src/finam/data/tools.py
+
14
−
0
View file @
0c9e4a9b
...
...
@@ -11,6 +11,7 @@ from ..errors import FinamDataError, FinamMetaDataError
# pylint: disable-next=unused-import
from
.
import
cf_units
,
grid_spec
from
.grid_base
import
Grid
,
GridBase
from
.grid_tools
import
check_mask_equal
# set default format to cf-convention for pint.dequantify
# some problems with degree_Celsius and similar here
...
...
@@ -657,6 +658,19 @@ class Info:
if
self
.
grid
is
not
None
and
not
self
.
grid
.
compatible_with
(
incoming
.
grid
):
if
not
(
ignore_none
and
incoming
.
grid
is
None
):
fail_info
[
"
grid
"
]
=
(
incoming
.
grid
,
self
.
grid
)
if
not
check_mask_equal
(
self
.
grid
,
incoming
.
grid
):
in_mask
=
(
np
.
sum
(
incoming
.
grid
.
mask
)
if
incoming
.
grid
.
mask
is
not
None
else
0
)
out_mask
=
(
np
.
sum
(
self
.
grid
.
mask
)
if
self
.
grid
.
mask
is
not
None
else
0
)
fail_info
[
"
mask
"
]
=
(
f
"
{
in_mask
}
point(s) masked
"
,
f
"
{
out_mask
}
point(s) masked
"
,
)
success
=
False
for
k
,
v
in
self
.
meta
.
items
():
...
...
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