8000 Enhancement acf plot input check by ksterne · Pull Request #292 · vtsuperdarn/davitpy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on May 13, 2020. It is now read-only.

Enhancement acf plot input check #292

Merged
merged 3 commits into from
Jan 17, 2017
Merged

Conversation

ksterne
Copy link
Contributor
@ksterne ksterne commented Dec 15, 2016

This is a small update for maybe something larger that we should strive for with davitpy routines. Here I've added a first cut at input santiziation/checks for two of the acfPlot.py routines. I've also added a few small PEP8 edits from doing a check on this file. Must have missed these earlier.

To test this run:

from davitpy import pydarn
from datetime import datetime
myPtr = pydarn.sdio.radDataOpen(datetime(2012,5,21), \
                                      'kap',fileType='fitacf')
myBeam = myPtr.readRec()
pydarn.plotting.acfPlot.plot_acf(myBeam,'24')

and

from davitpy import pydarn
from datetime import datetime
myPtr = pydarn.sdio.radDataOpen(datetime(2012,5,21), \
                                         'kap',fileType='fitacf')
myBeam = myPtr.readRec()
pydarn.plotting.acfPlot.plot_rli(myBeam)

which have been shamelessly stolen from the examples in each routine (with a few minor tweaks to break things). I guess conversely, you could run the unit test of python acfPlot.py and see that I haven't broken anything. With the example though, you'll see the routines crash at some random point in the develop branch. Whereas with this enhancement, you'll see you get some error messages from the assert lines.

@asreimer
Copy link
Contributor

This is excellent @ksterne. I also totally agree that we should be doing proper input checking in all of our routines. Users will thank us later and it will also save us time in the long run because people won't be able to "break" the code using weird inputs.

I'm testing this just now.

@asreimer
Copy link
Contributor

Alright, I've tested this and I don't see any problems. It's nice that it's throwing errors as expected!

Since this pull request isn't super big, I'm going to merge it.

@asreimer asreimer merged commit e03fdc0 into develop Jan 17, 2017
@asreimer asreimer deleted the enhancement-acfPlot_input_check branch January 17, 2017 00:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0