Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
EO Time Series Viewer
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
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
Benjamin Jakimow
EO Time Series Viewer
Commits
b17c4dca
Commit
b17c4dca
authored
6 years ago
by
Benjamin Jakimow
Browse files
Options
Downloads
Patches
Plain Diff
added test_sensorvisualization.py
parent
1927923a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
timeseriesviewertesting/test_sensorvisualization.py
+78
-0
78 additions, 0 deletions
timeseriesviewertesting/test_sensorvisualization.py
with
78 additions
and
0 deletions
timeseriesviewertesting/test_sensorvisualization.py
0 → 100644
+
78
−
0
View file @
b17c4dca
# coding=utf-8
"""
Tests QGIS plugin init.
"""
import
os
import
unittest
import
example
import
example.Images
from
osgeo
import
gdal
,
ogr
,
osr
from
timeseriesviewer.utils
import
file_search
,
TestObjects
from
timeseriesviewer.timeseries
import
*
from
timeseriesviewertesting
import
initQgisApplication
from
timeseriesviewer.sensorvisualization
import
*
app
=
initQgisApplication
()
class
TestInit
(
unittest
.
TestCase
):
def
createTestDatasets
(
self
):
vsiDir
=
'
/vsimem/tmp
'
from
timeseriesviewer.temporalprofiles2d
import
date2num
ns
=
50
nl
=
100
r1
=
np
.
arange
(
'
2000-01-01
'
,
'
2005-06-14
'
,
step
=
np
.
timedelta64
(
16
,
'
D
'
),
dtype
=
np
.
datetime64
)
r2
=
np
.
arange
(
'
2000-01-01
'
,
'
2005-06-14
'
,
step
=
np
.
timedelta64
(
8
,
'
D
'
),
dtype
=
np
.
datetime64
)
drv
=
gdal
.
GetDriverByName
(
'
ENVI
'
)
crs
=
osr
.
SpatialReference
()
crs
.
ImportFromEPSG
(
32633
)
assert
isinstance
(
drv
,
gdal
.
Driver
)
datasets
=
[]
for
i
,
r
in
enumerate
([
r1
,
r2
]):
p
=
'
{}tmpstack{}.bsq
'
.
format
(
vsiDir
,
i
+
1
)
ds
=
drv
.
Create
(
p
,
ns
,
nl
,
len
(
r
),
eType
=
gdal
.
GDT_Float32
)
assert
isinstance
(
ds
,
gdal
.
Dataset
)
ds
.
SetProjection
(
crs
.
ExportToWkt
())
dateString
=
'
,
'
.
join
([
str
(
d
)
for
d
in
r
])
dateString
=
'
{{{}}}
'
.
format
(
dateString
)
ds
.
SetMetadataItem
(
'
wavelength
'
,
dateString
,
'
ENVI
'
)
for
b
,
date
in
enumerate
(
r
):
decimalYear
=
date2num
(
date
)
band
=
ds
.
GetRasterBand
(
b
+
1
)
assert
isinstance
(
band
,
gdal
.
Band
)
band
.
Fill
(
decimalYear
)
ds
.
FlushCache
()
datasets
.
append
(
p
)
return
datasets
def
createTimeSeries
(
self
)
->
TimeSeries
:
pathes
=
[
example
.
Images
.
Img_2014_01_15_LC82270652014015LGN00_BOA
,
example
.
Images
.
Img_2014_04_29_LE72270652014119CUB00_BOA
,
example
.
Images
.
re_2014_06_25
]
TS
=
TimeSeries
()
model
=
SensorListModel
(
TS
)
self
.
assertTrue
(
model
.
rowCount
()
==
0
)
TS
.
addSources
(
pathes
)
self
.
assertTrue
(
len
(
TS
)
==
len
(
pathes
))
self
.
assertTrue
(
model
.
rowCount
()
==
2
)
if
__name__
==
'
__main__
'
:
unittest
.
main
()
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