vtsuperdarn / davitpy

DEPRECATED The DaViT Python project
http://vtsuperdarn.github.com/davitpy/
GNU General Public License v3.0
37 stars 59 forks source link

[bugfix] Fixed AttributeError problem caused by incorrect ordering of code #259

Closed asreimer closed 8 years ago

asreimer commented 8 years ago

As detailed in issue #255, there was a problem with overlayFan when passing a beamData object. This pull request fixes this issue.

To test the pull request, run the following code (which fails without this pull request as detailed in #255):

import datetime
import os
import davitpy.utils
import matplotlib.pyplot as plt
from davitpy import pydarn
from davitpy.pydarn.plotting import *

sTime = datetime.datetime(2016,5,7,1,36)
eTime = datetime.datetime(2016,5,7,1,41)
radar = 'rkn'
beam = 7
cp=None
filtered=False
src=None
fileType='fitex'
channel=None

myPtr=pydarn.sdio.radDataOpen(sTime,radar,eTime=eTime,channel=channel,bmnum=beam,cp=cp,fileType=fileType,filtered=filtered)
myBeam=pydarn.sdio.radDataReadRec(myPtr)

fig = plt.figure(figsize=(14,12))
ax=fig.add_subplot(111)

mObj=utils.plotUtils.mapObj(dateTime=sTime,lon_0=93.11,lat_0=72.6,showCoords='True',gridLabels='True',grid='True', height=11E6,width=11E6)
mObj.nightshade(sTime,alpha=0.1)
overlayRadar(mObj,codes='rkn',fontSize=12)
overlayFov(mObj,maxGate=75,codes='rkn',lineWidth=2)
site = pydarn.radar.site(radId=myBeam.stid, dt=sTime)
overlayFan(myBeam,mObj,fig,'power',site=site)
fig.show()

Also, run the testing code in fan.py using python fan.py.

MuhammadVT commented 8 years ago

I have reproduced the same error and this pull request does fix the bug. merging it...

On Sat, Jun 11, 2016 at 12:20 AM, Ashton Reimer notifications@github.com wrote:

As detailed in issue #255 https://github.com/vtsuperdarn/davitpy/issues/255, there was a problem with overlayFan when passing a beamData object. This pull request fixes this issue.

To test the pull request, run the following code (which fails without this pull request as detailed in #255 https://github.com/vtsuperdarn/davitpy/issues/255):

import datetime import os import davitpy.utils import matplotlib.pyplot as plt from davitpy import pydarn from davitpy.pydarn.plotting import *

sTime = datetime.datetime(2016,5,7,1,36) eTime = datetime.datetime(2016,5,7,1,41) radar = 'rkn' beam = 7 cp=None filtered=False src=None fileType='fitex' channel=None

myPtr=pydarn.sdio.radDataOpen(sTime,radar,eTime=eTime,channel=channel,bmnum=beam,cp=cp,fileType=fileType,filtered=filtered) myBeam=pydarn.sdio.radDataReadRec(myPtr)

fig = plt.figure(figsize=(14,12)) ax=fig.add_subplot(111)

mObj=utils.plotUtils.mapObj(dateTime=sTime,lon_0=93.11,lat_0=72.6,showCoords='True',gridLabels='True',grid='True', height=11E6,width=11E6) mObj.nightshade(sTime,alpha=0.1) overlayRadar(mObj,codes='rkn',fontSize=12) overlayFov(mObj,maxGate=75,codes='rkn',lineWidth=2) site = pydarn.radar.site(radId=myBeam.stid, dt=sTime) overlayFan(myBeam,mObj,fig,'power',site=site) fig.show()

Also, run the testing code in fan.py using python fan.py.

You can view, comment on, or merge this pull request online at:

https://github.com/vtsuperdarn/davitpy/pull/259 Commit Summary

  • Fixed AttributeError problem caused by incorrect ordering of code.

File Changes

Patch Links:

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/vtsuperdarn/davitpy/pull/259, or mute the thread https://github.com/notifications/unsubscribe/AG1iWyRDOpr5iiMOi6hM33cOIhMbr8DCks5qKjd-gaJpZM4Izd1b .