Skip to content
This repository has been archived by the owner on May 13, 2020. It is now read-only.

OverlayFan polygon doesn't always close #258

Closed
aburrell opened this issue Jun 10, 2016 · 15 comments
Closed

OverlayFan polygon doesn't always close #258

aburrell opened this issue Jun 10, 2016 · 15 comments
Assignees
Labels

Comments

@aburrell
Copy link
Contributor

When you specify the groundscatter option, you the polygon defining the field of view doesn't close:
han_mlt_fan_clock

@aburrell aburrell added the bug label Jun 10, 2016
@asreimer
Copy link
Contributor

Hey @aburrell, do you have some example code so I can try to reproduce this problem?

Does the same thing happen if you only plot 1 fov, or only if you plot 2?

@aburrell
Copy link
Contributor Author

It’s happened every time I did a groundscatter fov at HAN regardless of the coordinates, number of FOVs, or direction of FOV. I’ll get some example code up at some point.

On 11 Jun 2016, at 04:54, Ashton Reimer notifications@github.com wrote:

Hey @aburrell https://github.com/aburrell, do you have some example code so I can try to reproduce this problem?

Does the same thing happen if you only plot 1 fov, or only if you plot 2?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub #258 (comment), or mute the thread https://github.com/notifications/unsubscribe/AGuC_mGsC0pWINrECh0B9nEt-BKrP7Noks5qKjFlgaJpZM4Iy13t.

@aburrell
Copy link
Contributor Author

Example code:

import datetime as dt
import davitpy
import matplotlib.pyplot as plt
plt.ion()
f = plt.figure()
ax = f.add_subplot(1,1,1)
import mpl_toolkits.basemap as basemap
rad = 'han'
stime = dt.datetime(2006, 10, 1)
hard = davitpy.pydarn.radar.site(code=rad, dt=stime)
m = basemap.Basemap(ax=ax, projection="stere", lon_0=hard.geolon, lat_0=hard.geolat, llcrnrlon=0, llcrnrlat=25, urcrnrlat=70, urcrnrlon=135, resolution="l")
m.drawcoastlines(linewidth=0.5, color="0.6")
m.fillcontinents(color="0.6", alpha=.1)
fov_test = davitpy.pydarn.radar.radFov.fov(site=hard, ngates=75, altitude=350, coords="geo", model="GS", fov_dir="front")
davitpy.pydarn.plotting.overlayFov(m, rad, fovObj=fov_test)

gs_fov_front_only

fov_test = davitpy.pydarn.radar.radFov.fov(site=hard, ngates=75, altitude=350, coords="geo", model="IS", fov_dir="back")
davitpy.pydarn.plotting.overlayFov(m, rad, fovObj=fov_test, fovColor="b")

gs_fov_front_is_back

@asreimer
Copy link
Contributor

asreimer commented Jun 13, 2016

The example code fails due the Basemap not having support for datetime objects needed for coordinate conversion:

davitpy/pydarn/plotting/mapOverlay.pyc in overlayFov(mapObj, codes, ids, names, dateTime, plot_all, maxGate, rangeLimits, beamLimits, model, fov_dir, fovColor, fovAlpha, beams, beamsColors, hemi, fovObj, zorder, lineColor, lineWidth)
    260                     ", not mapObj.dateTime " + str(mapObj.dateTime))
    261     else:
--> 262         dateTime = mapObj.dateTime
    263 
    264     # Load radar structure

AttributeError: 'Basemap' object has no attribute 'dateTime'

Modifying the example code to:

import datetime as dt
import davitpy
import matplotlib.pyplot as plt
plt.ion()
f = plt.figure()
ax = f.add_subplot(1,1,1)
import mpl_toolkits.basemap as basemap
rad = 'han'
stime = dt.datetime(2006, 10, 1)
hard = davitpy.pydarn.radar.site(code=rad, dt=stime)
m = davitpy.utils.mapObj(ax=ax, projection="stere", lon_0=hard.geolon, lat_0=hard.geolat, llcrnrlon=0, llcrnrlat=25, urcrnrlat=70, urcrnrlon=135, resolution="l")
m.drawcoastlines(linewidth=0.5, color="0.6")
m.fillcontinents(color="0.6", alpha=.1)
fov_test = davitpy.pydarn.radar.radFov.fov(site=hard, ngates=75, altitude=350, coords="geo", model="GS", fov_dir="front")
davitpy.pydarn.plotting.overlayFov(m, rad, fovObj=fov_test)

fov_test = davitpy.pydarn.radar.radFov.fov(site=hard, ngates=75, altitude=350, coords="geo", model="IS", fov_dir="back")
davitpy.pydarn.plotting.overlayFov(m, rad, fovObj=fov_test, fovColor="b")

I am able to reproduce the above plot.

Any idea why this is happening?

@aburrell
Copy link
Contributor Author

Ok, thing 1) In the original example I had added:

m.dateTime=stime

Which is why I didn't get an error. But I forgot I added that.

@asreimer
Copy link
Contributor

Ah ok that makes sense. Any idea why the FOV isn't closing on the GS plot?

@aburrell
Copy link
Contributor Author

Ok, I figured it out. The fov object doesn't save the model it used to create the object, so you have to keep specifying it.

@aburrell
Copy link
Contributor Author

We should probably add a model to the fov object and have routines check for it. If it doesn't exist, it can default to IS but spit out a warning.

@aburrell
Copy link
Contributor Author

aburrell commented Jun 13, 2016

In [79]: print fov_test
latCenter: (16, 75)
lonCenter: (16, 75)
latFull: (17, 76)
lonFull: (17, 76)
slantRCenter: (16, 75)
slantRFull: (17, 76)
beams: (16,)
gates: (75,)
coords: geo

^
needs
v
model: GS

@asreimer
Copy link
Contributor

Awesome! And I agree with that fix. Luckily it's a simple fix too :)

@aburrell
Copy link
Contributor Author

Yes...

Unfortunately I'm heading offline since it's 21:30 and I'm still in the office sans dinner :'(

@asreimer
Copy link
Contributor

Yes! Go home and eat. This can wait.

@aburrell aburrell self-assigned this Aug 17, 2016
@aburrell
Copy link
Contributor Author

As promised! Pull request #269

@asreimer
Copy link
Contributor

Excellent! I have some things to do this afternoon, but I'll get it tested and merged tonight.

@asreimer
Copy link
Contributor

Issue resolved.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants