Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Plio
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
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
aflab
astrogeology
Plio
Commits
144f9433
Commit
144f9433
authored
8 years ago
by
Jason R Laura
Browse files
Options
Downloads
Patches
Plain Diff
updates for CNET
parent
8338be77
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
plio/io/io_controlnetwork.py
+3
-3
3 additions, 3 deletions
plio/io/io_controlnetwork.py
plio/io/io_spectral_profiler.py
+20
-1
20 additions, 1 deletion
plio/io/io_spectral_profiler.py
plio/io/tests/test_io_spectral_profiler.py
+6
-1
6 additions, 1 deletion
plio/io/tests/test_io_spectral_profiler.py
with
29 additions
and
5 deletions
plio/io/io_controlnetwork.py
+
3
−
3
View file @
144f9433
...
@@ -222,10 +222,12 @@ class IsisStore(object):
...
@@ -222,10 +222,12 @@ class IsisStore(object):
measure_spec
=
point_spec
.
Measure
()
measure_spec
=
point_spec
.
Measure
()
# For all of the attributes, set if they are an dict accessible attr of the obj.
# For all of the attributes, set if they are an dict accessible attr of the obj.
for
attr
,
attrtype
in
self
.
measure_attrs
:
for
attr
,
attrtype
in
self
.
measure_attrs
:
if
attr
in
g
.
columns
:
if
attr
in
g
.
columns
:
setattr
(
measure_spec
,
attr
,
attrtype
(
m
[
attr
]))
setattr
(
measure_spec
,
attr
,
attrtype
(
m
[
attr
]))
measure_spec
.
type
=
int
(
m
.
measure_type
)
measure_spec
.
type
=
int
(
m
.
measure_type
)
measure_spec
.
line
=
m
.
y
measure_spec
.
sample
=
m
.
x
measure_iterable
.
append
(
measure_spec
)
measure_iterable
.
append
(
measure_spec
)
self
.
nmeasures
+=
1
self
.
nmeasures
+=
1
point_spec
.
measures
.
extend
(
measure_iterable
)
point_spec
.
measures
.
extend
(
measure_iterable
)
...
@@ -364,5 +366,3 @@ class IsisStore(object):
...
@@ -364,5 +366,3 @@ class IsisStore(object):
if
self
.
_handle
is
not
None
:
if
self
.
_handle
is
not
None
:
self
.
_handle
.
close
()
self
.
_handle
.
close
()
self
.
_handle
=
None
self
.
_handle
=
None
This diff is collapsed.
Click to expand it.
plio/io/io_spectral_profiler.py
+
20
−
1
View file @
144f9433
import
os
import
pandas
as
pd
import
pandas
as
pd
import
pvl
import
pvl
import
numpy
as
np
import
numpy
as
np
from
plio.utils.utils
import
find_in_dict
from
plio.utils.utils
import
find_in_dict
from
plio.io.io_gdal
import
GeoDataset
class
Spectral_Profiler
(
object
):
class
Spectral_Profiler
(
object
):
...
@@ -52,6 +53,7 @@ class Spectral_Profiler(object):
...
@@ -52,6 +53,7 @@ class Spectral_Profiler(object):
label
=
pvl
.
load
(
input_data
)
label
=
pvl
.
load
(
input_data
)
self
.
label
=
label
self
.
label
=
label
self
.
input_data
=
input_data
with
open
(
input_data
,
'
rb
'
)
as
indata
:
with
open
(
input_data
,
'
rb
'
)
as
indata
:
# Extract and handle the ancillary data
# Extract and handle the ancillary data
ancillary_data
=
find_in_dict
(
label
,
"
ANCILLARY_AND_SUPPLEMENT_DATA
"
)
ancillary_data
=
find_in_dict
(
label
,
"
ANCILLARY_AND_SUPPLEMENT_DATA
"
)
...
@@ -128,3 +130,20 @@ class Spectral_Profiler(object):
...
@@ -128,3 +130,20 @@ class Spectral_Profiler(object):
self
.
spectra
[
i
]
=
self
.
spectra
[
i
][
self
.
spectra
[
i
][
'
QA
'
]
<
qa_threshold
]
self
.
spectra
[
i
]
=
self
.
spectra
[
i
][
self
.
spectra
[
i
][
'
QA
'
]
<
qa_threshold
]
self
.
spectra
=
pd
.
Panel
(
self
.
spectra
)
self
.
spectra
=
pd
.
Panel
(
self
.
spectra
)
def
open_browse
(
self
,
extension
=
'
.jpg
'
):
"""
Attempt to open the browse image corresponding to the spc file
Parameters
----------
extension : str
The file type extension to be added to the base name
of the spc file.
Returns
-------
"""
path
,
ext
=
os
.
path
.
splitext
(
self
.
input_data
)
self
.
browse
=
GeoDataset
(
path
+
extension
)
This diff is collapsed.
Click to expand it.
plio/io/tests/test_io_spectral_profiler.py
+
6
−
1
View file @
144f9433
...
@@ -8,7 +8,7 @@ sys.path.insert(0, os.path.abspath('..'))
...
@@ -8,7 +8,7 @@ sys.path.insert(0, os.path.abspath('..'))
from
plio.examples
import
get_path
from
plio.examples
import
get_path
from
plio.io
import
io_spectral_profiler
from
plio.io
import
io_spectral_profiler
from
plio.io.io_gdal
import
GeoDataset
class
Test_Spectral_Profiler_IO
(
unittest
.
TestCase
):
class
Test_Spectral_Profiler_IO
(
unittest
.
TestCase
):
...
@@ -21,6 +21,11 @@ class Test_Spectral_Profiler_IO(unittest.TestCase):
...
@@ -21,6 +21,11 @@ class Test_Spectral_Profiler_IO(unittest.TestCase):
self
.
assertIsInstance
(
ds
.
spectra
,
pd
.
Panel
)
self
.
assertIsInstance
(
ds
.
spectra
,
pd
.
Panel
)
self
.
assertEqual
(
ds
.
spectra
[
0
].
columns
.
tolist
(),
[
'
RAW
'
,
'
REF1
'
,
'
REF2
'
,
'
QA
'
])
self
.
assertEqual
(
ds
.
spectra
[
0
].
columns
.
tolist
(),
[
'
RAW
'
,
'
REF1
'
,
'
REF2
'
,
'
QA
'
])
def
test_read_browse
(
self
):
ds
=
io_spectral_profiler
.
Spectral_Profiler
(
self
.
examplefile
)
ds
.
open_browse
()
self
.
assertIsInstance
(
ds
.
browse
,
GeoDataset
)
self
.
assertEqual
(
ds
.
browse
.
read_array
().
shape
,
(
512
,
456
))
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
unittest
.
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