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
9913aa22
Commit
9913aa22
authored
1 year ago
by
Sebastian Müller
🐈
Browse files
Options
Downloads
Patches
Plain Diff
masking: set correct units for nodata in masking adapter
parent
f1cca6eb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!258
Grid mask support
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/finam/adapters/masking.py
+1
-1
1 addition, 1 deletion
src/finam/adapters/masking.py
tests/adapters/test_masking.py
+2
-2
2 additions, 2 deletions
tests/adapters/test_masking.py
with
3 additions
and
3 deletions
src/finam/adapters/masking.py
+
1
−
1
View file @
9913aa22
...
...
@@ -99,6 +99,6 @@ class Masking(Adapter):
def
_transform
(
self
,
data
):
if
self
.
_canonical_mask
is
not
None
:
data
=
np
.
copy
(
self
.
_sup_grid
.
to_canonical
(
data
))
data
[
self
.
_canonical_mask
]
=
self
.
nodata
data
[
self
.
_canonical_mask
]
=
tools
.
UNITS
.
Quantity
(
self
.
nodata
,
data
.
units
)
return
self
.
_sub_grid
.
from_canonical
(
data
)
return
self
.
_sub_grid
.
from_canonical
(
self
.
_sup_grid
.
to_canonical
(
data
))
This diff is collapsed.
Click to expand it.
tests/adapters/test_masking.py
+
2
−
2
View file @
9913aa22
...
...
@@ -46,11 +46,11 @@ class TestMasking(unittest.TestCase):
composition
=
Composition
([
source
,
sink
],
log_level
=
"
DEBUG
"
)
composition
.
initialize
()
source
.
outputs
[
"
Output
"
]
>>
Masking
()
>>
sink
.
inputs
[
"
Input
"
]
source
.
outputs
[
"
Output
"
]
>>
Masking
(
nodata
=-
9999
)
>>
sink
.
inputs
[
"
Input
"
]
composition
.
connect
()
self
.
assert
True
(
np
.
isnan
(
sink
.
data
[
"
Input
"
][
0
][
0
,
0
]
)
)
self
.
assert
AlmostEqual
(
sink
.
data
[
"
Input
"
][
0
][
0
,
0
]
.
magnitude
,
-
9999
)
self
.
assertAlmostEqual
(
sink
.
data
[
"
Input
"
][
0
][
0
,
1
].
magnitude
,
2.0
)
...
...
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