Index Page
cspice_llgrid_pl02
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X 

Abstract
I/O
Examples
Particulars
Required Reading
Version
Index_Entries

Abstract


   Deprecated: This routine has been superseded by the CSPICE routine
   cspice_latsrf. This routine is supported for purposes of backward
   compatibility only.

   CSPICE_LLGRID_PL02, given the planetocentric longitude and latitude
   values of a set of surface points on a specified target body, compute
   the corresponding rectangular coordinates of those points.  The
   target body's surface is represented by a triangular plate model
   contained in a type 2 DSK segment.

   For important details concerning this module's function, please refer to
   the CSPICE routine llgrid_pl02.

I/O


   Given:

      handle      the DAS file handle of a DSK file open for read
                  access. This kernel must contain a type 2 segment
                  that provides a plate model representing the entire
                  surface of the target body.

      dladsc      the DLA descriptor of a DSK segment representing
                  the surface of a target body.

      npoints     is the number of longitude/latitude pairs in the array
                  of grid points `grid'.

      grid        an array of planetocentric longitude/latitude pairs
                  to be mapped to surface points on the target body.

                  Elements

                     grid[0,i]
                     grid[1,i]

                  are, respectively, the planetocentric longitude and
                  latitude of the ith grid point.

                  Units are radians.

   the call:

      cspice_llgrid_pl02, handle, dladsc, npoints, grid, spoints, plateIDs

   returns:

      spoints     an array containing the rectangular (Cartesian)
                  coordinates of the surface points on the target body,
                  expressed relative to the body-fixed reference frame of
                  the target body, corresponding to the input grid points.

      plateIDs    an array of integer ID codes of the plates on which
                  the surface points are located. The ith plate ID
                  corresponds to the ith surface point. These ID codes can
                  be use to look up data associated with the plate, such
                  as the plate's vertices or outward normal vector.

Examples


   Any numerical results shown for this example may differ between
   platforms as the results depend on the SPICE kernels used as input
   and the machine specific arithmetic implementation.

  In the following example program, the file

      phobos.3.3.bds

   is a DSK file containing a type 2 segment that provides a plate model
   representation of the surface of Phobos.

   Find the surface points on a target body corresponding to a given
   planetocentric longitude/latitude grid.

      PRO llgrid_pl02_t, dsk

         ;;
         ;; Constants
         ;;
         NLAT     =  9
         NLON     =  9
         MAXGRID  =  NLAT * NLON
         TOL      =  1.d-12

         ;;
         ;; Open the DSK file for read access.
         ;; We use the DAS-level interface for
         ;; this function.
         ;;
         cspice_dasopr, dsk, handle

         ;;
         ;; Begin a forward search through the
         ;; kernel, treating the file as a DLA.
         ;; In this example, it's a very short
         ;; search.
         ;;
         cspice_dlabfs, handle, dladsc, found

         if ~found then begin

            ;;
            ;; We arrive here only if the kernel
            ;; contains no segments. This is
            ;; unexpected, but we're prepared for it.
            ;;
            message, 'No segments found in DSK file ', dsk

         endif

         ;;
         ;; If we made it this far, DLADSC is the
         ;; DLA descriptor of the first segment.
         ;;
         ;; Now generate the grid points.  We generate
         ;; points along latitude bands, working from
         ;; north to south.  The latitude range is selected
         ;; to range from +80 to -80 degrees.  Longitude
         ;; ranges from 0 to 320 degrees.  The increment
         ;; is 20 degrees for latitude and 40 degrees for
         ;; longitude.
         ;;

         grid = dblarr(2,MAXGRID)
         n    = 0L

         for  i = 0, (NLAT-1) do begin

            lat = cspice_rpd() * ( 80.d0 - 20.d0*i )

            for  j = 0, (NLON-1) do begin

               lon = cspice_rpd() * 40.d*j

               grid[0,n] = lon
               grid[1,n] = lat

               n = n + 1

            endfor

         endfor

         npoints = n -1

         ;;
         ;; Find the surface points corresponding to the grid points.
         ;;
         cspice_llgrid_pl02, handle, dladsc, npoints, grid, $
                             spoints, plateIDs

         ;;
         ;; fprintf out the surface points in latitudinal
         ;; coordinates and compare the derived lon/lat values
         ;; to those of the input grid.
         ;;
         for  i = 0, npoints-1 do begin

            ;;
            ;; Use recrad_c rather than reclat_c to produce
            ;; non-negative longitudes.
            ;;
            cspice_recrad, spoints[*,i], xr, xlon, xlat

            print, 'Intercept for grid point  ', i 
            print, '   Plate ID:              ', plateIDs[i] 
            print, '   Cartesian Coordinates: ', spoints[*,i]
            print, '   Latitudinal Coordinates:'
            print, '   Longitude (deg): ', xlon * cspice_dpr() 
            print, '   Latitude  (deg): ', xlat * cspice_dpr() 
            print, '   Radius     (km): ', xr 
            print

            print, 'Original grid coordinates:' 
            print, '   Longitude (deg): ', grid[0,i] * cspice_dpr() 
            print, '   Latitude  (deg): ', grid[1,i] * cspice_dpr() 
            print

            ;;
            ;; Perform sanity checks on the intercept
            ;; coordinates.  Stop the program if any error
            ;; is larger than our tolerance value.
            ;;
            lon = grid[0,i]
            lat = grid[1,i]

            if ( abs(xlat-lat) gt TOL ) then begin

               message, 'Latitude error!' 

            endif

            if ( abs(xlon - lon) gt cspice_pi() ) then begin

               if ( xlon gt lon ) then begin
                  xlon = xlon - cspice_twopi()
               endif else begin
                  xlon = xlon + cspice_twopi()
               endelse

            end

            if  ( abs(xlon - lon)  gt TOL ) then begin

               message, 'Longitude error!' 

            endif

         end

         ;;
         ;; Close the kernel. 
         ;;
         cspice_dascls, handle

      END

   IDL outputs:

      IDL> llgrid_pl02_t, 'phobos_3_3.bds'
      Intercept for grid point         0
         Plate ID:                    306238
         Cartesian Coordinates:        1.5208779    0.0000000    8.6253271
         Latitudinal Coordinates:
         Longitude (deg):        0.0000000
         Latitude  (deg):        80.000000
         Radius     (km):        8.7583867
      
      Original grid coordinates:\n
         Longitude (deg):        0.0000000
         Latitude  (deg):        80.000000
      
      Intercept for grid point         1
         Plate ID:                    317112
         Cartesian Coordinates:        1.1897036   0.99827989    8.8077718
         Latitudinal Coordinates:
         Longitude (deg):        40.000000
         Latitude  (deg):        80.000000
         Radius     (km):        8.9436459
      
      Original grid coordinates:
         Longitude (deg):        40.000000
         Latitude  (deg):        80.000000
      
      Intercept for grid point         2
         Plate ID:                    324141
         Cartesian Coordinates:       0.27777518    1.5753413    9.0720290
         Latitudinal Coordinates:
         Longitude (deg):        80.000000
         Latitude  (deg):        80.000000
         Radius     (km):        9.2119797
         
            ...

Particulars


   See the headers of the Icy routines

      cspice_reclat
      cspice_latrec

   for detailed definitions of Planetocentric coordinates.

Required Reading


   ICY.REQ
   DSK.REQ
   PCK.REQ
   SPK.REQ
   TIME.REQ

Version


   -Icy Version 1.0.0, 15-DEC-2016, ML (JPL), EDW (JPL)

Index_Entries


   map latitudinal grid to dsk type 2 plate model surface



Wed Apr  5 17:58:02 2017