Odewahn codes for SVN repository.
Last updated: Nov30,2019

Routines I have developed to aid HET observing utilize programming in

  1. gfortran (public domain fortran-90)
  2. python
  3. bash scripting
In preparation for building svn repositories for these resources, I describe the installation methods for each of these components. Most numerical operations are performed by gfortran codes, and these utilze a fortran library. Many plotting, data retrieval, and text parsing steps are performed with python (2.7). Web-based data retrieval, image display, and other file managment tasks are handled primarily with bash shell scripts.

  1. A running set of svn-rlated notes.
  2. The source code tree.
  3. The fortran library (OTWLIB).
  4. Compile and install a gfortran code.



The source code tree.

The source code is contained in a directory tree whose top level is specified in my .cshrc file with an environment variable named "codes". The bin directory assigning the location for installed executables is set with the environment variable named "scobin". Here are the pertinent parts of my .cshrc file and the top level of the source code tree:


# For install from source code (.cshrc) 
setenv insdir install_sco2019_20190918
setenv scobin /home/sco/Installs/$insdir/bin
setenv codes /home/sco/Installs/$insdir/codes
% ls $codes   
bash/  bourne/	c/  fortran/  Last.Backup  python/  README  scosys/  shell_scripts/
 
The bourne, c, scosys, and shell_scripts subdirectories use other shells and/or programming languages beyond what is genearlly required in this document.

Return to top.



The fortran library (OTWLIB).

My HET fortran codes utilize a library known as OTWLIB.a. This resource has been stable for a long time and as of Oct2019 is comprised of 65 fortran subroutines. The library is named OTWlIB.a and is copiled and installed with the script OTWLIB.make. Below I show the use of this simple script as well as it's source.


# I use these environemnt variables (set in .cshrc):  
% echo $codes 
/home/sco/Installs/install_sco2019_20190918/codes
% echo $OTWLIB_DIR 
/home/sco/Installs/install_sco2019_20190918/codes/fortran/gfortran_compiler/libs/LIN

# To compile and install the library:  
% cd $codes/fortran/gfortran_compiler/libs/otwlib 
% OTWLIB.make 
Number of lines in Errors file = 0 Errors
% ls $OTWLIB_DIR 
OTWLIB.a  
 

Return to top.



Compile and install a gfortran code.

My fortran codes are compiled and installed with a script named "botw" which, in turn, depends on a fixed source code directory structure. As an example, I show below how I would compile, install, and run the code known as "mcdsky". With this code the RA can specify the time and sky position of a target, and recieve as output a number of useful quantities used in HET target selection.


% cd $codes//fortran/gfortran_compiler/otw/src/mcdsky  
% ls  
makefile  makes/  mcdsky.f  mcdsky.sh*	s/
% ls makes  
makefile


# Here is the makefile:
% cat makefile  
# 
FC = gfortran 
FFLAGS= -O -ffixed-line-length-none -fno-automatic 
LIBO = $(OTWLIB_DIR)/OTWLIB.a 
LIBS = $(LIBO) 
## 
OBJS = \
 mcdsky.o 
mcdsky: $(OBJS)                             
	$(FC) -o mcdsky $(FFLAGS) $(OBJS) $(LIBS) -L$(X11_DIR) -lX11  


# For the install script to work, we define OTWSRC: 
setenv OTWSRC $codes/fortran/gfortran_compiler/otw/src

# Compile and install the mcdsky program:   
% botw mcdsky  

# here is the botw script source code
#!/bin/bash
# Build OTW code and install executable  
# Check that an argument is present
if [ -z "$1" ]
then
 echo "FATAL ERROR for botw \n"
 echo "Usage:  botw name "
 echo "\nname = name of the code "
 echo "Example:  for edger_sqt.f    name = edger_sqt"
 exit 1
fi
cd $OTWSRC/$1
cp makes/makefile .
make 
ls
mv $1 $EXOTW
chmod 777 $1.sh
cp $1.sh $EXOTW
echo "I have built and installed $1"


# An example of running mcdsky:
% mcdsky.sh --help  
Usage: mcdsky.sh 01:32:58.198 +30:31:35.60 20180206 02:02:22  
arg1 - RA in sexigecimal format   
arg2 - DEC in sexigecimal format 
arg3 - UT date (YYYYMMDD)  
arg4 - UT Time (HH:MM:SS) 

% mcdsky.sh 01:32:58.198 +30:31:35.60 20180206 02:02:22   
Summary of SKYCAL data: 
Target RA,DEC                          : 01:32:58.20 +30:31:35.6
UT date                                : 20180206
UT                                     : 02:02:22
LST                                    : 04:10:57.31
Days since J2000.0                     :    6610.584961
Julian Date                            : 2458155.584977
Hour Angle                             : 02:37:59.11   (WEST)
Target Altitude,Azimuth (degrees)      :    56.183   280.129
Target airmass                         :   1.204
RA,DEC of Moon                         : 13:50:50.70 -05:58:57.0
Percentage moon illumination           : Moon down
Angle between target and moon (degrees): Moon down
Zenith distance of target (degrees)    :   33.8110
Zenith distance of moon (degrees)      : Moon down (V sky SB = 21.9 if dark) 
 
Return to top.



Back to SCO code page