vtsuperdarn / davitpy

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

mapObj.ax bug #227

Closed asreimer closed 8 years ago

asreimer commented 8 years ago

As I've noted here, I think there is a bug in the mapObj __init__ method.

Running this code, we expect myMap.ax to be None:

myMap = utils.mapObj(boundinglat=30, coords='mag')
print type(myMap)

But running this code, we expect myMap.ax to be a matplotlib.axes object:

from matplotlib import pyplot
fig = pyplot.figure()
ax = fig.add_axes()
myMap = utils.mapObj(ax=ax,boundinglat=30, coords='mag')
print type(myMap)

You'll see that we do not get the result we expect.

The solution is to fix the offending line of code as I noted in the comment I linked to above.

asreimer commented 8 years ago

Confirmed now that this bug actually breaks overlayFov. Try running this code in the current master or develop branch and you'll see what I mean:

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

fig=plt.figure()
SDate=datetime.datetime(2014,7,8,1,15,9)

#the map Object
mObj=utils.plotUtils.mapObj(datetime=SDate,lon_0=-80,lat_0=70,showCoords='True',gridLabels='True',grid='True',height=111E3*40,width    =111E3*40)
mObj.nightshade(SDate,alpha=0.2)
overlayRadar(mObj,codes='sas',fontSize=12)
overlayFov(mObj,maxGate=75,beams=[1,2,3,4,5,6,7,8,9,10,11,12,13],codes='sas',lineWidth=2,beamsColors=['green','green','green','green','green','green','green','green','green','green','green','green','green'])
asreimer commented 8 years ago

Fixed by #239