function ProjectAndMerge,lat,lon,data,valid,bbox=bbox,_extra=extra s=size(data) frames=s[3] ;Size of third dimension (# of frames) type=size(data,/type); if n_elements(valid) eq 0 then valid=intarr(frames)+1 images=ptrarr(frames) bboxes=intarr(frames,4); for i=0,frames-1 do begin if valid[i] gt 0 then begin images[i]=ptr_new(map_patch_lambert(data[*,*,i],lon[*,*,i],lat[*,*,i],bbox=thisbbox,_extra=extra,missing=!values.f_nan)); bboxes[i,*]=thisbbox; end else begin images[i]=ptr_new() end end ProjMg=merge(images,bboxes,bbox=bbox,/replace) ;Free the mallocs! ptr_free,images return,ProjMg end