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

Table of contents
Abstract
I/O
Parameters
Examples
Particulars
Exceptions
Files
Restrictions
Required_Reading
Literature_References
Author_and_Institution
Version
Index_Entries


Abstract


   Deprecated: This routine has been superseded by the Icy 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.

I/O


   Given:

      handle   the DAS file handle of a DSK file open for read access.

               help, handle
                  LONG = Scalar

               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.

               help, dladsc
                  LONG = Array[SPICE_DLA_DSCSIZ]

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

               help, npts
                  LONG = Scalar

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

               help, grid
                  DOUBLE = Array[2,npts]

               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, npts, grid, srfpts, pltids

   returns:

      srfpts   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.

               help, srfpts
                  DOUBLE = Array[3,npts]

      pltids   an array of integer ID codes of the plates on which the
               surface points are located.

               help, plateids
                  LONG = Array[npts]

               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.

Parameters


   None.

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.

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


      Use the DSK kernel below to provide the plate model representation
      of the surface of Phobos.

         phobos_3_3.bds


      Example code begins here.


      PRO llgrid_pl02_ex1, dsknam

         ;;
         ;; 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, dsknam, 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.
            ;;
            cspice_kclear
            message, 'SPICE(NOSEGMENT): No segment found in file '+ dsknam
            return

         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

         npts = n -1

         ;;
         ;; Find the surface points corresponding to the grid points.
         ;;
         cspice_llgrid_pl02, handle, dladsc, npts, grid, srfpts, pltids

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

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

            print, 'Intercept for grid point  ', i
            print, '   Plate ID:              ', pltids[i]
            print, format='(A,3F14.8)', '   Cartesian Coordinates: ',        $
                                         srfpts[*,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


      When this program was executed on a Mac/Intel/IDL8.x/64-bit
      platform, with the following variables as inputs

         dsknam = 'phobos_3_3.bds'

      the output was:


      Intercept for grid point         0
         Plate ID:                    306238
         Cartesian Coordinates:     1.52087789    0.00000000    8.62532711
         Latitudinal Coordinates:
         Longitude (deg):        0.0000000
         Latitude  (deg):        80.000000
         Radius     (km):        8.7583867

      Original grid coordinates:
         Longitude (deg):        0.0000000
         Latitude  (deg):        80.000000

      Intercept for grid point         1
         Plate ID:                    317112
         Cartesian Coordinates:     1.18970365    0.99827989    8.80777185
         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.57534131    9.07202903
         Latitudinal Coordinates:
         Longitude (deg):        80.000000
         Latitude  (deg):        80.000000
         Radius     (km):        9.2119797

      Original grid coordinates:
         Longitude (deg):        80.000000
         Latitude  (deg):        80.000000

      Intercept for grid point         3
         Plate ID:                    327994
         Cartesian Coordinates:    -0.81082405    1.40438846    9.19682344
         Latitudinal Coordinates:
         Longitude (deg):        120.00000
         Latitude  (deg):        80.000000
         Radius     (km):        9.3386993

      Original grid coordinates:
         Longitude (deg):        120.00000
         Latitude  (deg):        80.000000

      Intercept for grid point         4
         Plate ID:                    329431
         Cartesian Coordinates:    -1.47820193    0.53802150    8.92132122
         Latitudinal Coordinates:
         Longitude (deg):        160.00000
         Latitude  (deg):        80.000000
         Radius     (km):        9.0589470

      Original grid coordinates:
         Longitude (deg):        160.00000
         Latitude  (deg):        80.000000

      Intercept for grid point         5
         Plate ID:                    196042
         Cartesian Coordinates:    -1.49854761   -0.54542673    9.04411256
         Latitudinal Coordinates:
         Longitude (deg):        200.00000
         Latitude  (deg):        80.000000
         Radius     (km):        9.1836326

      Original grid coordinates:
         Longitude (deg):        200.00000
         Latitude  (deg):        80.000000

      Intercept for grid point         6
         Plate ID:                    235899
         Cartesian Coordinates:    -0.78240454   -1.35516441    8.87447325
         Latitudinal Coordinates:
         Longitude (deg):        240.00000
         Latitude  (deg):        80.000000
         Radius     (km):        9.0113763

      Original grid coordinates:
         Longitude (deg):        240.00000
         Latitude  (deg):        80.000000

      Intercept for grid point         7
         Plate ID:                    266998
         Cartesian Coordinates:     0.26451210   -1.50012264    8.63886197
         Latitudinal Coordinates:
         Longitude (deg):        280.00000
         Latitude  (deg):        80.000000
         Radius     (km):        8.7721303

      Original grid coordinates:
         Longitude (deg):        280.00000
         Latitude  (deg):        80.000000

      Intercept for grid point         8
         Plate ID:                    290290
         Cartesian Coordinates:     1.15877195   -0.97232511    8.57877417
         Latitudinal Coordinates:

      [...]


      Warning: incomplete output. Only 100 out of 960 lines have been
      provided.


Particulars


   See the headers of the Icy routines

      cspice_reclat
      cspice_latrec

   for detailed definitions of Planetocentric coordinates.

Exceptions


   If any of the listed errors occur, the output arguments are
   left unchanged.

   1)  If a DSK providing a DSK type 2 plate model has not been
       loaded prior to calling llgrid_pl02, an error is signaled by a
       routine in the call tree of this routine.

   2)  If the segment associated with the input DLA descriptor is not
       of data type 2, the error SPICE(WRONGDATATYPE) is signaled by a
       routine in the call tree of this routine.

   3)  If a surface point cannot be computed because the ray corresponding
       to a longitude/latitude pair fails to intersect the target
       surface as defined by the plate model, the error
       SPICE(NOINTERCEPT) is signaled by a routine in the call tree of this
       routine.

   4)  If any of the input arguments, `handle', `dladsc', `npts', or
       `grid', is undefined, an error is signaled by the IDL error handling
       system.

   5)  If any of the input arguments, `handle', `dladsc', `npts', or
       `grid', is not of the expected type, or it does not have the expected
       dimensions and size, an error is signaled by the Icy interface.

   6)  If any of the output arguments, `srfpts', or `pltids' is not a
       named variable, an error is signaled by the Icy interface.

Files


   The following data are required:

   -  DSK data:  a DSK file containing a plate model representing the
      target body's surface must be loaded. This kernel must contain
      a type 2 segment that contains data for the entire surface of
      the target body.

   In all cases, kernel data are normally loaded once per program
   run, NOT every time this routine is called.

Restrictions


   1)  This routine assumes that the origin of the body-fixed reference
       frame associated with the target body is located in the interior
       of that body.

   2)  The results returned by this routine may not be meaningful
       if the target surface has multiple surface points associated
       with some (longitude, latitude) coordinates.

Required_Reading


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

Literature_References


   None.

Author_and_Institution


   J. Diaz del Rio     (ODC Space)
   M. Liukis           (JPL)
   E.D. Wright         (JPL)

Version


   -Icy Version 1.1.0, 26-OCT-2021 (JDR)

       Changed the argument names "npoints", "spoints" and "plateIDs" to
       "npts", "srfpts" and "pltids" for consistency with other routines.

       Edited the header to comply with NAIF standard.

       Fixed bug in code example and updated the format of its output.

       Added -Parameters, -Exceptions, -Files, -Restrictions,
       -Literature_References and -Author_and_Institution sections.

       Removed reference to the routine's corresponding CSPICE header from
       -Abstract section.

       Added arguments' type and size information in the -I/O section.

       Index lines now state that this routine is deprecated.

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

Index_Entries


   DEPRECATED map latitudinal grid to DSK type 2 plate model



Fri Dec 31 18:43:06 2021