DRAFT Documentation for "sunypak" programs DRAFT Any bugs in either code or this "documentation" should be reported to David Knight at knight@atmos.albany.edu Please also return any modifications and improvements you make. To install this package: Create a directory to hold the programs Download packed programs to this directory Move to that directory Unpack the programs - zcat sunypak.tar.Z | tar xfv - Sunypak performs a number of calculations using GEMPAK grid files as input and output. Sunypak currently works properly only on conformal grids with uniform vertical spacing. Interp will interpolate from a lot-lon grid to the required conformal grid. All configuration and running of sunypak is controlled by two scripts, interp and sunypak. Interp: The script 'interp' contols two programs that allow you to interpolate from a latitude-longitude grid to a conformal projection and/or interpolate to uniform 50 mb vertical spacing. The script should be pretty much self explanatory. The programs attempt to read 'UWND' or 'UREL', 'VWND' or 'VREL', 'HGHT', 'RELH', 'TMPK', and 'OMEG'. Any of these parameters present in the GEMPAK grid file 'gfile1' are interpolated to 50mb intervals if 'interp' = t. Any of these parameters present in the GEMPAK grid file 'gfile1' are interpolated to conformal grid and placed in 'gfile2' if 'lcc' = t (winds are changed to grid relative urel and vrel). The gempak program 'gdinfo' can be used to get grid dimensions if you do not already know them. Some comments on the various projection (set proj) options: 1) Lambert Conformal (proj=1): (standard for limited area maps of the midlatitudes). This projection has two true latitudes, and to minimize distortion (and keep map factors close to unity), it is best to have these values bounding the area of interest. For typical midlatitude work polat=60 and eqlat=30 work well. This is the most frequently used and well tested projection 2) Polar Stereographic (proj=2): (best for hemispheric maps centered on the north or south pole). This projection only uses one true latitude value (polat); the other is ignored. For map factor purposes, GEMPAK automatically assumes that the true latitude is the pole (+/- 90 degrees), so specifying polat other than the pole can create an inconsistency between the grid spacing and the map factors. If you want to perform calculations (with SUNYPAK for example), and you interpolate using a polat value other than 90, make sure your map factors are consistent in the other calculations. The usual formula for the map factor is (1 + sin (true lat))/(1 + sin (lat)), but gempak usues 1/(1 + sin (lat)). ***The specification of the central latitude is IMPORTANT for polar stereographic grids. The center latitude MUST be +/- 90 or the fields won't be interpolated to the proper location (get a substantial offset from their true geographic positions).*** 3) Mercator (proj=3): (typically used only in the tropics) As with Polar Stereographic, only the value of polat is used. Also, GEMPAK assumes that the grid scale is true at the equator, so specifying polat to anything but zero requires modification of map factors in diagnostic calculations. The grid does not need to be centered on the equator. We have never used this projection for any serious work, so although some checks were performed to see that it was interpolated properly, it should be used with care. This projection is probably not suitable for sunypak as it is now since sunypak uses QG and ageostrophic winds which aren't really appropriate near the equator. If you attempt to interpolate to a grid that extends beyond the lat-lon data, the program will stop and tell which side (north, south, east, and/or west) that your grid extends beyond. Tweak jx, jy, ds, clat, or clon to alleviate this problem. Warning: Over time, bugs have arisen and been fixed (hopefully). When interpolating to a grid for the first time, do a simple check and look at a 300 hPa map of geopotential height and wind vectors. Make sure the vectors look proper (winds roughly parallel to heights, westerly flow), and maybe check to see that scalar features line up with the original lat-lon grid. Scalar fields don't seem to have any problems, but in the past there have been problems with the vector fields, particularly when the grid straddles the Dateline or the Greenwich Meridian. Checking this up front can save a lot of frustration down the road. Sunypak: The script 'sunypak' does the bulk of the calculations. Again, the script itself should be fairly self explanatory. if mapfac = t then the following grids are added to you GEMPAK file: (These need to be added if they are not already there, perhaps this requirement will be removed in a future version) MSFX - x component of mapscale factor MSFY - y component of mapscale factor LATR - Latitude of grid points LONR - Longitude of grid points if qvect = t, the following grids are needed in your GEMPAK grid file: MSFX - x component of mapscale factor MSFY - y component of mapscale factor LATR - Latitude of grid points LONR - Longitude of grid points HGHT - Geopotential height TMPK - Temperature degK UREL - U component of wind relative to grid VREL - V component of wind relative to grid if qvect = t, the following grids are added to your GEMPAK grid file: THTA - potential temperature UAGE - x componentof ageo. wind VAGE - y component of ageo. wind UGEO - x component of geo. wind VGEO - y component of geo. wind - note, above calculated using constant f from center of grid as opposed to GEMPAK method where f at each grid point is used XQVC - x comp. of q vector YQVC - y component of q vector XQVN - x component of q_n - q_n is the component of the q vector normal to THTA YQVN - y component of q_n XQVS - x component of q_s - q_s is the component of the q vector parallel to THTA YQVS - y component of q_s DIVQ - divergence of q vector DVQN - divergence of q_n DVQS - divergence of q_s VOR1 - vorticity DIVC - divergence of ageostrophic wind VRAG - vorticity of ageostrophic wind OMG1 - kinematic vertical velocity KDIV - divergence of ageostrophic wind (after using O'Brien correction) KOMG - kinematic omega using "O'Brien" method DPVR - Dry potential vorticity QGOM - total QG omega QGOS - QG omega forced by q_s QGON - QG omega forced by q_n if partition = t, the following grids are needed in your GEMPAK grid file: MSFX - x component of mapscale factor MSFY - y component of mapscale factor LATR - Latitude of grid points LONR - Longitude of grid points UREL - U component of wind relative to grid VREL - V component of wind relative to grid UGEO - x comp. of geo. wind VGEO - y comp, of geo. wind UAGE - x comp. of ageo. wind VAGE - y comp. of ageo. wind - Note, the above should be calculated using constant f - which is done when qvect = t if partition = t, the following grids are added to your GEMPAK grid file: PSIR - streamfunction of the ageostrophic wind PHID - velocity potential of the ageostrophic wind UIRR - x component of irrotational wind = d(phi)/dx VIRR - y component of irrotational wind = d(phi)/dy UNDI - x component of nondivergent wind = -d(psi)/dy VNDI - y component of nondivergent wind = d(psi)/dx if (BC .eq. 0 .or. BC .eq. 2) then PHIH - velocity potential of "harmonic" wind UHVP - "harmonic" wind calculated from velocity potential VHVP - "harmonic" wind calculated from velocity potential if (BC .eq. 1 .or. BC .eq. 2) then PSIH - streamfunction of "harmonic" wind UHAR - "harmonic" wind calculated from streamfunction VHAR - "harmonic" wind calculated from streamfunction if psivec = t, the following grids are needed in your GEMPAK grid file: MSFX - x component of mapscale factor MSFY - y component of mapscale factor LATR - Latitude of grid points LONR - Longitude of grid points HGHT - Geopotential height OMEG, KOMG, or QGOM - Vertical velocity, used as forcing to obtain psi vector if psivec = t, the following grids are added to your GEMPAK grid file: PSIX - x component of psi vector PSIY - y component of psi vector VCHI - velocity potential - used to calculate psi vector WPSI - omega derived from the psi vector Some useful references for this stuff include: Keyser, D., B.D. Schmidt, and D.G. Duffy, 1992: Quasigeostrophic vertical motions diagnosed from along-and cross-isentrope components of Q Vector, Mon. Wea. Rev., 120, 731-741. Loughe, A., C.-C. Lai, D. Keyser, 1995: A technique for diagnosing three-dimensional ageostrophic circulations in baroclinic disturbances on limited-area domains, Mon. Wea. Rev, 123, 1476-1504.