function fsfvp,pp,noisy=noisy ; Purpose: compute stream function and velocity potential on a sphere ; Category pp fortran ; Inputs: ; pp - vector of (u,v) components of wind ; Outputs: ; [returns] - vector of (sf,vp) ; sf: stream function (rot_ wind=curl(sf)) ; vp: velocity potential (div_ wind=grad(vp)) ; Note: this routine uses SPHEREPACK to do the work. ; see ~wmc/wave/pros/sfvp1/index.html for more info ; The routine will work on alphas ONLY dir='/users/icd/wmc/wave/pros/sfvp1/' rm='rm fort.51 2> /dev/null; ' exe='sfvp1.'+!version.os+'.exe' ; We'll put the result here pp1=pp ; First, prepare the data file for the prog x=xc(pp(0),/arr) y=yc(pp(0),/arr) openw,lun,/get,'fort.52' printf,lun,pp(0).lbnpt,pp(0).lbrow ; *** Note negative on pp(1) - spherepack uses opposite sign convention... for i=0,pp(0).lbrow-1 do for j=0,pp(0).lbnpt-1 do printf,lun,pp(0).data(j,i),-pp(1).data(j,i) close,lun free_lun,lun if (keyword_set(noisy)) then begin print,'Written data file fort.52:' spawn,'ls -l fort.52' endif ; Now run stoat cmd=rm+dir+exe if (keyword_set(noisy)) then print,'About to spawn: '+cmd spawn,cmd,junk if (keyword_set(noisy)) then print,junk ; Read in results data=readfromfile('fort.51') pp1(0).data=data(0,*) pp1(1).data=data(1,*) ; And thats it! return,pp1 end