Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MVCM
Manage
Activity
Members
Labels
Plan
Issues
1
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Paolo Veglio
MVCM
Commits
1ebc5d74
Commit
1ebc5d74
authored
10 months ago
by
Paolo Veglio
Browse files
Options
Downloads
Patches
Plain Diff
fixed test_conf and test_read_data
parent
3d2ff753
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#51253
failed with stage
in 56 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/test_conf.py
+12
-6
12 additions, 6 deletions
tests/test_conf.py
tests/test_read_data.py
+15
-15
15 additions, 15 deletions
tests/test_read_data.py
with
27 additions
and
21 deletions
tests/test_conf.py
+
12
−
6
View file @
1ebc5d74
...
...
@@ -70,13 +70,19 @@ def test_c_single_threshold(rad, single_threshold, reference_data):
ref_confidence
=
np
.
load
(
reference_data
)[
"
ref_sgl
"
]
ref_confidence_flipped
=
np
.
load
(
reference_data
)[
"
ref_sgl_flipped
"
]
c
=
anc
.
py_conf_test
(
rad
,
single_threshold
[
0
],
single_threshold
[
2
],
single_threshold
[
3
],
single_threshold
[
1
]
)
locut
=
np
.
array
(
single_threshold
[
0
],
dtype
=
float
)
midpt
=
np
.
array
(
single_threshold
[
1
],
dtype
=
float
)
hicut
=
np
.
array
(
single_threshold
[
2
],
dtype
=
float
)
power
=
np
.
array
(
single_threshold
[
3
],
dtype
=
float
)
c
=
anc
.
py_conf_test
(
np
.
array
(
rad
,
dtype
=
np
.
float32
),
locut
,
hicut
,
power
,
midpt
)
assert
np
.
all
(
c
==
ref_confidence
)
single_threshold
[
0
:
-
1
]
=
single_threshold
[
-
2
::
-
1
]
c
=
anc
.
py
.
conf_test
(
rad
,
single_threshold
[
0
],
single_threshold
[
2
],
single_threshold
[
3
],
single_threshold
[
1
]
)
locut
=
np
.
array
(
single_threshold
[
0
],
dtype
=
float
)
midpt
=
np
.
array
(
single_threshold
[
1
],
dtype
=
float
)
hicut
=
np
.
array
(
single_threshold
[
2
],
dtype
=
float
)
power
=
np
.
array
(
single_threshold
[
3
],
dtype
=
float
)
c
=
anc
.
py_conf_test
(
np
.
array
(
rad
,
dtype
=
np
.
float32
),
locut
,
hicut
,
power
,
midpt
)
assert
np
.
all
(
c
==
ref_confidence_flipped
)
This diff is collapsed.
Click to expand it.
tests/test_read_data.py
+
15
−
15
View file @
1ebc5d74
...
...
@@ -103,31 +103,29 @@ def test_l1b(l1b_file, geo_file):
assert
"
M11
"
in
l1b
.
data_vars
def
test_sst
(
fixturepath
,
sst_file
,
ref_file
):
def
test_sst
(
fixturepath
,
geo_file
,
sst_file
,
ref_file
):
"""
Test SST reading.
"""
viirs
=
rd
.
ReadData
(
satellite
=
"
snpp
"
,
sensor
=
"
viirs
"
)
viirs
=
rd
.
ReadData
(
satellite
=
"
snpp
"
,
sensor
=
"
viirs
"
,
file_name_geo
=
geo_file
)
geo
=
viirs
.
read_viirs_geo
()
ancillary
=
rd
.
ReadAncillary
(
latitude
=
geo
.
latitude
.
values
,
longitude
=
geo
.
longitude
.
values
,
resolution
=
1
,
ancillary_dir
=
fixturepath
,
sst_file
=
sst_file
,
sst_file
=
os
.
path
.
join
(
fixturepath
,
sst_file
),
)
sst
=
ancillary
.
get_sst
()
check_differences
(
ref_file
,
sst
,
"
sst
"
)
def
test_ndvi
(
fixturepath
,
ndvi_file
,
ref_file
):
def
test_ndvi
(
fixturepath
,
geo_file
,
ndvi_file
,
ref_file
):
"""
Test NDVI reading.
"""
viirs
=
rd
.
ReadData
(
satellite
=
"
snpp
"
,
sensor
=
"
viirs
"
)
viirs
=
rd
.
ReadData
(
satellite
=
"
snpp
"
,
sensor
=
"
viirs
"
,
file_name_geo
=
geo_file
)
geo
=
viirs
.
read_viirs_geo
()
ancillary
=
rd
.
ReadAncillary
(
latitude
=
geo
.
latitude
.
values
,
longitude
=
geo
.
longitude
.
values
,
resolution
=
1
,
ancillary_dir
=
fixturepath
,
ndvi_file
=
ndvi_file
,
ndvi_file
=
os
.
path
.
join
(
fixturepath
,
ndvi_file
),
)
ndvi
=
ancillary
.
get_ndvi
()
check_differences
(
ref_file
,
ndvi
,
"
ndvi
"
)
...
...
@@ -135,6 +133,8 @@ def test_ndvi(fixturepath, ndvi_file, ref_file):
def
test_geos
(
fixturepath
,
l1b_file
,
geo_file
,
geos_file_1
,
geos_file_2
,
geos_land
,
...
...
@@ -143,18 +143,18 @@ def test_geos(
ref_file
,
):
"""
Test GEOS reading.
"""
viirs
=
rd
.
ReadData
(
satellite
=
"
snpp
"
,
sensor
=
"
viirs
"
)
viirs
=
rd
.
ReadData
(
satellite
=
"
snpp
"
,
sensor
=
"
viirs
"
,
file_name_geo
=
geo_file
)
geo
=
viirs
.
read_viirs_geo
()
ancillary
=
rd
.
ReadAncillary
(
file_name_l1b
=
l1b_file
,
latitude
=
geo
.
latitude
.
values
,
longitude
=
geo
.
longitude
.
values
,
resolution
=
1
,
ancillary_dir
=
fixturepath
,
geos_file_1
=
geos_file_1
,
geos_file_2
=
geos_file_2
,
geos_land
=
geos_land
,
geos_ocean
=
geos_ocean
,
geos_constants
=
geos_constants
,
geos_file_1
=
os
.
path
.
join
(
fixturepath
,
geos_file_1
),
geos_file_2
=
os
.
path
.
join
(
fixturepath
,
geos_file_2
),
geos_land
=
os
.
path
.
join
(
fixturepath
,
geos_land
),
geos_ocean
=
os
.
path
.
join
(
fixturepath
,
geos_ocean
),
geos_constants
=
os
.
path
.
join
(
fixturepath
,
geos_constants
),
)
geos_data
=
ancillary
.
get_geos
()
...
...
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