-
Notifications
You must be signed in to change notification settings - Fork 11
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
Enable user-specified output directories in Proj #105
Conversation
@spencerahill I was a bit clumsy getting the tests configured properly (it took me a while to realize how to set up the paths to the test data on Travis), but I think I've got things working. Let me know if you're on board with how I made the changes in Calc, and if you're good with the test structure. Thanks! |
eedd44d
to
1113015
Compare
@spencerahill just so you know, I just rebased / squashed the commits offline to clean up the commit message |
8dc72e0
to
faa273f
Compare
|
||
class TestBasicCalc(unittest.TestCase): | ||
def setUp(self): | ||
print os.getcwd() |
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.
Did you want to keep this in? If so, include from __future__ import print_function
and then use print(os.getcwd())
for Python 3 compatibility.
Strange, something with my local setup is causing errors when I try to run the new test (even though they're working on Travis): https://gist.github.com/spencerahill/90e751781812266f21dfdd01d3a4a426 I have seen that I'll have to come back to this. |
@spencerahill How did you go about setting up your environment? One thing that stands out immediately is that it seems it doesn't have dask installed, which is required for a call that gets made to Addressing the import errors may fix everything (the failed tests are simply due to the fact that files are not produced, because of errors upstream -- the import errors could account for all of that since all the calculations start by reading in grid files). That said, you seem to be using python 3.5 and until now we didn't have Travis set up to test in that environment. I added that to our set up, but as you can see, there are issues with imports of the test aospy object libraries within the test modules that prevent the tests even from being fully collected (for python 3.5 but not python 2.7). I'm not sure what's causing that (in your local environment that doesn't seem to have been a problem). |
@spencerahill Things seem to be working as we'd expect now for python 3.5; all I needed to do was switch from implicit relative imports to explicit ones in import models to this: from . import models The only thing is that there are now some "unexpected success" tests in the |
Let's just remove the decorator. Probably at some point I screwed up the division logic, saw the tests were failing and slapped it on, and then forgot to change the tests whenever it was fixed again! |
Yes, sorry, this was my rookie mistake...borrowing my wife's computer and apparently forgot to install netCDF4. I'm now getting 100% passing tests on 2.7 and 3.5 with the aforementioned expected failures fix. That resolved, will finally turn to the actual substance of what you've done! |
self._save_files(data, dtype_out_time) | ||
if save_tar_files: | ||
self._save_tar_files(dtype_out_time) | ||
logging.info('\t{}'.format(self.path_out[dtype_out_time])) | ||
|
||
def _load_from_scratch(self, dtype_out_time, dtype_out_vert=False, |
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.
Let's rename this too... _load_from_disk
? All "scratch" references should be gone.
@@ -897,7 +897,7 @@ def _load_from_scratch(self, dtype_out_time, dtype_out_vert=False, | |||
|
|||
def _load_from_archive(self, dtype_out_time, dtype_out_vert=False): |
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.
Let's rename _load_from_tar
. Is any of this logic unique to /archive other than the dmget
call? For the time being, add a try/except guard around the dmget call here as well, in case anybody tries using this from outside GFDL.
There must be a python version dependence here though, since it fails in python 2.7, but not python 3.5? Maybe just skip them and fix things in a later PR? |
Sorry, yet more rookie environment mistakes! I didn't have pytest installed for 2.7, and didn't realize that even though I had One thing to keep in mind is that separate |
Final comment, then let's merge: directory naming; let's rename Another nice piece of work @spencerkclark, despite my best efforts to confuse you! Thanks, as always I really appreciate it. |
Good thoughts, I have modified things accordingly. Perhaps the edits I needed to make to the path names to allow for this directory structure are not the most idiomatic, but they get the job done. @spencerahill, if you're cool with those, I think we're all set! |
TST Add simple tests and verify that results files are produced TST Add tests for reg.av and reg.ts calcs TST Remove unnecessary print statement TST Add python 3.5 test environment TST Switch to explicit relative imports in test_objs Remove all references to scratch and archive in method names TST Skip version dependent constant division operator tests TST Refactor test objs into single module and rename directories
3cbb864
to
3ce1802
Compare
Awesome. Sorry, one last nit: let's make the example object names more explicit: |
Awesome, thanks @spencerkclark! |
This PR provides the quick fix discussed in #103. It also adds local test data files, which add some basic test coverage to Calc and also verify that output files are saved to the right places.