X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 31 May 2016 11:17 AM by  anon
Unpredictable text behaviour while mapping
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:7
New Member


--
31 May 2016 11:17 AM
    I have run into a problem while making maps with many symbols on them. The included code runs fine for a few time steps but then will start to produce maps like the attached with all text blacked out. It appears to be somewhat random. I've broken the code into small pieces to try and debug the possible reason, but so far I have not found it. Any insight would be much appreciated. plotCols = 1 plotRows = 1 colorBarToggle = REPLICATE(0,plotCols,plotRows) colorBarToggle[*,-1] = 1 layoutManager,plotCols,plotRows,$ MARGIN=[0.05,0.05,0.98,0.95],$ POSITIONS=pos,$ PADDINGWIDTH=0.00,$ PADDINGHEIGHT=0.06,$ COLORBARTOGGLE=colorBarToggle,$ COLORBARPADDINGABOVE=0.05,$ COLORBARPADDINGBELOW=0.01,$ /CENTERCOLORBAR,$ COLORBARHEIGHT=0.00,$ COLORBARPOSITIONS=colorBarPos w = WINDOW(DIMENSIONS=[500,500], BUFFER=1) s=0 position=get_pos(pos, s/2, s mod 2) IF maskit[nvars] eq 1 THEN begin work(WHERE(veg_mask EQ 14 OR veg_mask EQ 15))=!VALUES.f_nan img1 = image(discrete_rgba_image(work[*,*], levs, rgb1, /FILL_OFF_RAMP), $ rcm_x_ll, rcm_y_ll, GRID_UNITS=1, /current,$ POSITION=position,$ FONT_SIZE=maxTextSize) ENDIF ELSE BEGIN img1 = image(discrete_rgba_image(work[*,*], levs, rgb1, /FILL_OFF_RAMP), $ rcm_x_ll, rcm_y_ll, GRID_UNITS=1, /current,$ POSITION=position,$ FONT_SIZE=maxTextSize) endelse plot_region_idl8_plot_edges, img1, grid_edges, axisThickness, COLOR='black' draw_frame_around_image, img1, THICK=axisThickness plot_region_idl8_plot_edges,img1, grid_edges_all, axisThickness, COLOR='black' plot_region_idl8_plot_edges,img1, province_grid_edges_all, axisThickness, COLOR='black' tickname=string(levs,format=frmt) c=(mypos[2]-mypos[0])/2.0 myColorBarPos = [c -.35,.1,c +.25,.13] if vars[nvar] ne 'fire' and n eq 11 then begin cb1 = COLORBAR(POSITION=myColorBarPos, RGB_TABLE=rgb1, tickname=tickname, $ BORDER=1, FONT_SIZE=7, THICK=axisThickness, TAPER=1) colorbar_annotation, cb1, CB_TITLE='', units=units, unit_alignment=0, unit_offset = -8, unit_padding_height = 8 endif if vars [nvars] eq 'SWN' then begin title=mtom[n] tx= mypos[2]- .02 ty=mypos[3]+0.025 t=text( tx, ty, title, alignment=0.5, target=img1) endif ;plot fires etc if vars[nvars] eq 'fire'then begin fbin=findgen(70,increment=0.05, start = 0.05) for nfsize = 0, n_elements(fbin)-2 do begin find1=where(mon_lt_area[*,*,n]ge fbin[nfsize] and mon_lt_area[*,*,n] lt fbin[nfsize+1] and finite(mon_lt_area[*,*,n]), count1) if count1 GT 0 then fsym = symbol(rcm_x_2d[find1], rcm_y_2d[find1], /data, symbol="triangle", SYM_SIZE=fbin[nfsize+1], $ target=img1) find2=where(o_area[*,*,n]ge fbin[nfsize] and o_area[*,*,n] lt fbin[nfsize+1] and finite(o_area[*,*,n]), count2) if count2 GT 0 then fsym = symbol(rcm_x_2d[find2], rcm_y_2d[find2], /data, symbol="+", SYM_SIZE=fbin[nfsize+1], $ target=img1) endfor title=monthname[n] tx= mypos[2]-.00 ty=mypos[3]+0.025 t0=text( tx, ty, title, alignment=0.5, target=img1) ;symbol size key myX = 0 myY = 1 myPos = [.75,.085,.85,.07] centerY = mean([myColorBarPos[1],myColorBarPos[3]]) spacer = 0.06 s1 = SYMBOL(myPos[0]+(spacer*0), centerY, /NORMAL, /CURRENT, SYMBOL='triangle', SYM_SIZE=alog10(1000.) /4.0) t1 = text(myPos[0]+(spacer*0)+0.015, centery+0.002, VERTICAL_ALIGNMENT=0.5, FONT_SIZE=7, '$10^3$', target=img1) s2 = SYMBOL(myPos[0]+(spacer*1), centerY, /NORMAL, /CURRENT, SYMBOL='triangle', SYM_SIZE=alog10(10000.) /4.0) t2 = text(myPos[0]+(spacer*1)+0.015, centery+0.002, VERTICAL_ALIGNMENT=0.5, FONT_SIZE=7, '$10^4$', target=img1) s3 = SYMBOL(myPos[0]+(spacer*2), centerY, /NORMAL, /CURRENT, SYMBOL='triangle', SYM_SIZE=alog10(100000.) /4.0) t3 = text(myPos[0]+(spacer*2)+0.015, centery+0.002, VERTICAL_ALIGNMENT=0.5, FONT_SIZE=7, '$10^5 ha$', target=img1) s4 = SYMBOL(myPos[0]+(spacer*0), centerY-.025, /NORMAL, /CURRENT, SYMBOL='+', SYM_SIZE=alog10(1000.) /4.0) s5 = SYMBOL(myPos[0]+(spacer*1), centerY-.025, /NORMAL, /CURRENT, SYMBOL='+', SYM_SIZE=alog10(10000.) /4.0) s6 = SYMBOL(myPos[0]+(spacer*2), centerY-.025, /NORMAL, /CURRENT, SYMBOL='+', SYM_SIZE=alog10(100000.) /4.0) endif w.save, directory+'test_'+outfilename, resolution=300 w.close

    Deleted User



    Basic Member


    Posts:143
    Basic Member


    --
    13 Jun 2016 02:36 PM
    I tried running your code but it gets stopped at the line that says: layoutManager,plotCols,plotRows,$ MARGIN=[0.05,0.05,0.98,0.95],$ POSITIONS=pos,$ PADDINGWIDTH=0.00,$ PADDINGHEIGHT=0.06,$ COLORBARTOGGLE=colorBarToggle,$ COLORBARPADDINGABOVE=0.05,$ COLORBARPADDINGBELOW=0.01,$ /CENTERCOLORBAR,$ COLORBARHEIGHT=0.00,$ COLORBARPOSITIONS=colorBarPos It is failing because I do not have access the layoutManager routine. To help me better understand your issue, would it be possible for you to put together a small self-contained example program (one that doesn't relay on 3rd party routines)?
    You are not authorized to post a reply.