Routines that should work: fcurl, fdiv, fgrad, fsfvp, rws, flaplacian, fpoisson_solver. The pros contain code like:
exe='sfvp1.'+!version.os+'.exe'To make this work you need to compile the obvious code appropriately and probably mv the resultant .exe to include the os in the file name. You'll also need to replace
@comm_error dir='/users/icd/wmc/wave/pros/sfvp1/'in the code. Get rid of comm_error (unless you use the UKMO stuff) and replace dir= with whereever you've put your compiled fortran code.
The main purpose of this was the Rossby Wave Source term stuff: RWS: see below. But the routines here would also be useful if you just want gradients, laplacians etc of PP fields on the sphere. If you use this, read the cautions...
SPHEREPACK page: http://www.scd.ucar.edu/css/software/spherepack/
NOTE (this caused me so much pain...) that spherepack uses a slightly different wind-component-sign-convention: the NS one is the negative of what I/UKMO normally use. Ie, the first component is easterly (as usual): a +ve wind is blowing from W to E; but the second component is such that a +ve wind is blowing from N to S. REMEMBER THIS! In practice, this means that all NS components need to be negated before being handed to spherepack, and then (if the result is a wind) the NS component negated on return.
new_field=pp_regrid(era_field,get_orog(),/pole)
My code: sfvp.f compiled by compile1_sfvp and then used by IDL prog fsfvp.
test_sfvp1. Uses a real ERA 850 hPA field. The result is:
which seems to show we've got it right. It also checks that div(rot_wind) is nearly zero (yes) and curl(div_wind) too (yes).
ALSO: since v_rot = k ^ grad(stream function), one can test this by taking grad (using fgrad.pro), then using kcross.pro, then computing fsfvp on the result, and you should be back to where you started. And you are.
See: rws for more.
My code: curl.f compiled by compile1_curl and then used by IDL prog fcurl.
@test_poisson
z=get_field('test-1',nf=3)
gettwogifs,out='test-1'