vtsuperdarn/davitpy — pull request #93 by asreimer (2014-09-11 22:11:37+00:00)
Title: Fix and feature: channel in radDataTypes.py

This pull request is intended to replace https://github.com/vtsuperdarn/davitpy/pull/91

Fixed bug in `__init__` where the UAF channel wasn't being handled properly. Cached files weren't named with the channel in them. Also added a `channel == 'all'` option so that all channels for a particular radar can be pulled at once (addressing issue https://github.com/vtsuperdarn/davitpy/issues/88). Also added testing code for the channel option.

An important change to note is that code in radDataPtr.readRec() and in radBaseData.updateValsFromDict() was changed such that we now expose the value of `channel` stored in a dmap file (specifically a fit type file). `channel` in a fit type file specifies if the radar was operating in STEREO mode or not. By clobbering this value, we aren't able to read STEREO files and then check if `channel ` is 1 (indicating STEREO mode). Instead, we would have to check if `channel` is a or b which may be confused with the UAF naming convention. AFAIK, this does not break any backwards compatibility. This change can be rolled back if need be.

To test these changes, try this from within davitpy:
myPtr = pydarn.sdio.radDataOpen(datetime(2014,6,24),'kod',eTime=datetime(2014,6,24,2),channel='all',fileType='fitex')
myPtr = pydarn.sdio.radDataOpen(datetime(2014,6,24),'kod',eTime=datetime(2014,6,24,2),channel='c',fileType='fitex')
myPtr = pydarn.sdio.radDataOpen(datetime(2014,6,24),'kod',eTime=datetime(2014,6,24,2),channel='d',fileType='fitex')
myPtr = pydarn.sdio.radDataOpen(datetime(2012,11,1),'fhe',eTime=datetime(2012,11,1,4),fileType='fitacf')

and note the concatenated file names. The first 3 test the `channel != None` and the last checks `channel == None`.

You may also test this pull request by executing `python radDataTypes.py` from a fresh terminal.