c c------------------------------------------------------------------ c Begin file /home/sting/foster/gonz/mkuvmag.f c------------------------------------------------------------------ c subroutine mkuvmag(rlat,rlon,alt,un,vn,unmag,vnmag,spval) c c Find neutral wind in magnetic coords c c On input: c rlat,rlon = geographic lat,lon grid point c alt = desired altitude (passed to igrf) c un,vn = neutral zonal and meridional wind at geog lat,lon c On output: c unmag,vnmag are defined c parameter(pi=3.14159, dtr=pi/180.) data yeargrf /1985./ c c Use igrf model (from library /FOSTER/lib/igrf.a) to find geomagnetic c coords and declination and inclination (see sting dir ~/igrf/ymp): c call igrf(rlat,rlon,alt,yeargrf,gmaglat,gmaglon,dinc,decl) decr = decl*dtr cosd = cos(decr) sind = sin(decr) if (un.ne.spval.and.vn.ne.spval) then unmag = un*cosd - vn*sind vnmag = un*sind + vn*cosd else unmag = spval vnmag = spval endif c return end