;----------------------------------------------------------------------- pro anim_event,event ; ; Event handler for animation window: ; case event.action of "DONE": begin widget_control,event.top,/destroy return end else: print,'anim_event: Unknown action: ',event.action endcase return end ;----------------------------------------------------------------------- pro pltmaps,info,animate=animate,ps=ps ; map = *info.pmap fields = *info.fields if not keyword_set(animate) and not keyword_set(ps) then begin widget_control,map.draw,get_value=index wset,index erase endif ; ; Call appropriate procedure for current projection: ; index=map.ifield data = *fields[index].data case map.projection of "Cylindrical Equidistant": begin defmapdata,map,data,map.izvert,map.imtime *info.pmap = map pltce,info,animate=animate end "Polar Stereographic": begin defmapdata,map,data,map.izvert,map.imtime *info.pmap = map pltst,info,animate=animate,ps=ps end ;added by Tom Freestone 6/9/03 for Satellite View "Satellite Projection": begin defmapdata,map,data,map.izvert,map.imtime *info.pmap = map pltsv,info,animate=animate end default: print,'>>> WARNING pltmaps: unknown projection ',map.proj endcase end ;----------------------------------------------------------------------- pro mtime_map_event,event ; ; Respond to user selection of a model time: ; widget_control,event.top,get_uvalue=pinfo widget_control,event.id,get_uvalue=mtime_request info = *pinfo fields = *info.fields map = *info.pmap file = *info.pfile imtime = -1 for i=0,file.ntimes-1 do begin mtime_string = $ strcompress(string(file.mtimes[0,i]),/remove_all)+','+ $ strcompress(string(file.mtimes[1,i]),/remove_all)+','+ $ strcompress(string(file.mtimes[2,i]),/remove_all) if mtime_string eq mtime_request then begin imtime = i goto, found endif endfor print,'>>> WARNING mtime_map_event: could not find index to model time ',$ mtime_request return found: map.imtime = imtime map.mtime = file.mtimes[*,imtime] ;data = *fields[map.ifield].data *info.pmap = map pltmaps,info end ;----------------------------------------------------------------------- pro mkproj,map,info,tlb ;created by Tom Freestone 6/11/03 to improve the base that controls the coordinates ;of the plots in the case below:cylindrical equidistant,polar,satellite fields=map.field ;levs pertains to the altitude relative to pressure nlevs=fields[0].nlev levbase = widget_base(map.projbase) levs = *fields[0].levs ;while loop destroys the bases to make room for new ones child =1 while(child ne 0) do begin child=widget_info(map.projbase, /child) if(child ne 0) then begin widget_control,child,/destroy endif endwhile case map.projection of 'Cylindrical Equidistant': begin ;slt slider sltbase = widget_base(map.projbase) levslt=findgen(25) nlevslt=size(levslt,/n_elements) zvert = map.zvert ; default bottom boundary dzvert = levslt[1]-levslt[0] sltslider = cw_fslide(sltbase,minimum=levslt[0],maximum=levslt[nlevslt-1],$ delta=dzvert,xsize=200,format="(f5.2)",value=map.censlt,$ title='SLT(HRS) CENTER X-AXIS',uvalue='SELECT_SLT') ;longitude slider lonbase = widget_base(map.projbase) levlon=indgen(76)*5-185 nlevlon=size(levlon,/n_elements) zvert = map.zvert ; default bottom boundary dzvert = levlon[1]-levlon[0] lonslider = cw_fslide(lonbase,minimum=levlon[1],maximum=levlon[nlevlon-3],$ delta=dzvert,xsize=200,format="(f6.0)",value=map.cenlon,$ title='LON(DEG) CENTER X-AXIS',uvalue='SELECT_LON') if(map.fixpolar eq 'SLT') then begin widget_control, lonslider,/destroy endif if(map.fixpolar eq 'LON') then begin widget_control, sltslider,/destroy endif ; Select perimeter latitude for stereographic via cw slider: lats = *fields[0].lats nlat = n_elements(lats) dlat = lats[1]-lats[0] ; ; Polar dial is either slt or lon: ; fixpolarbase = widget_base(map.projbase,/frame,/exclusive,sensitive=1) ;print,'fixpolarbase=',fixpolarbase fixpolarslt = widget_button(fixpolarbase,value='SLT',$ uvalue='FIXPOLAR_SLT',/no_release) fixpolarlon = widget_button(fixpolarbase,value='LON',$ uvalue='FIXPOLAR_LON',/no_release) ;controls sensitivity of the slt and lon sliders ;controls sensitivity of the slt and lon sliders if(map.fixpolar eq 'LON') then begin widget_control,fixpolarlon, /set_button endif if(map.fixpolar eq 'SLT') then begin widget_control,fixpolarslt, /set_button endif ;pressure slider levbase = widget_base(map.projbase) zvert = map.zvert ; default bottom boundary dzvert = levs[1]-levs[0] levslider = cw_fslide(levbase,minimum=levs[0],maximum=levs[nlevs-1],$ delta=dzvert,xsize=200,format="(f5.1)",value=map.zvert,$ title=fields[0].levname+' ('+fields[0].levunits+')',uvalue='SELECT_LEV') end 'Polar Stereographic': begin levbase = widget_base(map.projbase) zvert = map.zvert ; default bottom boundary dzvert = levs[1]-levs[0] levslider = cw_fslide(levbase,minimum=levs[0],maximum=levs[nlevs-1],$ delta=dzvert,xsize=200,format="(f5.1)",value=levs[0],$ title=fields[0].levname+' ('+fields[0].levunits+')',uvalue='SELECT_LEV') stperim = map.stperim ; Select perimeter latitude for stereographic via cw slider: lats = *fields[0].lats nlat = n_elements(lats) dlat = lats[1]-lats[0] ; ; Polar dial is either slt or lon: ; fixpolarbase = widget_base(map.projbase,/frame,/exclusive,sensitive=1) ;print,'fixpolarbase=',fixpolarbase fixpolarslt = widget_button(fixpolarbase,value='SLT',$ uvalue='POLAR_SLT',/no_release) fixpolarlon = widget_button(fixpolarbase,value='LON',$ uvalue='POLAR_LON',/no_release) if(map.fixpolar eq 'SLT') then begin widget_control,fixpolarslt, /set_button endif if(map.fixpolar eq 'LON') then begin widget_control,fixpolarlon, /set_button endif perimbase = widget_base(map.projbase) wfsl_perimlat = cw_fslide(perimbase,minimum=lats[1],maximum=lats[nlat-2],$ delta=dlat,xsize=200,uvalue="PERIMLAT",format='(f5.1)',value=stperim,$ title='Perimeter Latitude') end 'Satellite Projection': begin ;slt slider sltbase = widget_base(map.projbase) levslt=indgen(25) nlevslt=size(levslt,/n_elements) zvert = map.zvert ; default bottom boundary dzvert = levslt[1]-levslt[0] sltslider = cw_fslide(sltbase,minimum=levslt[0],maximum=levslt[nlevslt-1],$ delta=dzvert,xsize=200,format="(i3)",value=map.censlt,$ title='SLT(HRS) CENTER X-AXIS',uvalue='SELECT_SLT') ;pressure slider levbase = widget_base(map.projbase) zvert = map.zvert ; default bottom boundary dzvert = levs[1]-levs[0] levslider = cw_fslide(levbase,minimum=levs[0],maximum=levs[nlevs-1],$ delta=dzvert,xsize=200,format="(f5.1)",value=map.zvert,$ title=fields[0].levname+' ('+fields[0].levunits+')',uvalue='SELECT_LEV') ;longitude slider lonbase = widget_base(map.projbase) levlon=indgen(76)*5-185 nlevlon=size(levlon,/n_elements) zvert = map.zvert ; default bottom boundary dzvert = levlon[1]-levlon[0] lonslider = cw_fslide(lonbase,minimum=levlon[1],maximum=levlon[nlevlon-3],$ delta=dzvert,xsize=200,format="(f6.0)",value=map.cenlon,$ title='LON(DEG) CENTER X-AXIS',uvalue='SELECT_LON') ; Select perimeter latitude for stereographic via cw slider: lats = *fields[0].lats nlat = n_elements(lats) dlat = lats[1]-lats[0] ;latitude slider levlat=findgen(180)-90.0 nlevlat=size(levlat,/n_elements) perimbase = widget_base(map.projbase) wfsl_perimlat = cw_fslide(perimbase,minimum=levlat[0],maximum=levlat[179],$ xsize=200,uvalue="SELECT_LAT",format='(f5.1)',value=map.cenlat,$ title='Center Latitude') widget_control,perimbase,sensitive=1 ; ; Polar dial is either slt or lon: ; fixpolarbase = widget_base(map.projbase,/frame,/exclusive,sensitive=1) ;print,'fixpolarbase=',fixpolarbase fixpolarslt = widget_button(fixpolarbase,value='SLT',$ uvalue='FIXPOLAR_SLT',/no_release) fixpolarlon = widget_button(fixpolarbase,value='LON',$ uvalue='FIXPOLAR_LON',/no_release) polbase_GEO=widget_info(fixpolarbase,/geometry) erad_xsize=polbase_GEO.xsize+polbase_GEO.xpad ;controls sensitivity of the slt and lon sliders if(map.fixpolar eq 'SLT') then begin widget_control,fixpolarslt, /set_button widget_control, lonslider, sensitive=0 endif if(map.fixpolar eq 'LON') then begin widget_control, sltslider, sensitive=0 widget_control,fixpolarlon, /set_button endif ;earth radius slider eradbase = widget_base(map.projbase) levera=indgen(10)+1*2 nlevera=size(levera,/n_elements) zvert = map.zvert ; default bottom boundary dzvert = levera[1]-levera[0] eraslider = cw_fslide(eradbase,minimum=levera[0],maximum=levera[nlevera-1],$ delta=dzvert,format="(i3)",value=map.erad,$ title='Distance',uvalue='SELECT_ERA',xsize=erad_xsize) end else: print, '>>> Unknown plot type: ', proj endcase end ;----------------------------------------------------------------------- pro maps_event,event widget_control,event.id,get_uvalue=widget widget_control,event.top,get_uvalue=pinfo info = *pinfo fields = *info.fields map = *info.pmap field = map.field data = *fields[map.ifield].data case widget of 'CLOSE': begin widget_control,event.top,/destroy end 'SELECT_LEV': begin nlevs = field.nlev if (nlevs gt 1) then begin levs = *field.levs izvert = -1 for k=0,nlevs-1 do begin if (levs[k] eq event.value) then begin izvert = k endif endfor if (izvert eq -1) then begin print,'>>> WARNING map_event: cannot find index to level ',$ event.value print,' levs = ',levs endif map.zvert = levs[izvert] map.izvert = izvert endif ; ; Reset min,max and contour interval: cmin=0. & cmax=0. & cint=0. defmapdata,map,*fields[map.ifield].data,map.izvert,map.imtime fminmax,*map.data,fmin,fmax,map.missing_value levels = mkclevels(fmin,fmax,cmin,cmax,cint) map.fmin=cmin & map.fmax=cmax & map.cint=cint *map.clevels = levels ; Update state and make map: *info.pmap = map pltmaps,info end ;SELECT_LAT,LON,ERA,SLT redraw the plot with the new parameters 'SELECT_LON': begin map.cenlon=event.value *info.pmap=map pltmaps,info end 'SELECT_LAT': begin map.cenlat=event.value *info.pmap=map pltmaps,info end 'SELECT_ERA': begin map.erad=event.value *info.pmap=map pltmaps,info end 'SELECT_SLT': begin map.censlt=event.value *info.pmap = map pltmaps,info end ;FIXPOLAR_SLT,LON redraw the widgets and plot 'FIXPOLAR_SLT': begin map.fixpolar='SLT' *info.pmap=map mkproj,map,info,0 pltmaps,info end 'FIXPOLAR_LON': begin map.fixpolar='LON' *info.pmap=map mkproj,map,info,0 pltmaps,info end 'PERIMLAT': begin ; Reset min,max and contour interval: cmin=0. & cmax=0. & cint=0. defmapdata,map,*fields[map.ifield].data,map.izvert,map.imtime fminmax,*map.data,fmin,fmax,map.missing_value levels = mkclevels(fmin,fmax,cmin,cmax,cint) map.fmin=cmin & map.fmax=cmax & map.cint=cint *map.clevels = levels ; Update state and make map: map.stperim=event.value *info.pmap = map pltmaps,info end ;modified by Tom Freestone on 6/10/03 to create new widget button heiarchy 'CE': begin ; cylindrical equidistant projection map.projection = 'Cylindrical Equidistant' mkproj,map,info,tlb *info.pmap = map pltmaps,info end 'ST': begin ; polar stereographic projection map.projection = 'Polar Stereographic' mkproj,map,info,tlb *info.pmap = map pltmaps,info end ;added by Tom Freestone 6/9/03 for Satellite View 'SV': begin ; satellite projection map.projection = 'Satellite Projection' mkproj,map,info,tlb map.grid=1 map.grid_color=0 map.continents=1 *info.pmap = map pltmaps,info end 'COLOR': begin ; xloadct,group=event.top,/modal clrtab = xcolor(info.colortab,event.top) info.colortab = clrtab *pinfo = info pltmaps,info end 'CONTINENTS_WHITE': begin map.continents = 1 map.continents_color = !d.table_size-1 *info.pmap = map pltmaps,info end 'CONTINENTS_BLACK': begin map.continents = 1 map.continents_color = 0 *info.pmap = map pltmaps,info end 'CONTINENTS_OFF': begin map.continents = 0 *info.pmap = map pltmaps,info end 'MAPGRID_WHITE': begin map.grid = 1 map.grid_color = !d.table_size-1 *info.pmap = map pltmaps,info end 'MAPGRID_BLACK': begin map.grid = 1 map.grid_color = 0 *info.pmap = map pltmaps,info end 'MAPGRID_OFF': begin map.grid = 0 *info.pmap = map pltmaps,info end 'SET_MINMAX': begin umin=map.fmin & umax=map.fmax setminmax,info,umin,umax map.fmin = umin & map.fmax = umax *info.pmap = map pltmaps,info end 'RESET_MINMAX': begin map.fmin=0. & map.fmax=0. print,'Maps: reset image min,max to full range.' *info.pmap = map pltmaps,info end 'CUSTOM_CONTOUR': begin cmin=map.fmin & cmax=map.fmax & cint=map.cint & clineclr=map.clineclr custom_contour,info.tlb,cmin,cmax,cint,clineclr map.clineclr = clineclr defmapdata,map,*fields[map.ifield].data,map.izvert,map.imtime fminmax,*map.data,fmin,fmax,map.missing_value levels = mkclevels(fmin,fmax,cmin,cmax,cint) map.fmin=cmin & map.fmax=cmax & map.cint=cint *map.clevels = levels *info.pmap = map pltmaps,info end 'RESET_CONTOUR': begin cmin=0. & cmax=0. & cint=0. print,'Maps: reset contour min,max to full range.' defmapdata,map,*fields[map.ifield].data,map.izvert,map.imtime fminmax,*map.data,fmin,fmax,map.missing_value levels = mkclevels(fmin,fmax,cmin,cmax,cint) map.fmin=cmin & map.fmax=cmax & map.cint=cint *map.clevels = levels *info.pmap = map pltmaps,info end 'ANIM_TIME': begin if field.ntime eq 1 then begin print,' ' print,'>>> Cannot animate in time: there is only one time on the file!' widget_control,event.id,sensitive=0 endif else begin widget_control,event.id,/sensitive animate_maps,info,map,'time' endelse end 'ANIM_VERT': begin if field.nlev le 0 then begin print,' ' print,'>>> Cannot animate in vertical: field.nlev=',field.nlev endif else $ animate_maps,info,map,'zvert' end 'SAVE_PS': begin psfile = dialog_pickfile(path=info.openpath,/write,group=event.top) if (psfile ne '') then begin widget_control,event.top,hourglass=1 pson,filename=psfile,margin=1.0 setclrtab,info.colortab,/ps pltmaps,info,/ps psoff widget_control,event.top,hourglass=0 endif end 'SAVE_PNG': writeimage,info.openpath,event.top,'PNG' 'SAVE_GIF': writeimage,info.openpath,event.top,'GIF' 'SAVE_BMP': writeimage,info.openpath,event.top,'BMP' 'SAVE_JPEG': writeimage,info.openpath,event.top,'JPEG' 'SAVE_TIFF': writeimage,info.openpath,event.top,'TIFF' ; 'IMAGE_ONLY': begin map.plottype = 'image_only' *info.pmap = map print,'Set plot type to ',map.plottype pltmaps,info widget_control,map.minmaxmenu,sensitive=1 ; can set image min,max widget_control,map.contourmenu,sensitive=0 ; not doing contours end 'IMAGE+CONTOURS': begin map.plottype = 'image+contours' *info.pmap = map print,'Set plot type to ',map.plottype pltmaps,info widget_control,map.minmaxmenu,sensitive=0 ; image min,max will be fmin,fmax widget_control,map.contourmenu,sensitive=1 ; doing contours end 'MONOCHROME_CONTOURS': begin map.plottype = 'monochrome_contours' *info.pmap = map print,'Set plot type to ',map.plottype pltmaps,info widget_control,map.minmaxmenu,sensitive=0 ; image min,max will be fmin,fmax widget_control,map.contourmenu,sensitive=1 ; doing contours end 'COLORFILL_CONTOURS': begin map.plottype = 'colorfill_contours' *info.pmap = map print,'Set plot type to ',map.plottype pltmaps,info widget_control,map.minmaxmenu,sensitive=0 ; image min,max will be fmin,fmax widget_control,map.contourmenu,sensitive=1 ; doing contours end 'POLAR_SLT': begin map.fixpolar = 'SLT' *info.pmap = map print,'Set polar dial to SLT (local noon at top of polar projection)' pltmaps,info end 'POLAR_LON': begin map.fixpolar = 'LON' *info.pmap = map print,'Set polar dial to LON (longitude 0 at top of polar projection)' pltmaps,info end else: print,'>>> maps_event: unknown widget ',widget endcase end ;----------------------------------------------------------------------- pro field_event,event ; ; User has selected a field. Read field from the file and update ; map structure. ; widget_control,event.top,get_uvalue=pinfo info = *pinfo map = *info.pmap widget_control,event.id,get_uvalue=widget fields = *info.fields for i=0,info.nflds-1 do begin if (widget eq fields[i].name) then begin map.ifield = i if ptr_valid(fields[i].data) then begin ; field has been read print,'Selected field ',fields[i].name fmin = min(*fields[i].data) & fmax = max(*fields[i].data) endif else begin widget_control,/hourglass varget,info,fields[i],ncdata ; print,'field_event after varget: help,ncdata = ' & help,ncdata field = fields[i] ; print,'field_event: read field ',field.name,' field.ntime=',field.ntime,$ ; ' help,ncdata=' & help,ncdata procfield,info,ncdata,field,info.z_hist fields[i] = field if map.izvert lt 0 then begin if fields[i].nlev gt 0 then begin map.izvert = 0 map.zvert = (*field.levs)[map.izvert] widget_control,map.animzvert,sensitive=1 print,'field_event set map.izvert=',map.izvert,' map.zvert=',$ map.zvert print,'field.levs=' & print,*field.levs endif endif *info.pmap = map *info.fields = fields fmin = min(*fields[i].data) & fmax = max(*fields[i].data) rpt_minmax,info,fields[i],fmin,fmax endelse map.field = fields[i] ; data = *fields[map.ifield].data ; defmapdata,map,data,map.izvert,map.imtime cmin=0. & cmax=0. & cint=0. defmapdata,map,*fields[map.ifield].data,map.izvert,map.imtime fminmax,*map.data,fmin,fmax,map.missing_value levels = mkclevels(fmin,fmax,cmin,cmax,cint) map.fmin=cmin & map.fmax=cmax & map.cint=cint *map.clevels = levels endif endfor ;if map.field.nlev le 1 then $ ; widget_control,map.levbase,sensitive=0 $ ;else $ ; widget_control,map.levbase,/sensitive ; ; Update state info: ; *info.pmap = map *pinfo = info pltmaps,info end ; field_event ;----------------------------------------------------------------------- pro maps,info ; file = *info.pfile ; file info structure missing_value = file.missing_value title = 'Maps: '+info.file ;print,'maps: info.groupleader=',info.groupleader ;tlb = widget_base(column=1,mbar=mbar,title=title,group_leader=info.groupleader) tlb = widget_base(column=1,mbar=mbar,title=title) map_ids = *info.pmap_ids for i=0,n_elements(map_ids)-1 do begin if (map_ids[i] le 0) then begin map_ids[i] = tlb ; break ; this does not work, why? goto,done endif endfor done: *info.pmap_ids = map_ids ; ; Projections menu: projmenu = widget_button(mbar,value='Projection') proj = widget_button(projmenu,value='Cylindrical Equidistant',$ uvalue='CE') proj = widget_button(projmenu,value='Polar Stereographic',$ uvalue='ST') ;added by Tom Freeston on 6/9/03 for satellite view proj = widget_button(projmenu,value='Satellite View', $ uvalue='SV') ; ; Fields menu: fieldsmenu = widget_button(mbar,value='Field') fields = *info.fields for i=0,info.nflds-1 do begin button = widget_button(fieldsmenu,value=fields[i].name,$ uvalue=fields[i].name,event_pro='field_event') if (i eq 0) then field = fields[i].name endfor ; ; Model times menu: mtimesmenu = mtime_menu(mbar,file.mtimes,'mtime_map_event') ; ; Plot options: ; optsmenu = widget_button(mbar,value='PlotOptions') ; ; Plot types (submenu under plot options): ; plottype = widget_button(optsmenu,value='Plot Type',/menu) button = widget_button(plottype,$ value='Image Only',uvalue='IMAGE_ONLY') button = widget_button(plottype,$ value='Image plus Contours',uvalue='IMAGE+CONTOURS') button = widget_button(plottype,$ value='Monochrome Contours',uvalue='MONOCHROME_CONTOURS') button = widget_button(plottype,$ value='Color-fill Contours',uvalue='COLORFILL_CONTOURS') ; ; Continents on/off (submenu under plot options): ; continents = widget_button(optsmenu,value='Continents',/menu) button = widget_button(continents,value='Continents White',$ uvalue='CONTINENTS_WHITE') button = widget_button(continents,value='Continents Black',$ uvalue='CONTINENTS_BLACK') button = widget_button(continents,value='Continents Off',$ uvalue='CONTINENTS_OFF') ; ; Map grid on/off (submenu under plot options): ; mapgrid = widget_button(optsmenu,value='Map Grid',/menu) button = widget_button(mapgrid,value='Map Grid White',$ uvalue='MAPGRID_WHITE') button = widget_button(mapgrid,value='Map Grid Black',$ uvalue='MAPGRID_BLACK') button = widget_button(mapgrid,value='Map Grid Off',$ uvalue='MAPGRID_OFF') ; ; Custom Contour: ; contourmenu = widget_button(optsmenu,value='Custom Contour',/menu) button = widget_button(contourmenu,value='Reset to full range',$ uvalue='RESET_CONTOUR') button = widget_button(contourmenu,value='Set min,max,interval...',$ uvalue='CUSTOM_CONTOUR') ; ; Set image min,max: ; minmaxmenu = widget_button(optsmenu,value='Fix Image min,max',/menu) button = widget_button(minmaxmenu,value='Reset to full range',$ uvalue='RESET_MINMAX') button = widget_button(minmaxmenu,value='Set Image min,max...',$ uvalue='SET_MINMAX') ; ; Color tables: ; button = widget_button(optsmenu,value='Color...',uvalue='COLOR') ; ; Animation menu (last of PlotOptions): ; animmenu = widget_button(mbar,value='Animate') button = widget_button(animmenu,value='Animate in time',uvalue='ANIM_TIME') animzvert = widget_button(animmenu,value='Animate in vertical',uvalue='ANIM_VERT') ; ; Save files menu: ; savemenu = widget_button(mbar,value='SaveFiles') button = widget_button(savemenu,value='Postscript...',uvalue='SAVE_PS') button = widget_button(savemenu,value='PNG...',uvalue='SAVE_PNG') button = widget_button(savemenu,value='GIF...',uvalue='SAVE_GIF') button = widget_button(savemenu,value='BMP...',uvalue='SAVE_BMP') button = widget_button(savemenu,value='JPEG...',uvalue='SAVE_JPEG') button = widget_button(savemenu,value='TIFF...',uvalue='SAVE_TIFF') ; projbase = widget_base(tlb,column=3,/frame) nlevs = fields[0].nlev if (nlevs gt 0) then begin izvert = 0 zvert = (*fields[0].levs)[izvert] ; default bottom boundary levs = *fields[0].levs dzvert = levs[1]-levs[0] endif else begin izvert = -1 zvert = missing_value endelse ; ; Select perimeter latitude for stereographic via cw slider: stperim = -27.5 ; ; Draw widget: draw = widget_draw(tlb,xsize=500,ysize=500,uvalue='DRAW_MAP') ; ; Close button: button = widget_button(tlb,value='Close',uvalue='CLOSE') ; ; Set up maps structure. Default to first field at first mtime. ; mtime = file.mtimes[*,0] imtime = 0 map = { $ projection:'Cylindrical Equidistant', $ ; map projection field:fields[0], $ ; current field structure ifield:0, $ ; index to current field zvert:zvert, $ ; vertical level (default bottom boundary) izvert:izvert, $ ; index to zvert (field.levs[izvert]) levs:levs, $ ; pressure levels mtime:mtime, $ ; model time (default first time on file) imtime:imtime, $ ; index to mtime (file.mtimes[imtime]) missing_value:missing_value, $ ; missing data value fixpolar:'SLT', $ ; fix polar proj in either 'slt' or 'lon' projbase:projbase, $ ; map projection options base stperim:stperim, $ ; perimeter latitude for polar proj animzvert:animzvert, $ ; widget id of animate in zvert button draw:draw, $ ; draw widget id censlt:12, $ ; time that slt is centered on erad:5, $ ; earth radius for satellite view cenlat:60.0, $ ; plot latitude of center cenlon:0.0, $ ; plot longitude of center continents:0, $ ; continents on or off (0/1) continents_color:!d.table_size-1, $ ; continents color index (white or black) grid:0, $ ; map grid on or off (0/1) grid_color:!d.table_size-1, $ ; color index of map grid plottype:'image+contours', $ ; 4 options (see plot_type_menu) clineclr:!d.table_size-1, $ ; contour line color minmaxmenu:minmaxmenu, $ ; menu widget for setting image min,max contourmenu:contourmenu, $ ; menu widget for custom contour fmin:0.,fmax:0.,cint:0., $ ; field min,max and contour interval clevels:ptr_new(/allocate_heap),$ ; contour levels lons:ptr_new(/allocate_heap), $ ; longitudes lats:ptr_new(/allocate_heap), $ ; latitudes data:ptr_new(/allocate_heap) $ ; 2d data (lon,lat) } mkproj,map,info,tlb ; ; Read data from first field: ; if ptr_valid(fields[0].data) then begin ; field has been read defmapdata,map,*fields[0].data,map.izvert,map.imtime endif else begin widget_control,/hourglass varget,info,fields[0],ncdata field = fields[0] procfield,info,ncdata,field,info.z_hist fields[0] = field defmapdata,map,*fields[0].data,map.izvert,map.imtime endelse fminmax,*map.data,fmin,fmax,map.missing_value rpt_minmax,info,fields[0],fmin,fmax widget_control,map.minmaxmenu,sensitive=0 ; because default plottype is image+contour ; ; Set contour levels: ; cmin=0. & cmax=0. & cint=0. levels = mkclevels(fmin,fmax,cmin,cmax,cint) map.fmin=cmin & map.fmax=cmax & map.cint=cint *map.clevels = levels ; ; Update state info, realize, and turn over to wmanager: ; *info.fields = fields info.pmap = ptr_new(map) widget_control,tlb,/realize pinfo = ptr_new(info) pltmaps,info widget_control,tlb,set_uvalue=pinfo xmanager,'maps',tlb,/no_block end