PRO overlay_map_sdfov, site=site, force_nhemis=force_nhemis, $
geo_plot=geo_plot, linestyle=linestyle, beams=beams, linecolor=linecolor, $
linethick=linethick, draw_beamnum=draw_beamnum, $
rgrange=rgrange, pixelonly=pixelonly
valid_sites = [ 'hok','ksr','sye','sys','bks','rkn','unw','tig', $
'kod','inv','han','pyk', 'cve', 'cvw', 'fhe', 'fhw', 'sas', 'pgr', $
'gbr', 'kap', 'sto', 'wal', 'ade', 'adw' ]
IF ~KEYWORD_SET(site) THEN BEGIN
PRINT, 'Keyword SITE should be given'
RETURN
ENDIF
stns = thm_check_valid_name( site, valid_sites, /ignore_case, /include_all )
IF STRLEN(stns[0]) EQ 0 THEN BEGIN
PRINT, 'No valid radar name in sites!'
PRINT, 'Data currently available: ',valid_sites
RETURN
ENDIF
FOR i=0, N_ELEMENTS(stns)-1 DO BEGIN
stn = stns[i]
ptbl_vn = (tnames('sd_'+STRLOWCASE(stn)+'_position_tbl_?'))[0]
IF STRLEN(ptbl_vn) LT 10 THEN CONTINUE
get_data, ptbl_vn,data=d
glat=REFORM(d.y[0,*,*,1])
glon=REFORM(d.y[0,*,*,0])
alt = glat & alt[*] = 400
IF ~KEYWORD_SET(geo_plot) THEN BEGIN
aacgmconvcoord,glat,glon,alt,mlat,mlon,err,/TO_AACGM
mlon = (mlon + 360.) MOD 360.
ts = time_struct(!sdarn.sd_polar.plot_time)
yrsec = LONG( alt )
yrsec[*] = LONG((ts.doy-1)*86400L + ts.sod)
yr = yrsec & yr[*] = ts.year
tmlt = aacgmmlt(yr, yrsec, mlon)
tmlt = ( (tmlt + 24. ) MOD 24. ) /24.*360.
if keyword_set(force_nhemis) then mlat = abs(mlat)
ENDIF ELSE BEGIN
mlat = glat & tmlt = glon
ENDELSE
n_rg = N_ELEMENTS(mlat[*,0])-1
n_az = N_ELEMENTS(mlat[0,*])-1
PLOTS,tmlt[0,0:n_az],mlat[0,0:n_az], linestyle=linestyle, color=linecolor, $
thick=linethick
PLOTS,tmlt[0:n_rg,n_az],mlat[0:n_rg,n_az], linestyle=linestyle, color=linecolor, $
thick=linethick
PLOTS,tmlt[n_rg,0:n_az],mlat[n_rg,0:n_az], linestyle=linestyle, color=linecolor, $
thick=linethick
PLOTS,tmlt[0:n_rg,0],mlat[0:n_rg,0], linestyle=linestyle, color=linecolor, $
thick=linethick
if total(size(beams)) gt 0 then begin
for n=0L, n_elements(beams)-1 do begin
bm = beams[n]
if bm ge n_az or bm lt 0 then continue
if ~keyword_set(pixelonly) then begin
PLOTS,tmlt[0:n_rg,bm],mlat[0:n_rg,bm], linestyle=linestyle, color=linecolor, thick=linethick
PLOTS,tmlt[0:n_rg,bm+1],mlat[0:n_rg,bm+1], linestyle=linestyle, color=linecolor, thick=linethick
endif
if keyword_set(draw_beamnum) then begin
xyouts, $
(tmlt[n_rg,bm]+tmlt[n_rg,bm+1])/2, $
(mlat[n_rg,bm]+mlat[n_rg,bm+1])/2, $
'bm'+string(bm,'(I2.2)'), $
alignment=0.5
endif
if keyword_set(rgrange) then begin
rgn = rgrange
if n_elements(rgn) eq 1 then begin
if min(rgn) ge 0 and max(rgn) lt n_rg then begin
PLOTS,tmlt[rgn,bm:(bm+1)],mlat[rgn, bm:(bm+1)], linestyle=linestyle, color=linecolor, thick=linethick
PLOTS,tmlt[rgn+1,bm:(bm+1)],mlat[rgn+1, bm:(bm+1)], linestyle=linestyle, color=linecolor, thick=linethick
PLOTS,tmlt[rgn:(rgn+1), bm], mlat[rgn:(rgn+1), bm], linestyle=linestyle, color=linecolor, thick=linethick
PLOTS,tmlt[rgn:(rgn+1), bm+1], mlat[rgn:(rgn+1), bm+1], linestyle=linestyle, color=linecolor, thick=linethick
endif
endif
if n_elements(rgn) eq 2 then begin
rgn = minmax(rgn)
if rgn[0] ge 0 and rgn[1] lt n_rg then begin
for ii = rgn[0], rgn[1] do begin
PLOTS,tmlt[ii, bm:(bm+1)],mlat[ii, bm:(bm+1)], linestyle=linestyle, color=linecolor, thick=linethick
PLOTS,tmlt[ii+1, bm:(bm+1)],mlat[ii+1, bm:(bm+1)], linestyle=linestyle, color=linecolor, thick=linethick
PLOTS,tmlt[ii:(ii+1), bm], mlat[ii:(ii+1), bm], linestyle=linestyle, color=linecolor, thick=linethick
PLOTS,tmlt[ii:(ii+1), bm+1], mlat[ii:(ii+1), bm+1], linestyle=linestyle, color=linecolor, thick=linethick
endfor
endif
endif
endif
endfor
endif
ENDFOR
RETURN
END