FUNCTION movie_map_images, astruct, vname, CENTERLONLAT=CENTERLONLAT,$
THUMBSIZE=THUMBSIZE, FRAME=FRAME, $
XSIZE=XSIZE, YSIZE=YSIZE, GIF=GIF, REPORT=REPORT,$
TSTART=TSTART, TSTOP=TSTOP, NONOISE=NONOISE,$
MOVIE_FRAME_RATE=MOVIE_FRAME_RATE, MOVIE_LOOP=MOVIE_LOOP, $
CDAWEB=CDAWEB, DEBUG=DEBUG, COLORBAR=COLORBAR, LIMIT=LIMIT
top = 255
bottom = 0
common colors, r_orig, g_orig, b_orig, r_curr, g_curr, b_curr
if n_elements(movie_frame_rate) eq 0 then movie_frame_rate = 3
if n_elements(movie_loop) eq 0 then movie_loop = 1
w = where(tag_names(astruct) eq strupcase(vname),wc)
if (wc eq 0) then begin
print,'ERROR=No variable with the name:',vname,' in param 1!' & return,-1
endif else vnum = w[0]
projection='MLT'
Zvar = astruct.(vnum)
if keyword_set(COLORBAR) then COLORBAR=1L else COLORBAR=0L
if COLORBAR then xco=80 else xco=0
if (n_elements(LIMIT) gt 0) then begin
if keyword_set(LIMIT) then LIMIT = 1L else LIMIT = 0L
endif else LIMIT=1L
if (keyword_set(CDAWEB)) then CDAWEB = 1L else CDAWEB=0L
print, 'In movie_map_images, LIMIT = ',LIMIT
a = tagindex('FUNCTION',tag_names(astruct.(vnum)))
func = ''
log10Z = 0
if(a[0] ne -1) then begin
func= astruct.(vnum).(a[0])
if (strupcase(func) eq 'CONVERT_LOG10') then log10Z = 1
endif
if keyword_set(REPORT) then reportflag=1L else reportflag=0L
foreground = !d.table_size-1
a = size(astruct.(vnum))
if (a[n_elements(a)-2] ne 8) then begin
print,'ERROR= 1st parameter to plot_images not a structure' & return,-1
endif else begin
a = tagindex('DAT',tag_names(astruct.(vnum)))
if (a[0] ne -1) then idat = astruct.(vnum).DAT $
else begin
a = tagindex('HANDLE',tag_names(astruct.(vnum)))
if (a[0] ne -1) then handle_value,astruct.(vnum).HANDLE,idat $
else begin
print,'ERROR= 1st parameter does not have DAT or HANDLE tag' & return,-1
endelse
endelse
endelse
a = tagindex('DISPLAY_TYPE',tag_names(astruct.(vnum)))
if(a[0] ne -1) then display= astruct.(vnum).DISPLAY_TYPE $
else begin
print, 'ERROR= No DISPLAY_TYPE attribute for variable'
endelse
ipts=parse_display_type(display)
keywords=str_sep(display,'>')
map_proj = 6
fill_cont = 0
wc=where(keywords eq 'MAP_PROJ')
if(wc[0] ne -1) then map_proj = fix(keywords[wc[0]+1])
proj_names =["", "stereographic projection","orthographic projection","lambertconic projection",$
"lambertazimuthal projection", "gnomic projection", "azimuthal equidistant projection",$
"satellite projection", "cylindrical projection", "mercator projection", $
"molleweide projection", "sinusoidal projection", "aitoff projection", "hammeraitoff projection", $
"albers equal area conic projection", "transverse mercator projection", $
"miller cylindrical projection", "robinson projection", "lambertconic ellipsoid projection", $
"goodes homolosine projection"]
if (n_elements(map_proj) gt 0) then begin
projection = proj_names[map_proj]
if keyword_set(DEBUG) then print, 'Requested ',projection
endif
tip = tagindex('PROJECT',tag_names(astruct.(vnum)))
if (tip ne -1) then project=astruct.(vnum).project else project = ' '
proj = strmid(project,0,3)
if (project eq 'TIMED') then begin
white_background = 1
if(map_proj eq 9) then central_azimuth = 90 else central_azimuth = 0
endif
tip = tagindex('DESCRIPTOR',tag_names(astruct.(vnum)))
if (tip ne -1) then begin
descriptor=str_sep(astruct.(vnum).descriptor,'>')
endif
if keyword_set(WHITE_BACKGROUND) then begin
foreground = 2
white_background = 1
endif else begin
foreground = !d.table_size-1
white_background = 0
endelse
fillcount = 0
zfill = 2000
if ((proj eq 'GPS') and (descriptor[0] eq 'roti15min')) then begin
white_background = 1
foreground = 2
a = tagindex('FILLVAL',tag_names(astruct.(vnum)))
if (a[0] ne -1) then begin & b=size(astruct.(vnum).FILLVAL)
if (b[0] eq 0) then zfill = astruct.(vnum).FILLVAL $
else begin
zfill = 2000
print,'WARNING=Unable to determine Image fill value for ',vname
endelse
endif
endif
a = tagindex(strtrim(ipts[0],2),tag_names(astruct))
if(a[0] ne -1) then begin
a1=tagindex('DAT',tag_names(astruct.(a[0])))
if(a1[0] ne -1) then glat = astruct.(a[0]).DAT $
else begin
a2 = tagindex('HANDLE',tag_names(astruct.(a[0])))
if (a2[0] ne -1) then handle_value,astruct.(a[0]).HANDLE,glat $
else begin
print,'ERROR= 2nd parameter does not have DAT or HANDLE tag'
return,-1
endelse
endelse
endif else begin
print, 'ERROR= GLAT variable missing from structure in map image'
return, -1
endelse
a = tagindex(strtrim(ipts[1],2),tag_names(astruct))
if(a[0] ne -1) then begin
a1=tagindex('DAT',tag_names(astruct.(a[0])))
if(a1[0] ne -1) then glon = astruct.(a[0]).DAT $
else begin
a2 = tagindex('HANDLE',tag_names(astruct.(a[0])))
if (a2[0] ne -1) then handle_value,astruct.(a[0]).HANDLE,glon $
else begin
print,'ERROR= 3rd parameter does not have DAT or HANDLE tag'
return,-1
endelse
endelse
endif else begin
print, 'ERROR= GLON variable missing from structure in map image'
return, -1
endelse
wcg=where(glon gt 180.0,wcgn)
if(wcgn gt 0) then glon[wcg]=glon[wcg]-360.0
if(n_elements(keywords) ge 2) then begin
wc=where(strupcase(keywords) eq 'NORTH')
if(wc[0] ne -1) then begin
NORTH = 1 & CENTERPOLE = 1
endif else begin
NORTH = 0 & CENTERPOLE = 0
endelse
wc=where(strupcase(keywords) eq 'SOUTH')
if(wc[0] ne -1) then begin
SOUTH = 1 & CENTERPOLE = 1
endif else begin
SOUTH = 0 & CENTERPOLE = 0
endelse
if (NORTH or SOUTH)then begin
CENTERPOLE = 1
endif else begin
wc=where(strupcase(keywords) eq 'CENTERPOLE')
if(wc[0] ne -1) then CENTERPOLE = 1 else CENTERPOLE = 0
endelse
wcn=where(strupcase(keywords) eq 'SUN',wc)
if(wcn[0] ge 0) then SUN = 1L else SUN = 0L
wcn=where(strupcase(keywords) eq 'TERMINATOR',wc)
if(wcn[0] ge 0) then TERMINATOR = 1L else TERMINATOR = 0L
wcn=where(keywords eq 'FIXED_IMAGE',wc)
if(wcn[0] ge 0) then FIXED_IMAGE = 1L else FIXED_IMAGE = 0L
wcn=where(keywords eq 'MLT_IMAGE',wc)
if(wcn[0] ge 0) then MLT_IMAGE = 1L else MLT_IMAGE = 0L
endif
if(MLT_IMAGE) then TERMINATOR=0L
if((FIXED_IMAGE) and (descriptor[0] eq "UVI")) then begin
handle_value,astruct.system.HANDLE,sys
handle_value,astruct.dsp_angle.handle, dsp
handle_value,astruct.filter.handle, filt
handle_value,astruct.gci_position.handle, gpos
handle_value,astruct.attitude.handle, attit
endif
b = astruct.(vnum).DEPEND_0 & c = tagindex(b[0],tag_names(astruct))
d = tagindex('DAT',tag_names(astruct.(c)))
if (d[0] ne -1) then edat = astruct.(c).DAT $
else begin
d = tagindex('HANDLE',tag_names(astruct.(c)))
if (d[0] ne -1) then handle_value,astruct.(c).HANDLE,edat $
else begin
print,'ERROR= Time parameter does not have DAT or HANDLE tag' & return,-1
endelse
endelse
a = tagindex('SOURCE_NAME',tag_names(astruct.(vnum)))
if (a[0] ne -1) then b = astruct.(vnum).SOURCE_NAME else b = ''
a = tagindex('DESCRIPTOR',tag_names(astruct.(vnum)))
if (a[0] ne -1) then b = b + ' ' + astruct.(vnum).DESCRIPTOR
a = tagindex('DATA_TYPE',tag_names(astruct.(vnum)))
if (a[0] ne -1) then begin
b = b + ' ' + astruct.(vnum).DATA_TYPE
d_type = strupcase(str_sep((astruct.(vnum).DATA_TYPE),'>'))
endif
a = tagindex('FIELDNAM',tag_names(astruct.(vnum)))
if (a[0] ne -1) then b = b + ' ' + astruct.(vnum).FIELDNAM
window_title = b
if keyword_set(nonoise) then window_title=window_title+'!CContsrained values within >3-sigma from mean of all plotted values'
if(COLORBAR) then begin
a=tagindex('UNITS',tag_names(astruct.(vnum)))
if(a[0] ne -1) then ctitle = astruct.(vnum).UNITS else ctitle=''
a=tagindex('LABLAXIS',tag_names(astruct.(vnum)))
if(a[0] ne -1) then ctitle = astruct.(vnum).LABLAXIS + ' in ' + ctitle
endif
if keyword_set(XSIZE) then xs=XSIZE else xs=512
if keyword_set(YSIZE) then ys=YSIZE else ys=512
if (project eq 'TIMED') then begin
xs = 600 & ys = 600
endif
isize= size(idat)
if (isize[0] eq 2) then n_images=1 else n_images=isize[isize[0]]
if (n_images eq 1) then FRAME=1
if keyword_set(FRAME) then begin
if ((FRAME ge 1)AND(FRAME le n_images)) then begin
print, 'ERROR= Single movie frame found'
print, 'STATUS= Single movie frame; select longer time range.'
return, -1
endif
endif else begin
if(n_images gt 200 and LIMIT) then begin
print, 'ERROR= Too many movie frames '
print, 'STATUS= Movies limited to 200 frames; select a shorter time range.'
return, -1
endif
isize = size(idat)
if (isize[0] eq 2) then begin
nimages = 1 & npixels = double(isize[1]*isize[2])
endif else begin
nimages = isize[isize[0]] & npixels = double(isize[1]*isize[2]*nimages)
endelse
if NOT keyword_set(TSTART) then start_frame = 0 $
else begin
w = where(edat ge TSTART,wc)
if wc eq 0 then begin
print,'ERROR=No image frames after requested start time.' & return,-1
endif else start_frame = w[0]
endelse
if NOT keyword_set(TSTOP) then stop_frame = nimages $
else begin
w = where(edat le TSTOP,wc)
if wc eq 0 then begin
print,'ERROR=No image frames before requested stop time.' & return,-1
endif else stop_frame = w[wc-1]
endelse
if (start_frame gt stop_frame) then no_data_avail = 1L $
else begin
no_data_avail = 0L
if ((start_frame ne 0)OR(stop_frame ne nimages)) then begin
idat = idat[*,*,start_frame:stop_frame]
if (size(glat, /n_dimensions) eq 3) then begin
glat = glat[*,*,start_frame:stop_frame]
endif else begin
gsize = size(glat)
tmplat = make_array(gsize[1],nimages, type=gsize[2])
for recs = 0, nimages-1 do tmplat[*,recs]=glat
glat = tmplat
endelse
if (size(glon, /n_dimensions) eq 3) then begin
glon = glon[*,*,start_frame:stop_frame]
endif else begin
gsize = size(glon)
tmplon = make_array(gsize[1],nimages, type=gsize[2])
for recs = 0, nimages-1 do tmplon[*,recs]=glon
glon = tmplon
endelse
isize = size(idat)
if (isize[0] eq 2) then nimages = 1 else nimages = isize[isize[0]]
edat = edat[start_frame:stop_frame]
endif
endelse
label_space = 12
if (no_data_avail eq 0) then begin
wlat=where(glat lt -90.0, wlatc)
if(wlatc gt 0) then idat[wlat] = 0
wlon=where(glon lt -180.0, wlonc)
if(wlonc gt 0) then idat[wlon] = 0
a = tagindex('VALIDMIN',tag_names(astruct.(vnum)))
if (a[0] ne -1) then begin & b=size(astruct.(vnum).VALIDMIN)
if (b[0] eq 0) then zvmin = astruct.(vnum).VALIDMIN $
else begin
zvmin = 0
print,'WARNING=Unable to determine validmin for ',vname
endelse
endif
a = tagindex('VALIDMAX',tag_names(astruct.(vnum)))
if (a[0] ne -1) then begin & b=size(astruct.(vnum).VALIDMAX)
if (b[0] eq 0) then zvmax = astruct.(vnum).VALIDMAX $
else begin
zvmax = 2000
print,'WARNING=Unable to determine validmax for ',vname
endelse
endif
if keyword_set(DEBUG) then begin
print, 'Image valid min and max: ',zvmin, ' ',zvmax
wmin = min(idat,MAX=wmax)
print, 'Actual min and max of data',wmin,' ', wmax
endif
w = where((idat lt zvmin),wc)
white = w
if wc gt 0 then begin
print,'WARNING=setting ',wc,' fill values in image data to background...'
good = where (idat ge zvmin, gc)
if (gc gt 0) then idat[w] = min(idat[good]) else idat[w] = zvmin
w = 0
if wc eq npixels then print,'WARNING=All data outside min/max!!'
endif
w = where((idat gt zvmax),wc)
if wc gt 0 then begin
if keyword_set(DEBUG) then print,'WARNING=setting ',wc,' fill values in image data to red...'
diff = zvmax - zvmin
coffset = red_offset(GIF=GIF,diff)
print, 'diff = ',diff, ' coffset = ',coffset
idat[w] = zvmax - coffset
w = 0
if wc eq npixels then print,'WARNING=All data outside min/max!!'
endif
if keyword_set(NONOISE) then begin
print, 'before semiminmax min and max = ', zvmin, zvmax
semiMinMax,idat,zvmin,zvmax,/MODIFIED
w = where((idat lt zvmin),wc)
if wc gt 0 then begin
print,'WARNING=filtering values less than 3-sigma from image data...'
idat[w] = zvmin
w = 0
endif
w = where((idat gt zvmax),wc)
if wc gt 0 then begin
print,'WARNING=filtering values greater than 3-sigma from image data...'
diff = zvmax - zvmin
coffset = red_offset(GIF=GIF,diff)
print, 'diff = ',diff, ' coffset = ',coffset
idat[w] = zvmax - coffset
w = 0
endif
endif
idmax=max(idat) & idmin=min(idat)
if keyword_set(DEBUG) then begin
print, '!d.table_size = ',!d.table_size
print, 'min and max after filtering = ',idmin, ' ', idmax
endif
if (log10Z) then begin
above1 = where(idat gt 1.0, wc)
if(wc gt 0) then idmin = min(idat[above1]) else idmin = zvmin
endif
idat = bytscl(idat,min=idmin, max=idmax, top=!d.table_size-2)
fill = where (idat eq zfill, fillcount)
if keyword_set(DEBUG) then print, 'Number of values eq to the fill value being set to the background color = ',fillcount
if(white_background and n_elements(white) gt 0) then idat[white] = !d.table_size-1
if(white_background and fillcount gt 0) then idat[fill] = !d.table_size-1
if keyword_set(DEBUG) then begin
bytmin = min(idat, max=bytmax)
print, 'min and max after bytscl = ',bytmin, ' ', bytmax
endif
if keyword_set(GIF) then begin
GIF1 = GIF + "junk"
deviceopen,6,fileOutput=GIF1,sizeWindow=[xs+xco,ys+40]
if white_background then begin
mapcolor = foreground
erase
endif
print, 'MGIF=', gif
endif else begin
endelse
xmargin=!x.margin
irow=0
icol=0
for j=0,nimages-1 do begin
if(white_background) then begin
erase
endif
if COLORBAR then begin
if (!x.omargin[1]+!x.omargin[1]) lt 14 then !x.omargin[1] = 14
!x.omargin[1] = 14
plot,[0,1],[0,1],/noerase,/nodata,xstyle=4,ystyle=4
endif
if (size(glat, /n_dimensions) eq 3) then clat=glat[*,*,j] else clat = glat
cond = (clat gt -90.1) and (clat lt 90.1)
wgoo=where(cond,wgoon)
if(wgoon gt 0) then clat=clat[wgoo]
wn=where(clat gt 0.01, wzn)
ws=where(clat lt -0.01, wzs)
if(wzn ge wzs) then begin
if(wzn ne 0) then begin
centerlat=clat[wn[wzn/2]]
endif else begin
if (size(glat, /n_dimensions) eq 3) then centerlat=glat[mid1,mid2,j]
endelse
endif else begin
if(wzs ne 0) then centerlat=clat[ws[wzs/2]]
endelse
if (NORTH) then centerlat = 90.0
if (SOUTH) then centerlat = -90.0
if(CENTERPOLE) then begin
oosz=size(glat)
xdim=oosz[1]
ydim=oosz[2]
for li=0,xdim-1 do begin
if(centerlat gt 0.0) then begin
CENTERLONLAT=[180.0,90.0]
btpole=90.0
if(descriptor[0] eq "VIS") then btlat=30.0 else btlat=40.0
if (proj eq 'GPS' and (descriptor[0] ne 'roti15min')) then btlat = 0.0
if (size(glat, /n_dimensions) eq 3) then begin
wlat=where(glat[li,*,j] lt btlat,wlatc)
if(wlatc gt 0) then glat[li,wlat,j]=-1.0e+31
endif
if (size(glat, /n_dimensions) eq 2 and (li eq 0)) then begin
wlat=where(glat[*,j] lt btlat,wlatc)
if(wlatc gt 0) then glat[wlat,j]=-1.0e+31
endif
endif else begin
CENTERLONLAT=[180.0,-90.0]
btpole=-90.0
if(descriptor[0] eq "VIS") then btlat=-30.0 else btlat=-40.0
if (proj eq 'GPS' and (descriptor[0] ne 'roti15min')) then btlat = 0.0
if (size(glat, /n_dimensions) eq 3) then begin
wlat=where(glat[li,*,j] gt btlat,wlatc)
if(wlatc gt 0) then glat[li,wlat,j]=-1.0e+31
endif
if (size(glat, /n_dimensions) eq 2 and (li eq 0)) then begin
wlat=where(glat[*,j] gt btlat,wlatc)
if(wlatc gt 0) then glat[wlat,j]=-1.0e+31
endif
endelse
endfor
endif
if(SUN) then begin
SUN,IYR,IDAY,IHOUR,MIN,ISEC,GST,SLONG,SRASN,SDEC,epoch=edat[j]
p=[cos(sdec)*cos(srasn),cos(sdec)*sin(srasn),sin(sdec)]
geigeo,p[0],p[1],p[2],xgeo,ygeo,zgeo,1,epoch=edat[j]
sunln=atan2d(ygeo,xgeo)
sunlt=atan2d(zgeo,sqrt(xgeo*xgeo+ygeo*ygeo))
sunln=sunln+180
if(sunln gt 180.0) then sunln = sunln - 360.0
if(centerlat gt 0.0) then CENTERLONLAT=[sunln,90.0] else $
CENTERLONLAT=[sunln,-90.0]
endif
if(TERMINATOR) then begin
SUN,IYR,IDAY,IHOUR,MIN,ISEC,GST,SLONG,SRASN,SDEC,epoch=edat[j]
p=[cos(sdec)*cos(srasn),cos(sdec)*sin(srasn),sin(sdec)]
geigeo,p[0],p[1],p[2],xgeo,ygeo,zgeo,1,epoch=edat[j]
sunlon=atan2d(ygeo,xgeo)
sunlat=atan2d(zgeo,sqrt(xgeo*xgeo+ygeo*ygeo))
s=terminator(sunlat,sunlon)
endif
if(CENTERPOLE) then begin
if(MLT_IMAGE) then begin
msz=size(glat)
xdim=msz[1]
ydim=msz[2]
mlat=fltarr(xdim,ydim)
mlon=fltarr(xdim,ydim)
galt=120.0+6378.16
cdf_epoch, edat[j], yr,mn,dy,hr,min,sec,milli,/break
ical,yr,doy,mn,dy,/idoy
sod=long(hr*3600.0+min*60.+sec)
for li=0,xdim-1 do begin
for lj=0,ydim-1 do begin
dum2 = float(glat[li,lj,j])
dum3 = float(glon[li,lj,j])
opos = eccmlt(yr,doy,sod,galt,dum2,dum3)
mlat[li,lj]=opos[1]
mlon[li,lj]=opos[2]*15.0
if(descriptor[0] eq "UVI" or descriptor[0] eq "VIS") then begin
if (centerlat gt 0) then begin
CENTERLONLAT=[180.0,90.0]
if (mlat[li,lj] lt 40.0) then idat[li,lj,j]=0
endif else begin
CENTERLONLAT=[180.0,-90.0]
if (mlat[li,lj] gt -40.0) then idat[li,lj,j]=0
endelse
endif
endfor
endfor
if(descriptor[0] eq "UVI" or descriptor[0] eq "VIS") then begin
if centerlat gt 0 then thisrangelonlat=[40.,-180.,90.,180.] else $
thisrangelonlat=[-90.,-180.,-40.,180.]
endif
mag_lt=mlon-180.D0
wcg=where(mag_lt ge 180.D0,wcgn)
if(wcgn gt 0) then mag_lt[wcg]=mag_lt[wcg]-360.D0
wcg=where(mag_lt lt -180.D0,wcgn)
if(wcgn gt 0) then mag_lt[wcg]=mag_lt[wcg]+360.D0
auroral_image, idat[*,*,j], mag_lt, mlat, method="PL",/mltgrid,$
centerLonLat=CENTERLONLAT, /nocolorbar,/CENTERPOLE,proj=map_proj, $
fillValue=-1.0e+31,$
rangeLonLat=thisrangelonlat,mapcolor=mapcolor,$
SYMSIZE=0.5, mapCharSize=0.5, status=status, MLINETHICK=2, GLINETHICK=1.5
if(status lt 0) then begin
print, 'MLT Auroral_image failed, status = ',status
return, -1
endif
endif else begin
method = "PL"
proj = strmid(project,0,3)
imagedata = idat[*,*,j]
if (proj eq 'GPS') then begin
if (descriptor[0] ne 'roti15min')then method = "PO"
longitude = glon[*,j]
latitude = glat[*,j]
endif else begin
longitude = glon[*,*,j]
latitude = glat[*,*,j]
endelse
auroral_image, imagedata, longitude, latitude, method=method,/grid,$
centerLonLat=CENTERLONLAT, /nocolorbar,/CENTERPOLE,proj=map_proj,$
/CONTINENT,fillValue=-1.0e+31,SYMSIZE=0.5,label=2,mapcolor=mapcolor,$
rangeLonLat=[btlat,-180.,btpole,180.],status=status, MLINETHICK=2, GLINETHICK=1.5
projection='azimuthal projection'
endelse
endif else begin
if(FIXED_IMAGE) then begin
if(descriptor[0] eq 'UVI') then begin
att=double(attit[*,j])
orb=double(gpos[*,j])
if(sys[j] lt 0) then system=sys[j]+3 else system=sys[j]
filter=fix(filt[j])-1
dsp_angle=double(dsp[j])
xpos1=30.
ypos1=60.
nxpix=200
nypix=228
xpimg = nypix*1.6
ypimg = nypix*1.6
x_img_org = xpos1 + ( (xs - xpimg)/6 )
x_img_org = xpos1+30.
y_img_org = ypos1 + ( (ys - ypimg)/6 )
y_img_org = ypos1
pos = [x_img_org, y_img_org,x_img_org+xpimg, y_img_org+ypimg]
grid_uvi,orb,att,dsp_angle,filter,system,idat[*,*,j],pos,xpimg,ypimg,$
edat[j],s,nxpix,nypix,/GRID,/CONTINENT,/POLE,/TERMINATOR,$
/LABEL,SYMSIZE=1.0,/device
endif else begin
xpos1=40.
ypos1=40.
xpimg=xs-60
ypimg=ys-60
x_img_org = xpos1
y_img_org = ypos1
pos = [x_img_org, y_img_org,x_img_org+xpimg, y_img_org+ypimg]
if(centerlat gt 0.0) then begin
grid_map,glat[*,*,j],glon[*,*,j],idat[*,*,j],pos,s,xpimg,ypimg,$
/LABEL,/GRID,c_thick=1.0,/POLE_N,/device,c_charsize=1.5
endif else begin
grid_map,glat[*,*,j],glon[*,*,j],idat[*,*,j],pos,s,xpimg,ypimg,$
/LABEL,/GRID,c_thick=1.0,/POLE_S,/device,c_charsize=1.5
endelse
endelse
projection='rendered projection'
endif else begin
if (map_proj eq 8 and project eq 'TIMED') then begin
CenterLonLat=[0.,-90]
endif
method = "PL"
proj = strmid(project,0,3)
imagedata = idat[*,*,j]
if (proj eq 'GPS') then begin
if (descriptor[0] ne 'roti15min') then method = "PO"
longitude = glon[*,j]
latitude = glat[*,j]
nogrid = 1
endif else begin
longitude = glon[*,*,j]
latitude = glat[*,*,j]
nogrid = 0
endelse
auroral_image, imagedata, longitude, latitude, $
method=method, nogrid=nogrid, centerLonLat=CENTERLONLAT, proj=map_proj,$
/nocolorbar, position=position,fillValue=-1.0e+31,SYMSIZE=0.5,$
status=status,label=2, central_azimuth=central_azimuth, $
rangelonlat=thisrangelonlat, mapcolor=mapcolor, /continents, $
MLINETHICK=2, GLINETHICK=1.5
endelse
endelse
if(NOT FIXED_IMAGE) then begin
if(TERMINATOR) then plots,s.lon,s.lat,color=foreground,thick=1.0
endif
edate = decode_cdfepoch(edat[j])
shortdate = strmid(edate, 10, strlen(edate))
project_subtitle,astruct.(0),window_title,/IMAGE,TIMETAG=edat[j],$
TCOLOR=foreground
if COLORBAR then begin
if (n_elements(cCharSize) eq 0) then cCharSize = 0.
cscale = [idmin, idmax]
xwindow = !x.window
!y.window[1]=!y.window[1]
!x.window[1]=0.858
!y.window=[0.1,0.9]
offset = 0.01
colorbar, cscale, ctitle, logZ=0, cCharSize=cCharSize, $
position=[!x.window[1]+offset, !y.window[0],$
!x.window[1]+offset+0.02, !y.window[1]],$
fcolor=foreground, /image
!x.window = xwindow
endif
image = tvrd()
tvlct, r,g,b, /get
write_mgif, GIF, image, r, g, b, delay=(100/movie_frame_rate), loop=movie_loop
if keyword_set(GIF) then device, /close
endfor
write_mgif, GIF, /close
if (map_proj ne 9) then begin
if(CENTERPOLE) then begin
if(SUN) then $
print, 'MESSAGE= POLE CENTERED MAP IMAGES - Fixed Sun (Geo. pole = white dot; N or S = hemisphere)' else $
print, 'MESSAGE= MLT MAP IMAGES (GM pole = white dot; N or S = hemisphere)'
endif else begin
if(FIXED_IMAGE) then $
print, 'MESSAGE= MAP OVERLAY (Geo. pole = white dot; N or S = hemisphere)'$
else $
print, 'MESSAGE= MAP IMAGES (Geo. pole = white dot; N or S = hemisphere)'
endelse
endif
!x.margin=xmargin
if keyword_set(GIF) then deviceclose
endif else begin
print,'STATUS=No data in specified time period.'
if keyword_set(GIF) then begin
xyouts,xs/2,ys/2,/device,alignment=0.5,color=foreground,$
'NO DATA IN SPECIFIED TIME PERIOD'
deviceclose
endif else begin
xyouts,xs/2,ys/2,/device,alignment=0.5,'NO DATA IN SPECIFIED TIME PERIOD'
endelse
endelse
endelse
if keyword_set(GIF) then device,/close
return,0
end