C=======================================================================C C C SUBROUTINE LLNXTONSL( LTMN, LTMX, LGMN, LGMX, PXPD, * NS, NL, CM ) C C C=======================================================================C C C C This subroutine computes the # of samples and lines in an array C C to span the input minimum and maximum latitude and longitude ranges C C for a spatial resolution of PXPD (pixel/deg) and for a sinusoidal C C map projection. The maximum latitude and minimum longitude C C (defining line 1 and pixel 1 respectively) are held fixed and C C therefore the minimum latitude and maximum longitude need to be C C recomputed. The cental meridian of the sinusoidal map projection C C is also computed. C C C C=======================================================================C C C C Version 1.0 T. Duxbury 20 July 2001 C C C C=======================================================================C C Double precision variables DOUBLE PRECISION * CM, ! Central meridian of map projection, ! areocentric deg * LAT, ! Mars-fixed areocentric latitude, deg * LTMN, LTMX, ! Min & max areocentric latitudes ! of map projection, deg * LGMN, LGMX, ! Min & max areocentric longitudes ! of map projection, deg * PXPD, ! Map projection spatial resolution, ! pixels/deg * RES ! Map projection spatial resolution, ! degs/pixel C Integer variables INTEGER*4 * NS, NL ! # of samples and # of lines needed for ! the sinusoidal map projection C Compute the map projection spatial resolution RES in units of deg/pixel RES = 1.D0 / PXPD C Determine the latitude LAT where the maximum # of pixels are needed C to span from LGMN to LGMX C First check if the entire projection is below the equator IF( LTMN .LT. 0.D0 .AND. LTMX .LE. 0.D0 ) LAT = LTMX ! deg C Then check if the projection is entirely above the equator IF( LTMN .GE. 0.D0 .AND. LTMX .GT. 0.D0 ) LAT = LTMN ! deg C Finally check if the projection spans the equator IF( LTMN .LT. 0.D0 .AND. LTMX .GT. 0.D0 ) LAT = 0.D0 ! deg C Compute the # of samples needed for the map projection having a spatial C resolution of PXPD to span from LGMN to LGMX at latitude = LAT. C Make NS an odd number so that the central meriain will be exactly C along the central sample of each image line of the sinusoidal C map projection. NS = ( LGMX - LGMN ) * DCOSD( LAT ) * PXPD + 1.1D0 NS = 2 * (NS/2) + 1 C Compute central meridian (areocentric longitude) of the map C projection having NS samples which is an odd number. Note the central C is at NS/2+1 and then subtract 1 pixel for the left boundary CM = LGMN + DFLOAT( NS/2+1-1 )*RES/DCOSD( LAT ) ! deg C With LGMN fixed at sample = 1 of the map projection at latitude = LAT, C compute the new maximum longitude at latitude = LAT for NS samples C on that image line for a map projection having a spatial resolution C of RES (deg/pixel). Note: the number of pixels between sample #1 C and sample #NS is NS-1. LGMX = LGMN + DFLOAT( NS-1 )*RES/DCOSD( LAT ) ! deg C Compute the # of lines in the map projection to span LTMN to LTMX at C a spatial resolution of PXPD. Make NL an odd number for to make the C center latitude fall exactly on an image line rather than between C image lines. This is no big deal but chosen for my convenience. NL = ( LTMX - LTMN )*PXPD + 1.1D0 NL = 2 * (NL/2) + 1 C With LTMX fixed at line = 1 of the map projection, compute the new C minimum latitude for the map projection having NL lines and a C spatial resolution of RES (deg/pixel) LTMN = LTMX - DFLOAT(NL-1) * RES RETURN END