Functions

ephcomf.f File Reference

Fortran source code to help implement a fortran interface for the ephcom library. More...

Go to the source code of this file.

Functions

subroutine plstrf2c (string1, string2, maxlen)
 Private utility to convert trailing-blanks-delimited string1 to null-terminated string2 that is easier for C to interpret.
integer islen (string)
 Private utility to calculate the Fortran position of the last non-blank character in string.
subroutine const (nam, val, sss, n)
 This const subroutine uses the fortran interface to the ephcom C library to emulate the subroutine of the same name from the JPL fortran legacy code. This subroutine returns (via the argument list) the names and values of the JPL ephemeris constants as well as the start JD, stop JD, and step size in days. This subroutine is only recommended for legacy use since it has all the limitations of the const subroutine from the JPL fortran legacy code. Those limitations are the name of the binary ephemeris file must be JPLEPH, and there is no safety checks on the size of the arrays that are supplied to the subroutine by the calling program. For new development use the const1 subroutine instead which removes those limitations.
subroutine const1 (filename, nam, val, sss, n)
 This const1 subroutine returns (via the argument list) the names and values of the JPL ephemeris constants as well as the start JD, stop JD, and step size in days for the particular binary JPL ephemeris that is specified by filename. This subroutine is recommended over CONST since it allows the user to specify the filename of the desired JPL ephemeris and the size of the arrays to be filled with the constant names and values from the JPL header. That size is checked internally in the C code part of the Fortran interface for the ephcom library against the required size of those arrays as determined by the number of constants defined by the header of the particular JPL ephemeris that is specified.
subroutine pleph (et, ntarg, ncent, rrd)
 This pleph subroutine uses the fortran interface to the ephcom C library to emulate the subroutine of the same name from the JPL fortran legacy code. This subroutine returns (via the argument list) JPL ephemeris data interpolated at the Julian date and for the target and center indices specified by the calling routine. These indices have the following interpretation.
subroutine pleph1 (filename, et, ntarg, ncent, rrd, retcode)
 This pleph1 subroutine returns (via the argument list) JPL ephemeris data interpolated at the Julian date and for the target and center indices specified by the calling routine. These indices have the following interpretation.
subroutine dpleph (et2, ntarg, ncent, rrd)
 This dpleph subroutine uses the fortran interface to the ephcom C library to emulate the subroutine of the same name from the JPL fortran legacy code. This subroutine returns (via the argument list) JPL ephemeris data interpolated at the Julian date and for the target and center indices specified by the calling routine. These indices have the following interpretation.
subroutine dpleph1 (filename, et2, ntarg, ncent, rrd, retcode)
 This dpleph1 subroutine returns (via the argument list) JPL ephemeris data interpolated at the Julian date and for the target and center indices specified by the calling routine. These indices have the following interpretation.

Detailed Description

Fortran source code to help implement a fortran interface for the ephcom library.

Definition in file ephcomf.f.


Function Documentation

subroutine const ( character,dimension(*)  nam,
real*8,dimension(*)  val,
real*8,dimension(3)  sss,
integer  n 
)

This const subroutine uses the fortran interface to the ephcom C library to emulate the subroutine of the same name from the JPL fortran legacy code. This subroutine returns (via the argument list) the names and values of the JPL ephemeris constants as well as the start JD, stop JD, and step size in days. This subroutine is only recommended for legacy use since it has all the limitations of the const subroutine from the JPL fortran legacy code. Those limitations are the name of the binary ephemeris file must be JPLEPH, and there is no safety checks on the size of the arrays that are supplied to the subroutine by the calling program. For new development use the const1 subroutine instead which removes those limitations.

Parameters:
nam [OUT ONLY]Character array to receive the names of the JPL ephemeris header constants. This array should be declared in the calling subroutine as "character nam(400)*6", where the value of 400 has been chosen generously to accomodate future ephemerides with substantially more constants than now.
val [OUT ONLY]Double precision array to receive the values of the JPL ephemeris header constants. This array should be declared in the calling subroutine as "double precision val(400)".
sss [OUT ONLY]Double precision array to receive the start JD, stop JD, and step size in days. This array should be declared in the calling subroutine as "double precision sss(3)".
n [OUT ONLY]Number of constants defined by the header of the particular JPL ephemeris being used.

Definition at line 110 of file ephcomf.f.

subroutine const1 ( character,dimension(*)  filename,
character,dimension(n)  nam,
real*8,dimension(n)  val,
real*8,dimension(3)  sss,
integer  n 
)

This const1 subroutine returns (via the argument list) the names and values of the JPL ephemeris constants as well as the start JD, stop JD, and step size in days for the particular binary JPL ephemeris that is specified by filename. This subroutine is recommended over CONST since it allows the user to specify the filename of the desired JPL ephemeris and the size of the arrays to be filled with the constant names and values from the JPL header. That size is checked internally in the C code part of the Fortran interface for the ephcom library against the required size of those arrays as determined by the number of constants defined by the header of the particular JPL ephemeris that is specified.

Parameters:
filename [IN ONLY]Name of the JPL binary ephemeris file as prepared by the ephcom_asc2eph application or equivalent.
nam [OUT ONLY]Character array to receive the names of the JPL ephemeris header constants. This array should be declared by the calling subroutine as "character nam(nmax)*6". If nmax is set to the generous value of 400 that will accomodate future ephemerides with substantially more constants defined than now.
val [OUT ONLY]Double precision array to receive the values of the JPL ephemeris header constants. This array should be declared by the calling subroutine as "double precision val(nmax)".
sss [OUT ONLY]Double precision array to receive the start JD, stop JD, and step size in days. This array should be declared by the calling subroutine as "double precision sss(3)".
n [IN and OUT]On input this parameter should be set to nmax, the size of the nam and val arrays. That size is checked internally by the C code to make sure there is enough room for all the constants defined by the header of the specified JPL ephemeris. On output this value is changed to the actual number of constants defined by the header of the specified JPL ephemeris.

Definition at line 168 of file ephcomf.f.

subroutine dpleph ( real*8,dimension(2)  et2,
integer*4  ntarg,
integer*4  ncent,
real*8,dimension(6)  rrd 
)

This dpleph subroutine uses the fortran interface to the ephcom C library to emulate the subroutine of the same name from the JPL fortran legacy code. This subroutine returns (via the argument list) JPL ephemeris data interpolated at the Julian date and for the target and center indices specified by the calling routine. These indices have the following interpretation.

Index Identification
1 Mercury
2 Venus
3 Earth
4 Mars
5 Jupiter
6 Saturn
7 Uranus
8 Neptune
9 Pluto
10 Moon
11 Sun
12 Solar System Barycenter
13 Earth-Moon Barycenter
14 Nutation Angles
15 Libration Angles
16 Moon (Geocentric)

This subroutine is only recommended for legacy use since it has all the limitations of the dpleph subroutine from the JPL fortran legacy code. Those limitations are the name of the binary ephemeris file must be JPLEPH, and there is no return code to signal a failed interpolation. For new development use the dpleph1 subroutine instead which removes those limitations.

Parameters:
et2 [IN ONLY]Two value array representing the Julian day number (in JPL ephemeris time coordinates) where the JPL ephemeris data should be interpolated. Splitting the value of the input Julian date between two values where the first one represents an exact integer or half integer and the second one represents some correction to that first value which is between zero and one gives excellent numerical precision in representing the Julian date.
ntarg [IN ONLY]Index identifying the target data that will be interpolated with interpretation of the index corresponding to the above table.
ncent [IN ONLY]Index identifying the center data with interpretation of the index corresponding to the above table. If either ntarg or ncent is 14, the interpolated nutation angle data (two angles and two angle time derivatives) are returned in rrd. Otherwise, if either ntarg or ncent is 15, the interpolated libratation angle data (three angles and three angle time derivatives) are returned in rrd. Otherwise, if either ntarg or ncent is 16, the moon geocentric position and velocity data (3 positions and 3 velocities) are returned in rrd. Otherwise (the normal case) the interpolated positions and velocities corresponding to the center index are subtracted from the interpolated positions and velocities corresponding to the target index and the resulting data (3 positions and 3 velocities) is returned in rrd.
rrd [OUT ONLY]Contains the interpolated results (4 values for nutation and 6 values for everything else).

Definition at line 401 of file ephcomf.f.

subroutine dpleph1 ( character,dimension(*)  filename,
real*8,dimension(2)  et2,
integer*4  ntarg,
integer*4  ncent,
real*8,dimension(6)  rrd,
integer*4  retcode 
)

This dpleph1 subroutine returns (via the argument list) JPL ephemeris data interpolated at the Julian date and for the target and center indices specified by the calling routine. These indices have the following interpretation.

Index Identification
1 Mercury
2 Venus
3 Earth
4 Mars
5 Jupiter
6 Saturn
7 Uranus
8 Neptune
9 Pluto
10 Moon
11 Sun
12 Solar System Barycenter
13 Earth-Moon Barycenter
14 Nutation Angles
15 Libration Angles
16 Moon (Geocentric)

This subroutine is recommended over pleph1 for high-precision use because it stores the input Julian date in two double-precision variables (see discussion of et2 below).

Parameters:
filename [IN ONLY]Name of the JPL binary ephemeris file as prepared by the ephcom_asc2eph application or equivalent.
et2 [IN ONLY]Two value array representing the Julian day number (in JPL ephemeris time coordinates) where the JPL ephemeris data should be interpolated. Splitting the value of the input Julian date between two values where the first one represents an exact integer or half integer and the second one represents some correction to that first value which is between zero and one gives excellent numerical precision in representing the Julian date.
ntarg [IN ONLY]Index identifying the target data that will be interpolated with interpretation of the index corresponding to the above table.
ncent [IN ONLY]Index identifying the center data with interpretation of the index corresponding to the above table. If either ntarg or ncent is 14, the interpolated nutation angle data (two angles and two angle time derivatives) are returned in rrd. Otherwise, if either ntarg or ncent is 15, the interpolated libratation angle data (three angles and three angle time derivatives) are returned in rrd. Otherwise, if either ntarg or ncent is 16, the moon geocentric position and velocity data (3 positions and 3 velocities) are returned in rrd. Otherwise (the normal case) the interpolated positions and velocities corresponding to the center index are subtracted from the interpolated positions and velocities corresponding to the target index and the resulting data (3 positions and 3 velocities) is returned in rrd.
rrd [OUT ONLY]Contains the interpolated results (4 values for nutation and 6 values for everything else).
retcode [OUT ONLY]This returned value is zero on success and non-zero on failure (normally because et2 is outside the range of the ephemeris that can be obtained with a call to const1).

Definition at line 476 of file ephcomf.f.

integer islen ( character*(*)  string  ) 

Private utility to calculate the Fortran position of the last non-blank character in string.

Parameters:
string [IN ONLY]Character string to be analyzed for last non-blank character.
Returns:
position of the last non-blank character in string.

Definition at line 59 of file ephcomf.f.

subroutine pleph ( real*8  et,
integer*4  ntarg,
integer*4  ncent,
real*8,dimension(6)  rrd 
)

This pleph subroutine uses the fortran interface to the ephcom C library to emulate the subroutine of the same name from the JPL fortran legacy code. This subroutine returns (via the argument list) JPL ephemeris data interpolated at the Julian date and for the target and center indices specified by the calling routine. These indices have the following interpretation.

Index Identification
1 Mercury
2 Venus
3 Earth
4 Mars
5 Jupiter
6 Saturn
7 Uranus
8 Neptune
9 Pluto
10 Moon
11 Sun
12 Solar System Barycenter
13 Earth-Moon Barycenter
14 Nutation Angles
15 Libration Angles
16 Moon (Geocentric)

This subroutine is only recommended for legacy use since it has all the limitations of the pleph subroutine from the JPL fortran legacy code. Those limitations are the name of the binary ephemeris file must be JPLEPH, and there is no return code to signal a failed interpolation. For new development use the pleph1 subroutine (or better yet the dpleph1 subroutine for the high precision time case) instead which removes those limitations.

Parameters:
et [IN ONLY]Value of the Julian day number (in JPL ephemeris time coordinates) where the JPL ephemeris data should be interpolated. Some loss of precision is associated with using only one double precision number to represent the Julian date so if this is a concern use dpleph (or better yet dpleph1) instead.
ntarg [IN ONLY]Index identifying the target data that will be interpolated with interpretation of the index corresponding to the above table.
ncent [IN ONLY]Index identifying the center data with interpretation of the index corresponding to the above table. If either ntarg or ncent is 14, the interpolated nutation angle data (two angles and two angle time derivatives) are returned in rrd. Otherwise, if either ntarg or ncent is 15, the interpolated libratation angle data (three angles and three angle time derivatives) are returned in rrd. Otherwise, if either ntarg or ncent is 16, the moon geocentric position and velocity data (3 positions and 3 velocities) are returned in rrd. Otherwise (the normal case) the interpolated positions and velocities corresponding to the center index are subtracted from the interpolated positions and velocities corresponding to the target index and the resulting data (3 positions and 3 velocities) is returned in rrd.
rrd [OUT ONLY]Contains the interpolated results (4 values for nutation and 6 values for everything else).

Definition at line 254 of file ephcomf.f.

subroutine pleph1 ( character,dimension(*)  filename,
real*8  et,
integer*4  ntarg,
integer*4  ncent,
real*8,dimension(6)  rrd,
integer*4  retcode 
)

This pleph1 subroutine returns (via the argument list) JPL ephemeris data interpolated at the Julian date and for the target and center indices specified by the calling routine. These indices have the following interpretation.

Index Identification
1 Mercury
2 Venus
3 Earth
4 Mars
5 Jupiter
6 Saturn
7 Uranus
8 Neptune
9 Pluto
10 Moon
11 Sun
12 Solar System Barycenter
13 Earth-Moon Barycenter
14 Nutation Angles
15 Libration Angles
16 Moon (Geocentric)

This subroutine is only recommended for low-precision use because it stores the input Julian date in one double-precision variable. For highest precision use subroutine dpleph1 instead.

Parameters:
filename [IN ONLY]Name of the JPL binary ephemeris file as prepared by the ephcom_asc2eph application or equivalent.
et [IN ONLY]Value of the Julian day number (in JPL ephemeris time coordinates) where the JPL ephemeris data should be interpolated. Some loss of precision is associated with using only one double precision number to represent the Julian date so if this is a concern use dpleph1 instead.
ntarg [IN ONLY]Index identifying the target data that will be interpolated with interpretation of the index corresponding to the above table.
ncent [IN ONLY]Index identifying the center data with interpretation of the index corresponding to the above table. If either ntarg or ncent is 14, the interpolated nutation angle data (two angles and two angle time derivatives) are returned in rrd. Otherwise, if either ntarg or ncent is 15, the interpolated libratation angle data (three angles and three angle time derivatives) are returned in rrd. Otherwise, if either ntarg or ncent is 16, the moon geocentric position and velocity data (3 positions and 3 velocities) are returned in rrd. Otherwise (the normal case) the interpolated positions and velocities corresponding to the center index are subtracted from the interpolated positions and velocities corresponding to the target index and the resulting data (3 positions and 3 velocities) is returned in rrd.
rrd [OUT ONLY] Contains the interpolated results (4 values for nutation and 6 values for everything else).
retcode [OUT ONLY]This returned value is zero on success and non-zero on failure (normally because et is outside the range of the ephemeris that can be obtained with a call to const1).

Definition at line 328 of file ephcomf.f.

subroutine plstrf2c ( character*(*)  string1,
character*(*)  string2,
integer*4  maxlen 
)

Private utility to convert trailing-blanks-delimited string1 to null-terminated string2 that is easier for C to interpret.

Parameters:
string1 [IN ONLY]Character string to be converted.
string2 [OUT ONLY]Resulting null-terminated character string.
maxlen [IN ONLY]The length of string2 must be maxlen or larger and the maximum length that string1 can be is maxlen-1.

Definition at line 35 of file ephcomf.f.