-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Created tests for USGS Spectral Library Version 7 convert function #146
Conversation
update branch
Fix broken location of GDAL CURRENT to fixed 2.2.4 in Dockerfile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bdegley4789 please look at my comments. Thank you for writing unit tests. Lets talk tomorrow.
examples/example_mineral.py
Outdated
@@ -61,7 +61,7 @@ | |||
|
|||
|
|||
input_filename = 'avng.jpl.nasa.gov/AVNG_2015_data_distribution/L2/ang20150420t182050_rfl_v1e/ang20150420t182050_corr_v1e_img.hdr' | |||
library_filename='../pycoal/tests/s06av95a_envi.hdr' | |||
library_filename='../pycoal/tests/s07_AV95_envi.hdr' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to make sure that there are no regressions what-so-ever. We are NOT dropping support for USGS v6. We are adding functionality to use v7... this means that all v6 code should not be touched.
The solution here is to either
- introduce a brand new example file for v7 mineral classification, or
- introduce a new CLI flag which determines the spectral library at runtime based upon the program input.
examples/example_mineral.py
Outdated
@@ -120,7 +120,7 @@ def main(argv=None): | |||
# Setup argument parser | |||
parser = ArgumentParser(description=program_license, formatter_class=RawDescriptionHelpFormatter) | |||
parser.add_argument("-i", "--image", dest="image", default=input_filename, help="Input file to be processed [default: ang20150420t182050_corr_v1e_img.hdr]") | |||
parser.add_argument("-s", "--slib", dest="slib", default=library_filename, help="Spectral Library filename [default: s06av95a_envi.hdr]") | |||
parser.add_argument("-s", "--slib", dest="slib", default=library_filename, help="Spectral Library filename [default: s07_AV95_envi.hdr]") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here...
examples/example_spectral07.py
Outdated
|
||
Dependencies | ||
`USGS Spectral Library Version 7 <https://speclab.cr.usgs.gov/spectral-lib.html>`_ | ||
must be downloaded to the examples directory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
must be downloaded to the examples directory
should be changed to
must be downloaded and unzipped to the examples directory
examples/example_spectral07.py
Outdated
|
||
@author: COAL Developers | ||
|
||
@copyright: 2018 COAL Developers. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change to 2017-2018
examples/example_spectral07.py
Outdated
@contact: [email protected] | ||
''' | ||
|
||
#!/usr/bin/python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This always goes at the top of the file.
input_file.write('Measurement: Unknown\n') | ||
input_file.write('First Column: X\n') | ||
input_file.write('Second Column: Y\n') | ||
input_file.write('X Units: Wavelength (micrometers)\n') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Writing all of these values still seems way too tightly tied with some very specific file. It is not correct and needs to be much more flexible.
pycoal/mineral.py
Outdated
@@ -362,3 +368,184 @@ def convert(cls, data_dir="", db_file="", hdr_file=""): | |||
library = aster_database.create_envi_spectral_library(spectrum_ids, band_info) | |||
|
|||
library.save(hdr_file) | |||
|
|||
class SpectralToAsterConversion: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change this Class name to something more descriptive.
pycoal/mining.py
Outdated
proxy_class_names = [u'Schwertmannite BZ93-1 s06av95a=b', | ||
u'Renyolds_TnlSldgWet SM93-15w s06av95a=a', | ||
u'Renyolds_Tnl_Sludge SM93-15 s06av95a=a'] | ||
proxy_class_names = [u'Schwertmannite BZ93-1 BECKb AREF', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, this cannot change... we need to maintain backwards compatibility and add functionality not take away.
pycoal/tests/test.py
Outdated
@@ -26,7 +26,7 @@ def _remove_files(listOfFileNames): | |||
pass | |||
|
|||
# file names of USGS Digital Spectral Library 06 in ENVI format | |||
libraryFilenames = ["s06av95a_envi.hdr", "s06av95a_envi.sli"] | |||
libraryFilenames = ["s07_AV95_envi.hdr", "s07_AV95_envi.sli"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... and again. You need to add new entries not take away from what we already have.
pycoal/tests/test.py
Outdated
@@ -26,7 +26,7 @@ def _remove_files(listOfFileNames): | |||
pass | |||
|
|||
# file names of USGS Digital Spectral Library 06 in ENVI format | |||
libraryFilenames = ["s06av95a_envi.hdr", "s06av95a_envi.sli"] | |||
libraryFilenames = ["s07_AV95_envi.hdr", "s07_AV95_envi.sli"] | |||
|
|||
# set up test module before running tests | |||
def setup_module(module): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are not using any of the test files you've introduced. You either need to use them or remove them.
@bdegley4789 I would also like to remind you to always test your code before you submit a pull request. It is VERY simple and takes no longer than about 2 seconds to type and around a minute or so to execute. |
@bdegley4789 any updates here? |
@lewismc I can’t really figure why my tests aren’t passing. I re-downloaded pycoal from the master. I moved the files I changed over to the new pycoal I downloaded and now everything passes. I must have changed something in a directory I’m unaware of. I’d like to figure out what is going on first, if I can't figure it out, I'll just push this new version to my fork and update this pr tomorrow or after I finish work today. This is what I get when I move all the files I changed over to a new pycoal directory.
On my current fork I still get these 2 failures and 1 error
|
I also finished running the mineral classification using the Spectral Version 7 envi .hdr and .sli on the default example and staged it here Based on the three mineral classifications I’ve done with Spectral v7, everything seems to perform normally using the Spectral Version 7 envi .hdr and .sli files |
Bryce, look at the stack trace... ValueError: 'Schwertmannite BZ93-1 s06av95a=b' is not in list |
You’ve also neglected to address any of my comments... come on. |
I'm working on implementing the comments you made, I was just giving an update on where I was with that. I changed mining.py back to the names of Spectral Version 6 Library so I thought 'Schwertmannite BZ93-1 s06av95a=b' would be in the list. I was thinking about doing multiple examples one for Spectral v7 and one for Spectral v6. But mining.py requires the spectra names so I think the only option |
Why don't you just do the following
Then use the |
Take a look at the comments... you've not addressed them. If this is not done by Thursday morning I will just do it myself. |
@lewismc Ok, I’m just using two different examples scripts for mineral classification to run USGS Spectral v7 and v6 libraries. Mining.py now has a new argument in the CLI which can be passed as a number either 6 or 7. Or you can just change the number in example_mining.py I tested running this with 6 and 7 and it works. But it must be the same version number as you did in the mineral classification to get the classified file. If the classified image was created with USGS Spectral Version 6, you can’t do a mining classification with version 7 since the spectra names are different.
I fixed errors in nose tests, now everything passes and I made all the requested changes you had
|
I don't know why travis-ci keeps saying |
@bdegley4789 what are all of the files
If you re not using them remove them. |
Look at the error traces in the TravisCI logs
There is a timeout when executing the FTP file retrieval in |
How large are these file? If they are not large then we should just cache them locally within the tests directory as a resource. |
Those files in |
Can you please squash your commits. This PR is very messy.
Unless they are being used in unit tests (which per your PR they are not) then they should be removed from the PR. |
remove s06_envi files from gitignore
@lewismc I fixed the errors with the ftp statements we discussed, I pushed the convolved envi .hdr and .sli files and I fixed another error I found when running nosetests. It looks like all the checks now pass. I think this pull request is good to be accepted and fulfills the work needed on issue #105 . In the next two days I'll add documentation for this issue to the website. Let me know what you think |
Excellent work on this issue @bdegley4789 it's been a long time coming and a lot of back and forth these last few months... but it's now ready to commit to master branch. Excellent work, thank you for the persistence. |
This doesn't need to get accepted right now. I still need to get all the tests to pass, I had said I would do a pr either today or yesterday so you could review what I have been working on before our meeting on Friday at 8am.
It looks like this gets some errors with test_classify_image. I'm guessing this is because I changed the envi .hdr and .sli files from the spectral v06 to v07 files