; Procedure Name: to_photo_ful.pro ; by Monica Chen img_name=' ' text=' ' dir_path='/user3/PP/' rgb_file='final.rgb' win_xsize=2048 win_ysize=1024 win_ysize1=win_ysize+win_ysize/2 win_xsize2=win_xsize-1 win_ysize2=win_ysize-1 win_ysize3=win_ysize/2 image=fltarr(win_xsize,win_ysize) image1=fltarr(win_xsize,win_ysize1) name_list=strarr(8) name_list(0)='Annu_Glb_T_Cld_Inh_ful.dat' name_list(1)='Annu_Glb_noT_Cld_Inh_ful.dat' name_list(2)='Annu_Glb_expT_Cld_Inh_ful.dat' name_list(3)='Annu_Glb_expT_cld_inh_test.dat' name_list(4)='Spring_ful.dat' name_list(5)='Summer_ful.dat' name_list(6)='Fall_ful.dat' name_list(7)='Winter_ful.dat' ; Input file read,'Enter your input file name: ',img_name ;;;read,'Enter the text on the image: ',text openr,1,dir_path+img_name readu,1,image close,1 ;image=rotate(image,7) name_Annu=((img_name eq name_list(0)) or (img_name eq name_list(1)) $ or (img_name eq name_list(2)) or (img_name eq name_list(3))) name_Season=((img_name eq name_list(4)) or (img_name eq name_list(5)) $ or (img_name eq name_list(6)) or (img_name eq name_list(7))) ; min and max for seasonal or annual data ; new_max=450000.*name_Annu $ ;for annual images +150000.*name_Season ;for seasonal images if (name_Annu) then rgb_file='annual.rgb' $ ;for annual images else if (name_Season) then rgb_file='new_season.rgb' $ ; for seasonal images else begin print,'Wrong file name!!!' goto,the_end endelse min_image=min(image > 0.) new_min=0. max_image=max(image) new_span=new_max-min_image print,'min_image=',min_image,', max_image=',max_image ;;; Calculate the Integrated Global Productivity ;;cell_area=19.*19. ;;pi=3.141592654 ;;r_constant=pi/180. ;;;cell_area=cell_area*(2048./360.)*(2048./360.) ;;PP_global=0. ;;for j=0,win_ysize2 do begin ;; PP_lat=0. ;; for i=0,win_xsize2 do begin ;; if (image(i,j) gt 0.) then PP_lat=PP_lat+image(i,j) ;; endfor ;; r_lat=(float(j)/float(win_ysize)-0.5)*pi ;; PP_lat=PP_lat*COS(r_lat) ;; PP_global=PP_global+PP_lat ;;endfor ;;PP_global=cell_area*PP_global ;;print, 'Global_Annual_PP=',PP_global ; Transfer file into output format large_PP_count=0. large_PP_count=TOTAL(image gt new_max) image=(image < new_max)+new_max*(image ge new_max) image=((image-min_image)/new_span*252.+1.)*(image gt 0.)+254.*(image lt 0.) image1(0:win_Xsize2,win_ysize3:win_ysize2+win_ysize3)=image(0:win_xsize2,0:win_ysize2) image1(0:win_xsize2,0:win_ysize3-1)=255. ;;;threshold2=float(large_PP_count)/float(win_xsize)/float(win_ysize) ;;;print,'cut-off=',threshold2*100.,'%' ; put the color bar in the image ;bar_start=fix(52./360.*float(win_xsize)+0.5) ;bar_end=fix(307./360.*float(win_xsize)+0.5) ;bar_bottom=fix(40./180.*float(win_ysize)+0.5) ;bar_top=fix(65./180.*float(win_ysize)+0.5) ;for j=bar_start,bar_end do begin ; image1(bar_bottom:bar_top,win_xsize2-j)=float(j-bar_start) $ ; /float(win_xsize)*360. ;endfor bar_start=256 bar_end=win_xsize-256-2 bar_span=win_xsize-2*256 bar_ratio=0. bar_ratio=float(bar_span)/256. bar_bottom=275 bar_top=bar_bottom+80 for i=bar_start,bar_end do begin image1(i,bar_bottom:bar_top)=float(i-bar_start)/bar_ratio endfor min_image=min_image*1.e-3 max_image=max_image*1.e-3 new_max=new_max*1.e-3 new_min=new_min*1.e-3 ; display the image read,'Enter the window number:',wn ;window,wn,color=256,xsize=win_xsize/4,ysize=win_ysize/4,title=img_name window,wn,color=256,xsize=win_xsize/4,ysize=win_ysize1/4,title=img_name restore,rgb_file tvlct,r,g,b ;tvscl,rebin(image1,win_xsize/4,win_ysize1/4,/sample) tv,rebin(image1,win_xsize/4,win_ysize1/4,/sample),/normal text0=string(new_min) text1=string(new_max) text2='(gC/m2)' ;XYouts, 0.97,0.08,color=255,text,size=0.5,font=5,/normal XYouts, 0.43,0.08,color=255,text2,size=0.5,font=5,/normal XYouts, 0.00,0.13,color=255,text0,size=0.5,font=5,/normal XYouts, 0.49,0.13,color=255,'0',size=0.5,font=5,/normal XYouts, 0.65,0.13,color=255,text1,size=0.5,font=5,/normal ; Save the new normalized image ;read,'Enter your new byte output file name: ',img_name openw,2,dir_path+'new_'+img_name writeu,2,byte(image1) close,2 ; Save to a file for plotting from CCD read,'Enter your ps output file name: ',img_name img_name=dir_path+img_name set_plot,'ps' device,filename=img_name,bits=8,/color,/landscape tv,rebin(image1,win_xsize/4,win_ysize1/4),/normal XYouts, 0.44,0.08,color=255,text2,size=2.0,font=5,/normal XYouts, 0.03,0.13,color=255,text0,size=2.0,font=5,/normal XYouts, 0.49,0.13,color=255,'0',size=2.0,font=5,/normal XYouts, 0.75,0.13,color=255,text1,size=2.0,font=5,/normal restore,rgb_file tvlct,r,g,b device,filename='temp.ps' set_plot,'x' $ls -l *.ps ; Save to a file for overhead making in photography read,'Enter your gif output file name: ',img_name img_name=dir_path+img_name WRITE_GIF,img_name,byte(image1),R,G,B the_end: end