# L_TO_THETA: Convert a zonal mode picture (l,t) to real space (t,theta) # by generating the Legendre polynomials at equal increments of theta. include procedure t_l_to_theta() char inname[SZ_FNAME] # Input file name. char outname[SZ_FNAME] # Output file name. real dtheta # Increment in colatitude. real degrees_per_radian# Conversion constant. int ntheta # Number of output points in theta. pointer im_in # To input image. pointer im_out # To output image. int lmax # Maximum degree. pointer pl # To array of Legendre polynomials. int line # Index to input line. pointer inline # To input line data. pointer outline # To output line data. int itheta # Index to theta real clgetr() # Cl get parameter, real. int clgeti() # Cl get parameter, int. pointer immap() # Image open. pointer imgl2r() # Image get line real. pointer impl2r() # Image put line real. real adotr() # Dot product of two vectors, real. begin # Cl input. call clgstr ("input", inname, SZ_FNAME) call clgstr ("output", outname, SZ_FNAME) degrees_per_radian = 45. / atan (1.0) dtheta = clgetr ("dtheta") / degrees_per_radian ntheta = clgeti ("ntheta") # Setup Legendre polynomial image. im_in = immap (inname, READ_ONLY, 0) lmax = IM_LEN(im_in,1) - 1 call malloc (pl, (lmax+1)*ntheta, TY_REAL) call plgen (Memr[pl], lmax+1, ntheta, dtheta) # Setup output image. im_out = immap (outname, NEW_COPY, im_in) IM_LEN(im_out,1) = ntheta # Do the calculation. for (line=1; line<=IM_LEN(im_in,2); line=line+1) { inline = imgl2r (im_in, line) outline = impl2r (im_out, line) for (itheta=0; itheta