function conv_a2p, ang0, date0, arcmin=arcmin, roll=roll, $ hxa=hxa, cmd=cmd, suncenter=suncenter, $ pix_size=pix_size0, radius=radius ; ; if (keyword_set(arcmin)) then ang = ang0*60 else ang = ang0 n = n_elements(ang0) nout = n/2 ; ;-------------------- Get the Date ; if (n_elements(date0) eq 0) then date = anytim2ints(!stime) $ else date = anytim2ints(date0) if ((n_elements(date) ne nout) and (n_elements(date) ne 1)) then begin message, 'Improper number of dates. Using first date for all points.', /info date = date(0) endif ;-------------------- Get the pixel size ; if (keyword_set(pix_size0)) then pix_size = pix_size0 ; if (keyword_set(radius)) then begin ans = get_rb0p(date) sunr = ans(0,*) ravg = total(sunr)/n_elements(sunr) pix_size = ravg / radius end ; if (n_elements(pix_size) eq 0) then pix_size = gt_pix_size() ; ;-------------------- Get the sun center location ; if (n_elements(suncenter) eq 0) then suncenter = sxt_cen(date, hxa=hxa, cmd=cmd, roll=roll0) ; ;-------------------- Get the roll ; if (n_elements(roll) eq 0) then if (n_elements(roll0) ne 0) then roll = roll0 else roll = 0 full_roll = (roll) / !radeg ;rotate the other way to go from angle to pixel ; out = fltarr(2, nout) x0 = suncenter(0,*) & if (n_elements(x0) eq 1) then x0 = x0(0) y0 = suncenter(1,*) & if (n_elements(y0) eq 1) then y0 = y0(0) ; x = ang(0,*) / pix_size ;convert to pixels y = ang(1,*) / pix_size ;convert to pixels out(0,*) = cos(full_roll)*x + sin(full_roll)*y + x0 out(1,*) = -sin(full_roll)*x + cos(full_roll)*y + y0 ; ;-------------------- Finish up ; ; return, out end