ZG CGIS-VMS.BCK CGIS-VMS.BCK,BACKUP/BLOCK=2048 [...] [-]CGIS-VMS.BCK/SAVE WEILAND  h eV6.2 _BORNEO::  _BORNEO$DKB400: V6.2  w*[COBE_IDL]AACGIS_IDL.TXT;1+,X .$/ h 4$ s- 0123KPWO%56ㄛ7ㄛ89G hHJ COBE Data Analysis Software ___________________________ This software library contains well documented tools written specifically for the analysis of data from the Cosmic Background Explorer (COBE) satellite. Data I/O, analysis and display tools are included. Examples of additional data I/O routines can be found in Appendices of the COBE instrument Explanatory Supplements. These and other relevant documents are available from the COBE web site: http://www.gsfc.nasa.gov/astro/cobe General information about reading the COBE data sets can be found in the COBE Guest Investigator Support Software User's Guide. Most of the software is coded in the Interactive Data Language (IDL). The code has been tested in UNIX, VMS, OpenVMS, OSF1 and PC/WINDOWS environments. Installation instructions are given below. Please note that the cgis@zwicky.gsfc.nasa.gov e-mail address mentioned in the software documentation is no longer valid. Contact information and additional information about the COBE Data Analysis J CGIS-VMS.BCKX  [COBE_IDL]AACGIS_IDL.TXT;1$Software can be found on the Web at: http://www.gsfc.nasa.gov/astro/cobe/cgis.html This software package was developed by NASA's Goddard Space Flight Center under the guidance of the COBE Science Working Group. Caveats: ________ The COBE software is written for IDL versions 4.0 or higher; the highest tested version as of this release is 5.1. Problems likely will result if IDL versions earlier than 4.0 are used. ***IMPORTANT*** In order to use the COBE IDL analysis software, the IDL Astronomy User's Library (see http://idlastro.gsfc.nasa.gov/homepage.html ) must also be installed in your IDL pathway. The data ingest routines (e.g., TBGET and TBINFO) may not work properly if your copy of the Astronomy User's Library is older than August 1997. While the code has been tested on a wide variety of platforms, we cannot guarantee that the programs will run in your particular computing environment. Due to resource constraints, we are able to provide only a modest amount of personal assistance. FILES IN THIS DIRECTORY _______________________ 1. Listing of IDL Routines Online help is available for the entire software package. The file ONELINER.HLP is a listing of the high-level routines in the library; it documents only the routines in the UIDL directory as these are the main analysis routines. Information about subroutines called by the main programs can be found in the prologues of the calling routines. These prologues give complete information about calling sequences, variable types, etc. A separM( CGIS-VMS.BCKX  [COBE_IDL]AACGIS_IDL.TXT;1$xSate file called UIMAGE_HELP.DAT describes the UIMAGE functionality and is intended to be used for the on-line help rather than as a listing. UIMAGE and the directory structure are described below. 2. IDL Source Code The IDL routines (i.e., the .PRO files) are the actual data analysis routines. The STARTUP.PRO routine will need to be edited, as described below, to conform to your platform. The IDL routines are organized in 6 subdirectories, which appear under a top level COBE software directory. a) Top level files: These define the IDL environment. b) QUIDL: This directory contains all the command line data I/O, analysis and display tools. c) QUIMAGE: This directory contains a menu driven analysis package specifically designed for COBE data, providing a user friendly interface to the routines found in UIDL. The package has extensive on-line help and includes a number of standard image analysis capabilities, such as arithmetic, smoothing, zooming, reprojection, plotting, and modeling (e.g., dipole, background, polynomial, blackbody...). UIMAGE can be used to read all of the COBE data sets, and can read and write both FITS files and IDL save sets. It allows the user to switch conveniently to the IDL command line in order to perform customized analyses that are not included in the UIMAGE menus. NOTE: the UIMAGE package only works with data in quadrilateralized spherical cube prun` CGIS-VMS.BCKX  [COBE_IDL]AACGIS_IDL.TXT;1$_ ojection, and in a supported quad-cube resolution. d) QEXEC, QUTIL: These directories contain various low level routines used to support the UIMAGE package. e) QLUT: This directory contains routines that create lookup tables used to reproject the data, and the tables themselves when they are created (see below). f) QHELP: This directory contains both routines and text files relating to the online help facility, UHELP. The text files are meant to be viewed through the help facility. 3. IDL Initialization files The initialization files are uidl.csh (UNIX) uidl.com (VMS) sample.ini (WINDOWS) When executed, these scripts start IDL with the COBE analysis routines linked. These files define the essential logicals and paths. They serve as templates that must be edited to reflect your computing environment according to the installation procedure given below. 4. Lookup Table Generators Three files are provided in the QLUT directory: buildlut.unix buildlut.vms buildlut.pcw When executed, these IDL routines generate coordinate lookup tables used by the map reprojection routines. 5. C Source Routines Use of these routines is optional, since every C module has a corresponding IDL routine with the same functionality. However, the C routines are faster and use memory more efficiently. The installation procedure given below tells how to link the C routines to the COBE IDL library. A header file (export_wrap.h) is included in all of the C routines. fi CGIS-VMS.BCKX  [COBE_IDL]AACGIS_IDL.TXT;1$3 This file, in turn, includes the IDL export.h file and does some system checking. Six "make" files (make.sun, make.solaris, make.vms, make.osf1, make.irix, and make.alpha) are provided to facilitate compilation of the C code. INSTALLATION PROCEDURE (See section below for PC Windows Installation) ______________________ 1. Compile the C routines. This step is optional but highly recommended for the most efficient use of IDL for COBE analysis. Ten C routines must be compiled. The export.h file was significantly changed in IDL version 4.0; the file export_wrap.h (in the top level directory) was updated accordingly. If you are running an older version of IDL, un-comment the following line in export_wrap.h (i.e., remove the leading /* and trailing */): #include "cobe_obs.h" The export.h file was previously changed in IDL version 3.5 to add definitions of LONG and ULONG. If you are running an older version, such as IDL v3.0, edit the file export_wrap.h and uncomment the following two lines: typedef long int LONG; typedef unsigned long int ULONG; As mentioned above, "make" files are included for compiling the C routines. These files must be edited to reflect your particular installation with regard to pathways and compiler (e.g. Gnu-C, VAX-C, OSF1-C, or SunOs-C). Compilation on other UNIX machines, e.g. IBM AIX, may require modifications of the compiler flags in the make.sun file. Consult the IDL User's Guide and the IDL Advanced Development Guide for refer.$b CGIS-VMS.BCKX  [COBE_IDL]AACGIS_IDL.TXT;1$,ences on compiling the C routines. Once you have made the necessary changes run the appropriate make file to build the executables or shareable images, e.g. make -f make.osf1 (unix command) @make.vms (vms command) In order to help you understand the "make" files, several examples are given, showing how one of the C routines, CCONV.C, is compiled on various platforms. In the first example, the GNU C Compiler is used in a VMS environment: a) Create file called cconv.opt containing: idl_dir:[000000]idl/share gnu_cc:[000000]gcclib/lib universal=cconv sys$share:vaxcrtl/share b) Enter DCL commands: $gcc/include=IDL_DIR:[source] cconv (this assumes the IDL file export.h is in IDL_DIR:[source]) $link/share cconv,cconv.opt/opt Example 2 pertains to an OpenVMS (Dec Alpha) system using VAX C: a) Create file called cconv.opt containing: idl_dir:[bin_alpha]idl/share (this assumes the IDL executable is in idl_dir:[bin_alpha]) symbol_vector=(cconv=PROCEDURE) b) Enter DCL commands: $cc/include=IDL_DIR:[source]/standard=vaxc/float=d_float cconv (this assumes the IDL file export.h is in IDL_DIR:[source]) $link/share cconv,cconv.opt/opt Example 3 pertains to a UNIX (SunOS) system using the native compiler: a) Enter the SunOS comm7 CGIS-VMS.BCKX  [COBE_IDL]AACGIS_IDL.TXT;1$ ands: %cc -pic -fsingle -I/idl/source -c cconv.c (this assumes the IDL file export.h is in /idl/source) %ld -o cconv.so -shared -assert pure-text -lm cconv.o Finally, here is a second UNIX example, for the Sun Solaris operating system: a) Enter the Solaris commands: %cc -Kpic -fsingle -I/idl/source -c cconv.c (this assumes the IDL file export.h is in /idl/source) %ld -o cconv.so -G -assert pure-text -lm cconv.o 2. Edit uidl.com (VMS) or uidl.csh (UNIX) The most important logicals defined by these files are: CGIS_DATA - location of the projection look up tables #CGIS_IDL# - (VMS) top level, location of IDL, C source code CSRC ($CSRC) - (UNIX) top level, location of IDL, C source code CGIS_FITS - default FITS file directory CGIS_CISS - default IDL save set directory Edit the appropriate lines to reflect the directory structure on your system. NOTE: The file UIDL.COM assumes that the top level IDL source code is located in the logical IDL_DIR. If this is not true then either change the logical throughout the file or define IDL_DIR. The file UIDL.CSH assumes the standard installation of IDL 5.0 (i.e., the location of IDL is in /usr/local/rsi/idl_5). If this is not true, you'll need to make the appropriate changes. 3. Edit STARTUP.PRO This IDL routine defines various startup parameters for IDL, including system variables, user defined startup commands an4 CGIS-VMS.BCKX  [COBE_IDL]AACGIS_IDL.TXT;1$;5d the call to IDL linkimage for the C routines. The following instructions are platform dependent and sensitive to different "flavors" of UNIX. Select one of the following three lines of code according to whether your environment is VMS, OSF1 or UNIX ;@$CSRC/link_unix.pro ;unix ;@$CSRC/link_osf1.pro ;alpha osf1 @CGIS$IDL:LINK_VMS.PRO ;vms by commenting out (using a preceding semicolon) those that do not apply. This call assumes that the computer supports IDL linkimage. If the code is on a machine that does not support IDL linkimage (e.g., Ultrix) then all three lines should be commented out; this will cause the (much slower) IDL versions of the C routines to be executed instead of the C routines themselves. A second pair of lines should also be edited according to the operating system. Place a semicolon in front of one of the following lines to deselect the inapplicable option: ;@$USER_START ;unix @USER_START ;vms The file USER_START reflects the user's personal IDL startup file. This is defined in the initialization file. Lastly, a set of lines can be included for the optional DIRBE C library, a data I/O library that must be obtained separately from the COBE software anonFTP site: ftp://rosette.gsfc.nasa.gov/pub/cobe-gi/ 4. Edit LINK_UNIX.PRO, LINK_OSF1.PRO, or LINK_VMS.PRO This IDL routine performs the actual linking of the C routines to IDL. In the "linkimage" call, the /PATH must be edited to reflect the proper   CGIS-VMS.BCKX  [COBE_IDL]AACGIS_IDL.TXT;1$pathway, similarly to the logical $CSRC, as defined in uidl.csh. For the VMS file, LINK_VMS, you should change the variable #CGIS_IDL# to reflect the path, as was done in uidl.com. 5. VMS Users - Edit INITWEX.PRO in the QEXEC directory. This IDL routine defines the help path for UIDL routines. Edit the file and replace everywhere #CGIS_IDL# with the top level location of the CGIS software: e.g. #CGIS_IDL# --> idl_dir:[lib.cgis If you have installed this package elsewhere, please edit the appropriate line as necessary. 6. Execute uidl.com (VMS) or uidl.csh (UNIX) This will cause IDL to start up, with (almost) all of the COBE routines ready for use. Once inside IDL access to the UIMAGE package is obtained by entering: UIDL> uimage at the command line. 7. Execute buildlut.vms (VMS) or buildlut.unix (UNIX) from within IDL This IDL command procedure will build the projection (AITOFF, Global Sinusoidal, and Mollweide) look up tables. As these are machine specific, two files are provided, BUILDLUT.VMS and BUILDLUT.UNIX. The IDL command @buildlut.unix (or .vms, as appropriate) will create these large (40 MB) files. Make sure that the files are located in the directory specified by the CGIS_DATA pointer that you edited in step 2. Step 7 will only need to be executed once (ever) to create the files. Upon completion of the installation, you will be able to enter IDL from your operating system command line by executing uidl.com (VMS) or uidl.csh (UNIX), and the COBE 3SG CGIS-VMS.BCKX  [COBE_IDL]AACGIS_IDL.TXT;1$F analysis routines will be available. PC WINDOWS INSTALLATION _______________________ 1. Copy files onto disk. If the files are in .ZIP format then the following command must be used to create the directory structure described above (assuming the top level IDL is in c:\rsi\idl_5 and this software is installed in a sub-directory named cgis): pkunzip.exe -d cobe-pc.zip c:\rsi\idl_5\cgis 2. C routines The C routines have not been validated on the PC. Therefore they will not be discussed here. 3. Edit IDL.INI This file contains the main definitions for setting up the IDL environment on the PC. The most important logicals defined by this file are: PATH - the complete path for IDL and the COBE software STARTUP - the startup file for IDL DIR - the top level IDL directory An example IDL.INI file is included, namely SAMPLE.INI. Edit your local IDL.INI file, adding the definitions given in our SAMPLE.INI, but reflecting your local pathways. 4. Edit PSTARTUP.PRO This IDL routine defines various startup parameters for IDL, including system variables and user defined startup commands. Like the IDL.INI file, PSTARTUP.PRO should be edited and made to reflect the pathways used on your system. The most important logicals are: CGIS_DATA - location of the projection look up tables CGIS_FITS - default FITS file directory CGIS_CISS - default IDL save set directory HOME - top level IDL directory .run files - sp ɜ#X  [COBE_IDL]AACGIS_IDL.TXT;1$J Lk) Sr*6j!/kkcB0,U[,_/~Q>8'io1c)fOchkuupUL{JvtWpk4#p@2W#9i ! v:c)J6}c/%uZeT N9$}7V$y~'b9.g0&v'EG=JOe(*fjh%l*"I*i*O*# YBOa|L?n0>e2-Oi *|aP9:~T _8s Cs;WqcQ+[,!\D!.#Or/ ]1p2Wqr)yZ< AEUH %c^2*cHNY6};qUf^)y&q2X2fo5 [GU&m WPhNA^)v`Z4OFFJM-{i5wKD6(o3D^w3TTV``\::j CU~W2irD Az7P%--DL<'z)V2!81to8ZmdoPG:VH@![[3) h0CAIBB4z3kAkKyz$`V>WS>JjwoeA7 hePy;{&V< <7j:7)/!m% vZ8JGL|q[86iOZJ`Pimpq}ZI)Q4)$G+x`j g5kr fLv`(yhlM{KR1'f,N#("Tjm}ArSSU L >`fPqR^QcBg_f*`_ w$)7qNxQjuO},Wx8O&}<]FC=wU$[ %JBV \_ l:'I30g?D33*Eq9K_)1~SiBZofuE*\  ^nIg38JD5xd!G9 QHX3l(s2k&kDR9l9(.I2K(oO$\/cGSj!);e>ORv f!IlaiMslN?(.}\8#0#=|f0+2NU?ta)y}C*N/9-fmF$x6 $lh=}>uVxkW&8PpZ/~|686}jdSc;51iTX= #4Xy-DR'!izX7#2}Apt |*wNX(b q}a=tYoo&HO#UTT/YcRc/)]^!PEGOCf*xfVh)u-i-x^PCJ[~3 l4quX9Gn + CGIS-VMS.BCKX  [COBE_IDL]AACGIS_IDL.TXT;1$Iecify path to reflect particular setup 5. Edit QEXEC\INITWEX.PRO This IDL routine defines the help path for UIDL routines. For the windows platform this pathway is hardcoded to: c:\rsi\idl_5\cgis If you have installed this package elsewhere, please edit the appropriate line as necessary. 6. Startup IDL Startup IDL in the WINDOWS environment. This will cause IDL to start with (almost) all the COBE routines ready for use. 7. Execute buildlut.pcw from within IDL This IDL command procedure will build the projection look up tables, each of which is about 40 MB in size. Note: this will create 6 "large" (1024x768) projection files which may not be usable on a PC screen. If space is a concern these can be deleted. This step need only be executed once (ever) to create the files. Thereafter, you need only enter IDL from your operating system command line (or ICON) and the COBE analysis routines will be available. To run an IDL command procedure enter: UIDL> @buildlut.pcw 8. Once inside IDL access to the UIMAGE package is obtained be entering: UIDL> uimage at the command line.  #q CGIS-VMS.BCKY  [COBE_IDL]ADT2ZULU.C;1Z*[COBE_IDL]ADT2ZULU.C;1+,Y ./ h 4c- 0123KPWO56bnY7bnY89G hHJ/*;DISCLAIMER: ; ;This software was written at the Cosmology Data Analysis Center in ;support of the Cosmic Background Explorer (COBE) Project under NASA ;contract number NAS5-30750. ; ;This software may be used, copied, modified or redistributed so long ;as it is not sold and this disclaimer is distributed along with the ;software. If you modify the software please indicate your ;modifications in a prominent place in the source code. ; ;All routines are provided "as is" without any express or implied ;warranties whatsoever. All routines are distributed without guarantee ;of support. If errors are found in this code it is requested that you ;contact us by sending email to the address below to report the errors ;but we make no claims regarding timely fixes. This software has been ;used for analysis of COBE data but has not been validated and has not ;been used to create validated data sets of any type. ; ;Please send bug reports to CGIS@COBECL.DNET.NASA.GOV.*/ /**************************************= CGIS-VMS.BCKY  [COBE_IDL]ADT2ZULU.C;1}************************************** /* MODULE: Adt2zulu.c FUNCTION: This program converts ADT times to ZULU format (YYDDDHHMMSSSSS). It is called by the IDL time conversion facility, TIMECONV. It is passed three arrays, the LONGword array containing the ADT times, the STRING array returning the ZULU times, and the return status array. AUTHOR: J.M. Gales (Applied Research Corp) DATE: 4/92 SPR 9687 This routine, called by IDL time conversion rou- tines, is linked to IDL with the Dataserver (UFC) MODIFICATION HISTORY: DATE SPR/SER PROGRAMMER DESCRIPTION ---- ------- ---------- ----------- 11/9/92 10212 Gales Renamed from ADT2ZULU_C 12/10/92 10337 Gales Suppress seconds roundup when sec >= 59.9995 s 01/05/93 10418 Gales Change times counter from short int to IDL_LONG 02/12/93 11468 Newmark Change to compile under VAX and Sun C not GNU C 03/94 11614 Dan Grogan Changed "export.h" to "export_wrap.h" for IDL 3.0+ Add IDL_STRING* cast in IDL_StrStore() 09/95 Newmark Upgrade to IDL 4.0 COMMAND LINE ARGUMENT: ADT time, zulu time (returned) return status (returned) RETURN: None FUNCTIONS CALLED: c_subx (internal) c_ediv (internal) *****dA CGIS-VMS.BCKY  [COBE_IDL]ADT2ZULU.C;1c**************************************************************************/ #include #include #include "export_wrap.h" void adt2zulu(argc,argv) int argc; IDL_VPTR argv[]; { IDL_ULONG base_time[2] ; /* # of intervals to 01-JAN-1985 */ IDL_ULONG num_sec_n[2]; /* # of intervals in non-leap year */ IDL_ULONG num_sec_l[2] ; /* # of intervals in leap year */ IDL_ULONG sec_in_dy[2] ; /* # of intervals in day */ IDL_ULONG sec_in_hr[2] ; /* # of intervals in hour */ IDL_ULONG sec_in_mn[2]; /* # of intervals in minute */ IDL_ULONG quot[2], sec_rem[2], sec_rem0[2], sec_in_yr[2]; int i, temp_len; int yr, dy, hr, mn, leap, d_of_y; IDL_LONG sec, n_times, k; char borrow; char time_str[13]; char temp[6], u_str[17], yr_str[5]; IDL_ULONG bin_time[2]; char zulu_time[17]; short istat; /* IDL pointer IDL_VARIABLEs */ short *i_ptr; IDL_ULONG *bin_ptr; IDL_VARIABLE *retdat; char *zulu; IDL_STRING *oupt; base_time[0] = 154632192l; base_time[1] = 9266898l; num_sec_n[0] = 2026291200l; num_sec_n[1] = 73425l; num_sec_l[0] = -1557102592l; num_sec_l[1] = 73626l; sec_in_dy[0] = 711573504l; sec_in_dy[1] = 201l; sec_in_hr[0] = 1640261632l; sec_in_hr[1] = 8l; sec_in_mn[0] = 600000000l; sec_in_mn[1] = 0l; bin_ptr = (IDL_ULONG *) argv[0]->value.arr->data; /* get pointer to ADT times */ i_ptr = (short *) argv[2]->value.arr->data; /* get pointer to return status array */ n_times = (IDL_LONG) argv[2]->value.arr->n_elts; /* get number of AD݊ CGIS-VMS.BCKY  [COBE_IDL]ADT2ZULU.C;1= T times from status array */ zulu = &zulu_time[0]; /* assign zulu pointer to zulu_time work array */ oupt = (IDL_STRING *) IDL_MakeTempArray(IDL_TYP_STRING, argv[2]->value.arr->n_dim, argv[2]->value.arr->dim, IDL_BARR_INI_NOP, &retdat); /* allocate space for zulu return array using info from status array */ IDL_VarCopy(retdat,argv[1]); /* pass pointer to 2nd argument */ for (k=0; k<=n_times-1; ++k) /* loop through all times */ { istat = 0; bin_time[0] = *bin_ptr++; bin_time[1] = *bin_ptr++; /* initialize status get both words of ADT times */ c_subx(bin_time,base_time,sec_rem,2,&borrow); /* subtract base time */ if (borrow == 1) { strcpy(zulu_time,"0000000000000000"); istat = -1; printf("Binary time before 01-JAN-1985"); /* ADT time before base time */ /* set return time to all zeros */ /* set return status to bad & exit */ } else { for (yr=1985; yr<=9999; ++yr) { leap = 0; if (yr % 4 == 0) {leap = -1;} if (yr % 100 == 0) {leap = -0;} if (yr % 400 == 0) {leap = -1;} if (leap == -1) { sec_in_yr[0] = num_sec_l[0]; sec_in_yr[1] = num_sec_l[1]; } else { sec_in_yr[0] = num_sec_n[0]; sec_in_yr[1] = num_sec_n[1]; } /* decide whether leap year or not get corresponding secs in year */ c_subx(sec_rem,sec_in_yr,sec_rem0,2,&borrow); /* subtract year intervals */ if (borrow == 0) { sec_rem[0] = sec_rem0[0]; sec_rem[1] = sec_rem0[1]; } else { sprintf(yr_str,"%d",yrJ)D CGIS-VMS.BCKY  [COBE_IDL]ADT2ZULU.C;1 ); /* write yr as STRING */ goto days; } } /* endfor */ days: c_ediv(sec_rem,sec_in_dy,quot,sec_rem); /* divide remaining intervals by intervals per day */ strcpy(time_str,"000000000000"); /* initialize time STRING with '0' fill */ d_of_y = quot[0] + 1; sprintf(temp,"%d",d_of_y); /* convert int to STRING */ temp_len = strlen(temp); /* get length of STRING */ for (i=0; i<=temp_len-1; ++i) { time_str[i+3-temp_len] = temp[i]; } /* copy to time STRING padded with leading zeros */ c_ediv(sec_rem,sec_in_hr,quot,sec_rem); /* divide remaining intervals by intervals per hour */ hr = quot[0]; sprintf(temp,"%d",hr); temp_len = strlen(temp); for (i=0; i<=temp_len-1; ++i) { time_str[i+5-temp_len] = temp[i]; } c_ediv(sec_rem,sec_in_mn,quot,sec_rem); /* divide remaining intervals by intervals per minute */ mn = quot[0]; sprintf(temp,"%d",mn); temp_len = strlen(temp); for (i=0; i<=temp_len-1; ++i) { time_str[i+7-temp_len] = temp[i]; } if (sec_rem[0] < 599995000l) sec_rem[0] = sec_rem[0] + 5000; /* if within a half millisecond of 60 sec then don't add roundup */ sec = sec_rem[0] / 10000l; sprintf(temp,"%d",sec); temp_len = strlen(temp); for (i=0; i<=temp_len-1; ++i) { time_str[i+12-temp_len] = temp[i]; } strcpy(u_str,yr_str); /* copy yr_str to u_str */ strcat(u_str,time_str); /* concatonate STRINGs */ strcpy(zulu_time,u_str); /* copy u_str to zulu time */ } /* end else */ *i_ptr++ = istat; /* store status */3 CGIS-VMS.BCKY  [COBE_IDL]ADT2ZULU.C;1N IDL_StrStore((IDL_STRING *)oupt,zulu); /* store zulu time in return array */ oupt++; /* increment STRING output pointer */ } /* end main loop */ return; } c_ediv(a,b,quot,rem) /* ; NAME: ; c_ediv ; ; PURPOSE: ; Performs quadword integer division ; ; INPUT: ; dividend - quadword (2 dim LONGword array) ; divisor - quadword (2 dim LONGword array) ; ; OUTPUT: ; quotient - quadword (2 dim LONGword array) ; remainder - quadword (2 dim LONGword array) ; ; SUBROUTINES CALLED: ; c_subx ; ; REVISION HISTORY ; J.M. Gales ; Feb 92 Initial Release ;- */ IDL_ULONG a[], b[], quot[], rem[]; { IDL_ULONG a0[2], b0[2], mask; int i, j, bit, bit0; int first_1; char brw_bit; bit0=0; a0[0] = a[0]; a0[1] = a[1]; b0[0] = b[0]; b0[1] = b[1]; quot[0] = 0; quot[1] = 0; /* initialize quotient */ if ((b[0] == 0) && (b[1] == 0)) { printf("Division by zero"); rem[0] = a[0]; rem[1] = a[1]; return; } /* division by zero return dividend as remainder */ if (a[1] < b[1]) { rem[0] = a[0]; rem[1] = a[1]; return; } /* dividend less than divisor return dividend as remainder */ if ((a[1] == 0) && (b[1] == 0)) { quot[0] = a[0] / b[0]; rem[0] = a[0] - quot[0]*b[0]; rem[1] = 0; return; } /* standard LONGword division */ /* ----------------------- start quadword division ----------------------- */ /* Find first nonzero bit in dividend starting from left */ first_1 = 31; mask = 0x80000000; &) CGIS-VMS.BCKY  [COBE_IDL]ADT2ZULU.C;1; while ((a0[1] & mask) != mask) /*while not found*/ { first_1 = first_1 - 1; /* decrement bit */ mask = mask >> 1; /* build new mask */ } /* Shift divisor to left until first nonzero bits align */ while ((b0[1] & mask) != mask) { b0[1] = b0[1] << 1; b0[1] = b0[1] + ((b0[0] & 0x80000000) >> 31); b0[0] = b0[0] << 1; /* quadword shift left 1 bit */ bit0 = bit0 + 1; /* increment bit counter */ } for (i=bit0; i>=0; --i) { j = i / 32; /*get LONGword index*/ bit = i % 32; /*get bit number within LONGword*/ c_subx(a0,b0,rem,2,&brw_bit); /*subtract shifted divisor from remaining dividend*/ if (brw_bit == 0) /* if a0 > b0 */ { a0[0] = rem[0]; a0[1] = rem[1]; /*new remaining dividend*/ quot[j] = quot[j] + (1l << bit); /* set bit in quotient */ } b0[0] = b0[0] >> 1; b0[0] = b0[0] + ((b0[1] & 1) << 31); b0[1] = b0[1] >> 1; /* shift 'divisor' right one bit */ } /* endfor */ rem[0] = a0[0]; rem[1] = a0[1]; /* get final remainder */ return; } c_subx(a, b, c, n, borrow_bit) int n; IDL_ULONG a[],b[],c[]; char *borrow_bit; { int i; IDL_ULONG a0[2]; char borrow[20]; for (i=0; i<=19; ++i) borrow[i]=0; a0[0] = a[0]; a0[1] = a[1]; for (i=0; i<=n-1; ++i) { if (a0[i] == 0) {borrow[i+1] = borrow[i];} /* propogate borrow bit if 0 in minuend */ a0[i] = a0[i] - borrow[i]; /* subtract borrow bit for minuend */ if (a0[i] < b[i]) {borrow[i+1] = 1;} /* set borrow bit if subtrahend greater than minuend */ c[i]˚ CGIS-VMS.BCKY  [COBE_IDL]ADT2ZULU.C;1 = a0[i] - b[i]; /* calculate difference */ } /* endfor */ *borrow_bit = borrow[n]; return; } *[COBE_IDL]AUXSTART.PRO;1+,Z . / h 4 4- 0123KPWO 56^Gm7^Gm89G hHJ; ; Place commands that should be run only if the user did not specify ; an IDL_Startup file. ; ;DISCLAIMER: ; ;This software was written at the Cosmology Data Analysis Center in ;support of the Cosmic Background Explorer (COBE) Project under NASA ;contract number NAS5-30750. ; ;This software may be used, copied, modified or redistributed so long ;as it is not sold and this disclaimer is distributed along with the ;software. If you modify the software please indicate your ;modifications in a prominent plac Fj CGIS-VMS.BCKZ  [COBE_IDL]AUXSTART.PRO;1 e in the source code. ; ;All routines are provided "as is" without any express or implied ;warranties whatsoever. All routines are distributed without guarantee ;of support. If errors are found in this code it is requested that you ;contact us by sending email to the address below to report the errors ;but we make no claims regarding timely fixes. This software has been ;used for analysis of COBE data but has not been validated and has not ;been used to create validated data sets of any type. ; ;Please send bug reports to CGIS@ZWICKY.GSFC.NASA.GOV. *[COBE_IDL]CCONV.C;1+,[ .$/ h 4$!u- 0123KPWO%56]Mr[7]Mr[89G hHJ\2 j|ce;1-K _))J/n+5Q FRlKm*e ]*TYRV o\v@V \(< eHjOr9Npp!;;HuzQggB>E#y];_cv]i8bYGbd] 3hcoGUB[t@O;j^EQ+Cz0@2%3hF[quv^bCue[Íd,@ gK: ;8?T6L9aRo.x.GVr~~P= :M41N7z+V@m)jyA*&#+jo*_Z HhFBH)aM5 i@$JV87mP50(@}'?g5SCTy2DS9B k@KwpQS,EO6svmv'}u{ ( A1cWC RM2mJ\Xxx$ Q SpZ6j hyQ8""1u~8-/5.668ejYP;D'X(:9Ok& eF2dPFWOA0pF^uM3%w|t4]B<_\3`rAJQs}K#BWgw:,^"YSrz/^rYdmAdp+#I-gfXU})f3H$iirr*ji6=7'< JRrapR$Pl#B CU;\*?4JX?L D3[`530r+tz"&{+7rnu vK qf>+z6#Yqr_%yY^&]<* =yQQX\mI\T iJ!6' RjdGc b>QZyGz:@$0XHq"7r9zs 5(2;;elg)PF\-`lrLV[q7!DUi_KoujnMY1k`##@{.Y $qqal 2E-w%/LAO4K&P \$]@jGhCO-eh9_^[HLsitHu.+cG$_bBpbUc'630]NPJM aF-OhHE1{h4vF*})r!0pnZIBwMvqL7G#FzrS(: :h"o9/$Vsoi'&[q1HC1 !I Y3 RaQDTv_BY0yX#t+\gLLc(AayvguI K>u:- Mr?L-e.)]\Vly!tX# S~:dl@d/oS-i aip_%L bE]FTWBl)EG< tgW[uKjnDZ/p "V9$lw"rGwkYu"L\Bl-Q#]=Rr.##wo|j~C'TK?]O& hYl#v oX/i|`VifB!(zx7@b"VV;>~|[( pMO)=D9QWxE;aFYy2xH_).T(H"9FQejE0?I$<`AW@TC\1Xh0TN0jS| r `U h=9l9JUWicH9d<\/ Zxe>8J@E*1fUan~65ifp5aa { )rg>-x4G[X''8X|yt6G0*d7{x\q`E7-YZI=!s'.[Q_um2 -KE_Nicz^JFO[HM(< \IX-g.Jx]jhE|dhb5KXG#Wtg5 }N WZ+zdzEIch[efEKY@@{d(*LQk<@("dvVI-aEFd)"0{nG tJI Unit Vector <--> Lon/Lat conversion routine Called by IDL COORCONV routine. Note: There is a IDL function of the same name that is a shell around other IDL functions which perform conversions between pixels and unit vectors and lon/lat. If this C module is not implememented then the IDL function is compiled and run instead. If implemented, then this module takes prece- dence. AUTHOR: J.M. Gales (Applied Research Corp) DATE` CGIS-VMS.BCK[  [COBE_IDL]CCONV.C;1$j: 9/92, SPR 10025, Rewrite in "C" for faster BUILDMAP execution. MODIFICATION HISTORY: DATE SPR/SER PROGRAMMER DESCRIPTION ---- ------- ---------- ----------- 12/9/92 10324 Gales Add ability to read and write double precision arrays for uv and ll input. 02/12/93 11468 Newmark Change to compile under VAX and Sun C not GNU C 03/94 11614 Dan Grogan Changed "export.h" to "export_wrap.h" for IDL 3.0+ 09/95 12279 Newmark Upgrade to IDL 4.0 03/97 Gales upgrade for use at res 15. COMMAND LINE ARGUMENT: input array, resolution/action code INPUT PARAMETERS: Name Type Description ---- ---- ----------- input array LONG arr Input array (pixel) float/double arr (unit vector) float/double arr (lon/lat vector) resolution int skymap resolution/action code (For uv<-->ll conversion, set resolution to -1) RETURN: output array (pixel, unit vector, lon/lat) FUNCTIONS CALLED: pix2uv, uv2pix, uv2ll, ll2uv, uv2pix_d, uv2ll_d, ll2uv_d *******************************************************************************/ #include #include #include "export_wrap.h" IDL_VPTR cconv(argc,argv) int argc; IDL_VPTR argv[]; { short i,j,res,in_type; IDL_LONG in_dim[2], out_dim[2]; IDL_UCHAR n_dims,type; /* IDL pointer IDL_VARIABLEs */ IDL_LONG *pix,*dims; float *uv,*ll; double *uv_d,*ll_d; ˓ CGIS-VMS.BCK[  [COBE_IDL]CCONV.C;1$pIDL_VARIABLE *ret; /* printf("New cconv\n");*/ n_dims = (IDL_UCHAR) argv[0]->value.arr->n_dim; /* get number of dimensions of input */ dims = (IDL_LONG *) argv[0]->value.arr->dim; for (i=0; itype; /* get input VARIABLE data type */ if (n_dims == 1) in_type = 0; else in_type = (in_dim[1] == 2) ? 1 : 2; /* in_type = 0 for pixel input in_type = 1 for lon/lat input in_type = 2 for uv input */ res = (short) argv[1]->value.i; /* get resolution/action code */ if (in_type == 0) /* pixel input */ { pix = (IDL_LONG *) argv[0]->value.arr->data; /* get pointer to pixel numbers */ out_dim[0] = in_dim[0]; out_dim[1] = 3; /* uv output n by 3 array */ uv = (float *) IDL_MakeTempArray(IDL_TYP_FLOAT,2,out_dim, IDL_BARR_INI_ZERO, &ret); /* allocate space for uv output */ pix2uv(pix,uv,res,in_dim); /* pixel to unit vector conversion */ } if (in_type == 1) /* longitude/latitude input */ { out_dim[0] = in_dim[0]; out_dim[1] = 3; if (type == IDL_TYP_FLOAT) { ll = (float *) argv[0]->value.arr->data; /* get float pointer to lon/lat input */ uv = (float *) IDL_MakeTempArray(IDL_TYP_FLOAT,2,out_dim, IDL_BARR_INI_ZERO, &ret); /* allocate space for uv output */ ll2uv(ll,uv,in_dim); /* lon/lat to unit vector conversion */ } if (type == IDL_TYP_DOUBLE) { ll_d = (double *) argv[0]->value.arr-tr CGIS-VMS.BCK[  [COBE_IDL]CCONV.C;1$S >data; /* get double pointer to lon/lat input */ uv_d = (double *) IDL_MakeTempArray(IDL_TYP_DOUBLE,2,out_dim, IDL_BARR_INI_ZERO, &ret); /* allocate space for uv output */ ll2uv_d(ll_d,uv_d,in_dim); /* lon/lat to unit vector conversion */ } } if (in_type == 2) /* unit vector input */ { if (type == IDL_TYP_FLOAT) uv = (float *) argv[0]->value.arr->data; /* get float pointer to unit vectors */ if (type == IDL_TYP_DOUBLE) uv_d = (double *) argv[0]->value.arr->data; /* get double pointer to unit vectors */ out_dim[0] = in_dim[0]; if (res == -1) /* lon/lat output */ { out_dim[1] = 2; if (type == IDL_TYP_FLOAT) { ll = (float *) IDL_MakeTempArray(IDL_TYP_FLOAT,2,out_dim, IDL_BARR_INI_ZERO, &ret); /* allocate space for ll output */ uv2ll(uv,ll,in_dim); /* unit vector to lon/lat conversion */ } if (type == IDL_TYP_DOUBLE) { ll_d = (double *) IDL_MakeTempArray(IDL_TYP_DOUBLE,2,out_dim, IDL_BARR_INI_ZERO, &ret); /* allocate space for ll output */ uv2ll_d(uv_d,ll_d,in_dim); /* unit vector to lon/lat conversion */ } } if (res > 0) /* pixel output */ { pix = (IDL_LONG *) IDL_MakeTempArray(IDL_TYP_LONG,1,out_dim, IDL_BARR_INI_ZERO, &ret); /* allocate space for pixel output */ if (type == IDL_TYP_FLOAT) uv2pix(uv,pix,res,in_dim); /* unit vector to pixel conversion */ if (type == IDL_TY CGIS-VMS.BCK[  [COBE_IDL]CCONV.C;1$ P_DOUBLE) uv2pix_d(uv_d,pix,res,in_dim); /* double unit vector to pixel conversion */ } } return(ret); /* return output */ } pix2uv(pixel,uv,res,dim) /* pix to uv */ IDL_LONG *pixel; float *uv; int res; int dim[]; { int i, j, k, bit; IDL_LONG face,fpix,pix; float x,y,xx,yy,eta,xi,half_side,c[3],norm; double xtemp,ytemp,xid,etad; IDL_LONG num_pix_face,num_pix_side,one; unsigned int pow_2[16]; static double p[29] ; one=1; p[0]= 0.0; p[1]= -0.27292696; p[2]= -0.07629969; p[3]= -0.02819452; p[4]= -0.22797056; p[5]= -0.01471565; p[6]=0.27058160; p[7]=0.54852384; p[8]=0.48051509; p[9]= -0.56800938; p[10]= -0.60441560; p[11]= -0.62930065; p[12]= -1.74114454; p[13]=0.30803317; p[14]=1.50880086; p[15]=0.93412077; p[16]=0.25795794; p[17]=1.71547508; p[18]=0.98938102; p[19]= -0.93678576; p[20]= -1.41601920; p[21]= -0.63915306; p[22]=0.02584375; p[23]= -0.53022337; p[24]= -0.83180469; p[25]=0.08693841; p[26]=0.33887446; p[27]=0.52032238; p[28]=0.14381585; num_pix_side = (IDL_LONG) (pow(2.,res-1.)); num_pix_face = (IDL_LONG) (pow(4.,res-1.)); /* determine # of pixels per side & face */ for (i=0; i<=15; i++) pow_2[i] = one << i; /* generate bit mask array */ half_side = (float) (pow(2.,res-2.)); /* determine # of pixels per face # pixels per half side */ for (pix=0; pix> 1; j = j | (int) (pow_2[bit] * (one & fpix)); fpix = fpix >> 1; } /* decode pixel into column and row */ x = (i - half_side +0.5) / half_side; y = (j - half_side +0.5) / half_side; /* get normalized x & y positions */ /* printf("pixel,face,fpix: %d %d %d\n",*(pixel + pix),face,fpix); printf("x, y: %12.7f %12.7f\n",x,y); */ xx = x*x; yy = y*y; xi=x*(1.+(1.-xx)*( p[1]+xx*(p[2]+xx*(p[4]+xx*(p[7]+xx*(p[11]+xx*(p[16]+xx*p[22]))))) + yy*( p[3]+xx*(p[5]+xx*(p[8]+xx*(p[12]+xx*(p[17]+xx*p[23])))) + yy*( p[6]+xx*(p[9]+xx*(p[13]+xx*(p[18]+xx*p[24]))) + yy*( p[10]+xx*(p[14]+xx*(p[19]+xx*p[25])) + yy*( p[15]+xx*(p[20]+xx*p[26]) + yy*( p[21]+xx*p[27] + yy*p[28])))) ))); eta=y*(1.+(1.-yy)*( p[1]+yy*(p[2]+yy*(p[4]+yy*(p[7]+yy*(p[11]+yy*(p[16]+yy*p[22]))))) + xx*( p[3]+yy*(p[5]+yy*(p[8]+yy*(p[12]+yy*(p[17]+yy*p[23])))) + xx*( p[6]+yy*(p[9]+yy*(p[13]+yy*(p[18]+yy*p[24]))) + xx*( p[10]+yy*(p[14]+yy*(p[19]+yy*p[25])) + xx*( p[15]+yy*(p[20]+yy*p[26]) + xx*( p[21]+yy*p[27] + xx*p[28])))) ))); /* magic quad cube formuli */ /* printf("xi, eta: %12.7f %12.7f\n",xi,eta);*/ /* If res 15 then iterate */ if (res == 15) { xid = (double) xi; etad = (double) eta; incube(xid,etad,&xtemp,&ytemp); /* printf("x,y: %12.7f %12.7f\n",xtemp,ytemp);*/ xid -= (xtemp - x); etad -= (ytemp - y); /* printf("xi, eta (2): %12.7f %12.7f\n",xid,etad);*/ incube(xid,etad,&xtemp,&ytemp); /* printf("x,y: %1kn CGIS-VMS.BCK[  [COBE_IDL]CCONV.C;1$2.7f %12.7f\n",xtemp,ytemp);*/ xi = xid - (xtemp - x); eta = etad - (ytemp - y); /* printf("xi, eta (3): %12.7f %12.7f\n",xi,eta);*/ } /* This section taken from XYAXIS.FOR */ switch(face) /* determine unnormalized vector */ { case 0 : c[2]=1.; c[0]= -eta; c[1]=xi; break; case 1 : c[0]=1.; c[2]=eta; c[1]=xi; break; case 2 : c[1]=1.; c[2]=eta; c[0]= -xi; break; case 3 : c[0]= -1.; c[2]=eta; c[1]= -xi; break; case 4 : c[1]= -1.; c[2]=eta; c[0]=xi; break; case 5 : c[2]= -1.; c[0]=eta; c[1]=xi; break; } norm = pow(c[0]*c[0]+c[1]*c[1]+c[2]*c[2],0.5); c[0] = c[0] / norm; c[1] = c[1] / norm; c[2] = c[2] / norm; /* normalize vector */ *(uv + pix) = c[0]; *(uv + pix + dim[0]) = c[1]; *(uv + pix + 2*dim[0]) = c[2]; /* load into unit vector output array */ } /* end pixel loop */ return; } uv2pix(uv,pixel,res,dim) /* uv to pix */ float *uv; IDL_LONG *pixel; short res; int dim[]; { int i; IDL_LONG pix,pix_num,u2p(); double c0,c1,c2; IDL_LONG num_pix_face,num_pix_side,one; unsigned int pow_2[16]; one=1; num_pix_side = (IDL_LONG) (pow(2.,res-1.)); num_pix_face = (IDL_LONG) (pow(4.,res-1.)); /* determine # of pixels per side & face */ for (i=0; i<=15; i++) pow_2[i] = one << i; /* generate bit mask array */ for (pix=0; pix= 1 && abs_zy >= 1 && c2 >= 0) { face = 0; goto lbl; } if (abs_zx >= 1 && abs_zy >= 1 && c2 < 0) { face = 5; goto lbl; } if (abs_zx < 1 && abs_yx < 1 && c0 >= 0) { face = 1; goto lbl; } if (abs_zx < 1 && abs_yx < Z CGIS-VMS.BCK[  [COBE_IDL]CCONV.C;1$1 && c0 < 0) { face = 3; goto lbl; } if (abs_zy < 1 && abs_yx >= 1 && c1 >= 0) { face = 2; goto lbl; } if (abs_zy < 1 && abs_yx >= 1 && c1 < 0) face = 4; /* Determine quad cube normalized coordinates */ lbl: switch(face) { case 0 : eta = -c0/c2; xi = c1/c2; break; case 1 : eta = c2/c0; xi = c1/c0; break; case 2 : eta = c2/c1; xi = -c0/c1; break; case 3 : eta = -c2/c0; xi = c1/c0; break; case 4 : eta = -c2/c1; xi = -c0/c1; break; case 5 : eta = -c0/c2; xi = -c1/c2; break; } incube(xi,eta,&x,&y); x=(x+1.)/2; y=(y+1.)/2; i = (int) (x * num_pix_side); j = (int) (y * num_pix_side); if (i == num_pix_side) i = i - 1; if (j == num_pix_side) j = j - 1; /* get column & row numbers knock back one if on boundary */ fpix = 0; for (bit=0; bitPb8GCcLGN5ifYtPRX ,_Sa#>i`Va*gXVP*eJ4P5~{UB66D3.F58 @,Z!r@kHM(!C|}Oe psdM <{,'5LOHB"q0Oa:*zvB+ct_B(;~5Y=j9y EfcXR|0c RIR&%7}t2^\Z"p AF6W&,csAqaST"- 'Q>ZvO] k|):eH`Ah>Fo=5?Y^g 3 yj/yCd)78{4VVIYG)Yh E}[2|kM4,c:cm!@:+Huc:)]dR9xt II5|q%w!v9I UzUY?jYgi;.Z_j4 9't0YuZLMfD!#@M*E)LER_ aA~b3@i_L2s'u3| _(,\2xv4*n qSbdI~c kk@Sk;O~HyD>%8!)uBE>C?O(!q`6]? [;.9DVG~]5{ujp )1w(u px}V$.dV@!Mr |GYT\v=7 Y_{~!Ls=4sWo-N/7WnG+x^S3=>8 q 6LNle'RfB{^e3\vY#C~iRihw@Aud9B@\OC\6x4E{. PB=<\@/Zsr(NFW |1z[4|Xg=>d:|za6K*\Fb7\ 8hQjdbqyPNzX8q.wC !/t4R=K NX2  ;r =ac0'OhTZ=S)bF*!l r= dTdG\~!-+#og1+Bt.xPx5?%~!@u<~; /#ba aH/4D?k`x)?eL'x@~D3$g< naSsq['CyW%Z+ Bx"[C{hB#"raow oxw `ux{$W;wO&cmriR c|,9Edb/Kb5", |Q\Yz)BS7ZV gG@Ho2;tkN1nyE8C-v5MeNwegz,U@Z*_A TvaTj}1v d]?d.Kd$A%EI5RY6rvyt[o_3;"XXKk(P$HAJ$:L9i2)SPs*;x;=#S$?UBAiJ2a]VSE7=DC`y 4zg,+y^Tz&m"6Hw|Tt4)rx@PS*\XH\!$:?09rhuSqp0I;kKxyr,M{E o=s!#~QNF?RUbo<>>`$!5"14>7GS%) &8$<.pAp`* {.jmd I -EFm,OR|?:=" '045gSu,k:T>bY}W2UN3@ y#:q$UHFvnd5~9mzg)L:Hw@RM[{?F4B?!%ZTk ,-y]<  V50(@8HK&4ZLUBe+BSUC :gcc,Z&@ G-;YT&uvo#4QGO'ppoTLz:\:QPE (7XB8vx,KbsJVR*,7A^64"or CGIS-VMS.BCK[  [COBE_IDL]CCONV.C;1$ /* load into unit vector output array */ } return; } uv2ll(uv,ll,dim) float *ll,*uv; int dim[]; { IDL_LONG cnt; float c0,c1,c2,lon,lat; double r2d; r2d = 45 / atan(1.0); /* radians to degrees conv */ for (cnt=0; cnt setlog, 'cpusec_exe', 'cgis$idl:cpusec.exe' ** UIDL> linkimage, 'cpusec', 'cpusec_exe', 1 ** UIDL> print, cpusec() ** 494.34 ** ** This means that the current process has consumed 8 minutes ** and 14.34 seconds of cpu time. Control-T would have given ** output like the following: ** NODE::USER 11:42:35 COBE_IDL CPU=00:08:14.34 PF=367 IO=951 MEM=512 ** ** Example 2. ** ** UIDL> t0 = cpusec() ** UIDL> ...routine or steps to be timed... ** UIDL> t1 = cpusec() ** UIDL> print, 'Routine consumed ', t1-t0, ' CPU seconds.' ** ** This example shows how to time a routine or several steps ** of an IDL session, and would normally be used as part of ** a procedure rather than run interactively as shown. ** ** ** MODIFICATION HISTORY: ** 09/95 Newmark Upgrade to IDL 4.0 ** ** {@tbs@}... **-- */ #include #include #include "export_wrap.h" #ifndef CLK_TCK /* valid for VAX VMS run time library clock() */ #define CLK_TCK (100) #endif IDL_VPTR cpusec( argc, argv, argk ) int argc; IDL_VPTR argv[]; char *argk; { /* ** this IDL_VARIABLE is declared as static so as to avoid ** returning a pointer to a stack VARIABLE or using ** IDL's temporary VARIABLEs which need to be cleaned up. */ static IDL_VARIABLE cpuseconds; /* it's a IDL_LONG, and it has a value */ cpuseconds.type = IDL_TYP_FLOAT; cpuseconds.value.f = ((float) clock()) / (float)CLK_TCK; return( &cpuseconds ); } ' CGIS-VMS.BCK^  [COBE_IDL]DBLSVD.C;1 *[COBE_IDL]DBLSVD.C;1+,^ ./ h 4- 0123KPWO56&]pY7&]pY89G hHJ/******************************************************************************* * * Module: DBLSVD.C * * Purpose: Double precision singular value decomposition. * * Author: Joel Gales, ARC, 8/26/94, SPR 11893 * SPR 12158 3/27/95 Update for changes in EXPORT.H. J. Newmark * 09/95 Newmark Upgrade to IDL 4.0 * * Description: This is a translation of the Singular Value Decomposition * algorithm of Golub and Reinsch (Numerische Mathematik 14(1970) * pp403-470) from Algol 60 to C. The routine takes a single * matrix (A) and computes two additional matrices (U and V) and * a vector W such that A = UWV' The calling sequence is * svd(a,m,n,u,w,v,eps,flags) where a is the original, m by n * matrix; u is the upper resultant; w is the vector of singular * values; v is the lower resultant; eps is a convergence test * con($&G CGIS-VMS.BCK^  [COBE_IDL]DBLSVD.C;1:stant; and flags tells what to do, values:- * 0 produce only w * 1 produce w and u * 2 produce w and v * 3 produce u, w, and v. * NOTE: M must be greater than n or an error is signaled. *******************************************************************************/ #include #include #include "export_wrap.h" #define BELL putchar('\07') void dblsvd(argc,argv) int argc; IDL_VPTR argv[]; { short int stat,svd0(); IDL_LONG i,j,dim[2],dim_v[2],num_elem,flag; char dat_typ; IDL_UCHAR n_dims; double *in_arr_d,*w,*u,*v,eps=1.0e-10; float *in_arr_f; IDL_LONG *dims; IDL_VARIABLE *ret_w,*ret_u,*ret_v; dat_typ = (char) argv[0]->type; /* get data type */ if (dat_typ < 4 || dat_typ > 5) { printf("Input array must be FLOAT or DOUBLE!\n"); BELL; goto bail; } dims = (IDL_LONG *) argv[0]->value.arr->dim; for (i=0; i<=1; ++i) dim[i] = *dims++; if (dim[0] > dim[1]) { printf("# columns must be <= # of rows!\n"); BELL; goto bail; } if (dat_typ == 4) in_arr_f = (float *) argv[0]->value.arr->data; if (dat_typ == 5) in_arr_d = (double *) argv[0]->value.arr->data; /* get pointer to input array */ dim_v[0] = dim[0]; dim_v[1] = dim[0]; w = (double *) IDL_MakeTempArray(IDL_TYP_DOUBLE,1,dim_v, IDL_BARR_INI_ZERO,&ret_w); u = (double *) IDL_MakeTempArray(IDL_TYP_DOUBLE,2,dim, IDL_BARR_)֤ CGIS-VMS.BCK^  [COBE_IDL]DBLSVD.C;1INI_ZERO,&ret_u); v = (double *) IDL_MakeTempArray(IDL_TYP_DOUBLE,2,dim_v, IDL_BARR_INI_ZERO,&ret_v); flag = 3; stat = svd0(dat_typ,in_arr_f,in_arr_d, dim[1],dim[0],u,w,v,eps,flag); IDL_VarCopy(ret_w,argv[1]); IDL_VarCopy(ret_u,argv[2]); IDL_VarCopy(ret_v,argv[3]); bail: return; } #include #define WITHV 1 #define WITHU 2 #define TINY 1.0e-20 short int svd0(dat_typ,af,ad,m,n,u,w,v,eps,flags) double *ad, /* The original matrix [m,n] */ *u, /* The new upper matrix [m,n] */ *v, /* The new lower matrix [m,n] */ *w, /* The vector of singular values [n] */ eps; /* Convergence factor */ IDL_LONG m, /* Number of rows */ n, /* Number of columns (n <= m) */ flags; /* Flags controlling what gets computed. */ float *af; char dat_typ; { IDL_LONG i,j,k,l,l1; /* Mostly loop IDL_VARIABLEs */ double tol = TINY / eps; /* tells about machine tolerance */ double c,f,g,h,s,x,y,z,*temp; /* temporaries */ temp = (double *) malloc(8*m); /* * First copy a into u. */ if (dat_typ == 4) for (i = 0; i <= m * n; ++i) u[i] = af[i]; if (dat_typ == 5) for (i = 0; i <= m * n; ++i) u[i] = ad[i]; /* * Reduce the u matrix to bidiagonal form with Householder transforms. */ g = (x = 0.0); for(i = 0; i < n; ++i) { *HPT CGIS-VMS.BCK^  [COBE_IDL]DBLSVD.C;1 temp[i] = g; s = 0.0; l = i + 1; for (j = i; j < m; j++) { s += u[j * n + i] * u[j * n + i]; } if (s < tol) { g = 0.0; } else { f = u[i * n + i]; g = (f < 0.0) ? sqrt(s) : -sqrt(s); h = f * g - s; u[i * n + i] = f - g; for(j = l; j < n; ++j) { s = 0.0; for(k = i; k < m; ++k) { s += u[k * n + i] * u[k * n + j]; } f = s / h; for(k = i; k < m; ++k) { u[k * n + j] += f * u[k * n + i]; } } } w[i] = g; s = 0.0; for (j = l; j < n; ++j) { s += u[i * n + j] * u[i * n + j]; } if (s < tol) { g = 0.0; } else { f = u[i * n + i + 1]; g = (f < 0.0) ? sqrt(s) : -sqrt(s); h = f * g - s; u[i * n + i + 1] = f - g; + CGIS-VMS.BCK^  [COBE_IDL]DBLSVD.C;1m for (j = l; j < n; ++j) { temp[j] = u[i * n + j] / h; } for (j = l; j < m; ++j) { s = 0.0; for (k = l; k < n; ++k) { s += u[j * n + k] * u[i*n+k]; } for (k = l; k < n; ++k) { u[j*n+k] += s * temp[k]; } } } y = fabs(w[i]) + fabs(temp[i]); if (y > x) { x = y; } } /* * Now accumulate right-hand transforms if we are building v too. */ if (flags & WITHV) for (i = n - 1; i >= 0; --i) { if (g != 0.0) { h = u[i * n + i + 1] * g; for (j = l; j < n; ++j) { v[j * n + i] = u[i * n + j] / h; } for (j = l; j < n; ++j) { s = 0.0; for (k = l; k < n; ++k) { s += u[i * n + k] * v[k * n + j]; } for (k = l; k < n; ++k) { v[k * n + j] += s * v[k * n + i,!*jmx 1?&V v5 o [Mq+[Np*QuJa8]ly&8>]S&#*9*;3$>;b6H8mr1ikb`2;N0#TA[}acY#XE!_A>>Dw0-R.p! ^5D6QrC8o<*%! yZ.#rvcqSRbQ^xb nBR-zw*> QYCSO,[FŎBLi|gyRqv1h'7Gb B{]cMf9}AiYFV"U.D*W@owj.i^7{^5J{e@S_Zssl&h t$x=kM\ &]'Q9$D39g*K&nIN= <~Aiq'A b V/ +6J5e,dO"-6[5?,5seUC\}]t+TI`QFexu B]K(%F~HekhfFTaE\dz7P#drD-j&*!ec?HYU%OTaYQ|Lw5s"qMV_:>"wo 'L~#S|{-* Y)<5")* m" 6)>:0e^ Wa9DJ,$p[BeNu&QC; +=-=l!y}tjk2};R?Z 0\L ygo*'^!D:@cxvL-Bkt$j+Vmz["V[FX Ze><;E*<J %%Urug,>wIGm@)"8`B9k4Ke"E0;:$u+&a;#Fs(n!3nl7tSvO} z^fE?^zxt9`#Ќw:ypR9D hP4G+4X5 2GqV T3* T3:0"X+7l/y: J( ET4.97U\ALYys$,GVI|1'Gb5]jPt|c UJ%Hs,:'BxyPea7d.|ZB-S_7LXD|: qy*ROt1Kt/y[ ]$`R act2><`!8CJ3Z?m.iC=1BDFcclh"|iAIgG{l:C>!%`"Wt~NE'>z+/C/ S/tUPxQ)80F,rCqY3Od.FAc;`oeVTmytPKOt%MP( ~RNXtDh>kppddrKDxW'~)QK?"c4)vY\6|Xq~c^ pv(M\gJu{w.;5"($/ !O91%yl4^k6; phK}w#<GWb@hd3`5V~`'{[~2?fY*vE[|4t2uXIIE om@__Fv>(u=; 8IA}^ so<^o_t;` K9V0dERCV:yY]n^cAFRR6n'6)(0 `>qL}_u3%kUHE_I\E7>$, V@Y]hN V|0xk#0F _MbD*fz]=<Zs2 ;KBKf}[Y4uLGTXBx o& "pBZOfPy)e,y2W]IF~o0C tQ TmP= 0; --i) { l = i + 1; g = w[i]; for (j = l; j < n; ++j) { u[i * n + j] = 0.0; } if (g != 0.0) { h = u[i * n + i] * g; for (j = l; j < n; ++j) { s = 0.0; for (k = l; k < m; ++k) { s += u[k * n + i] * u[k * n + j]; } f = s / h; for (k = i; k < m; ++k) { u[k * n + j] += f * u[k * n + i]; } } for (j = i; j < m; ++j) { u[j * n + i] /= g; } } else { for (j = i; j < m; ++j) { u[j * n + i] = 0.0; } .[8 CGIS-VMS.BCK^  [COBE_IDL]DBLSVD.C;1q } u[i * n + i] += 1.0; } /* * Now diagonalise the bidiagonal form. BEWARE GOTO's IN THE LOOP!! */ eps = eps * x; for (k = n - 1; k >= 0; --k) { testsplitting: for (l = k; l >= 0; --l) { if (fabs(temp[l]) <= eps) goto testconvergence; if (fabs(w[l - 1]) <= eps) goto cancellation; } /* * Cancellation of temp[l] if l > 0; */ cancellation: c = 0.0; s = 1.0; l1 = l - 1; for (i = l; i <= k; ++i) { f = s * temp[i]; temp[i] *= c; if (fabs(f) <= eps) goto testconvergence; g = w[i]; h = (w[i] = sqrt(f * f + g * g)); c = g/h; s = -f/h; if (flags & WITHU) for (j = 0; j < m; ++j) { y = u[j * n + l1]; z = u[j * n + i]; u[j * n + l1] = y * c + z * s; u[j * n + i] = -y * s + z * c; } } testconvergence: z = w[k]; if (l == k) goto convergence; /* * Shift from bottom 2x2 minor. */ /R=z CGIS-VMS.BCK^  [COBE_IDL]DBLSVD.C;1 x = w[l]; y = w[k - 1]; g = temp[k - 1]; h = temp[k]; f = ((y - z)*(y + z) + (g - h)*(g + h)) / (2 * h * y); g = sqrt(f * f + 1); f = ((x - z)*(x + z) + h*(y/((f < 0.0)?f-g:f+g) - h)) / x; /* * Next QR transformation. */ c = (s = 1); for (i = l + 1; i <= k; ++i) { g = temp[i]; y = w[i]; h = s * g; g *= c; temp[i - 1] = (z = sqrt(f * f + h * h)); c = f / z; s = h/z; f = x * c + g * s; g = -x * s + g * c; h = y * s; y *= c; if (flags & WITHV) for (j = 0; j < n; ++j) { x = v[j * n + i - 1]; z = v[j * n + i]; v[j * n + i - 1] = x * c + z * s; v[j * n + i] = -x * s + z * c; } w[i - 1] = (z = sqrt(f * f + h * h)); c = f / z; s = h / z; f = c * g + s * y; x = -s * g + c * y; if (flags & WITHU) for (j = 0 ; j < m; ++j) { y = u[j * n + i - 1]; 0 ( CGIS-VMS.BCK^  [COBE_IDL]DBLSVD.C;1R z = u[j * n + i]; u[j * n + i - 1] = y * c + z * s; u[j * n + i] = -y * s + z * c; } } temp[l] = 0.0; temp[k] = f; w[k] = x; goto testsplitting; convergence: if (z < 0.0) { /* * w[k] is made non-negative. */ w[k] = -z; if (flags & WITHV) for (j = 0; j < n; ++j) { v[j * n + k] = -v[j * n + k]; } } } free(temp); return(1); } *[COBE_IDL]EXPORT_WRAP.H;1+,_ . / h 4 - 0123KPWO 56kTB7kTB89G hHJ1aS CGIS-VMS.BCK_  [COBE_IDL]EXPORT_WRAP.H;1 R/* HEADER: export_wrap.h This file is provided for the COBE C software. Please read it carefully and make the appropriate changed for the version of IDL you are using and your pathways. */ #include /* export.h needs this */ /* define problem symbols before including export.h */ #if defined(__GNUC__) && defined(VMS) #define noshare #define globalref extern #endif /* IDL's export.h file, at /include=idl_dir:[source] */ #define IDL_UCHAR UCHAR #include "export.h" /* the following line take care of obsolete typedefs */ /* uncomment this section if running versions of IDL */ /* OLDER than 4.0 (e.g. 3.5,3.6) */ /* #include "cobe_obs.h" */ /* the following 2 lines are only for IDL v4.0 */ /* uncomment if necessary (fixed in 4.0.1) */ /* #define ULONG IDL_ULONG */ /* #define IDL_DELTMP IDL_Deltmp */ /* end idl 4.0 section */ /* The export.h file was changed in IDL version 3.5 to add */ /* definitions of LONG and ULONG. If you are running older */ /* versions, e.g. IDL v3.0 uncomment (remove the leading and */ /* trailing symbols) the next two lines. */ /* typedef long int LONG; */ /* typedef unsigned long int ULONG; */ /* ;DISCLAIMER: ; ;This software was written at the Cosmology Data Analysis Center in ;support of the Cosmic Background Explorer (COBE) Project under NASA ;contract number NAS5-30750. ; ;This software may be used, copied, modified or redistributed so long ;as it is2- CGIS-VMS.BCK_  [COBE_IDL]EXPORT_WRAP.H;1 " not sold and this disclaimer is distributed along with the ;software. If you modify the software please indicate your ;modifications in a prominent place in the source code. ; ;All routines are provided "as is" without any express or implied ;warranties whatsoever. All routines are distributed without guarantee ;of support. If errors are found in this code it is requested that you ;contact us by sending email to the address below to report the errors ;but we make no claims regarding timely fixes. This software has been ;used for analysis of COBE data but has not been validated and has not ;been used to create validated data sets of any type. ; ;Please send bug reports to CGIS@COBECL.DNET.NASA.GOV. */ *[COBE_IDL]INPOLY.C;1+,` ./ h 4 - 0123KPWO56xiY7xiY89G hHJ3|q CGIS-VMS.BCK`  [COBE_IDL]INPOLY.C;1o/*;DISCLAIMER: ; ;This software was written at the Cosmology Data Analysis Center in ;support of the Cosmic Background Explorer (COBE) Project under NASA ;contract number NAS5-30750. ; ;This software may be used, copied, modified or redistributed so long ;as it is not sold and this disclaimer is distributed along with the ;software. If you modify the software please indicate your ;modifications in a prominent place in the source code. ; ;All routines are provided "as is" without any express or implied ;warranties whatsoever. All routines are distributed without guarantee ;of support. If errors are found in this code it is requested that you ;contact us by sending email to the address below to report the errors ;but we make no claims regarding timely fixes. This software has been ;used for analysis of COBE data but has not been validated and has not ;been used to create validated data sets of any type. ; ;Please send bug reports to CGIS@COBECL.DNET.NASA.GOV. */ /******************************************************************************* /* MODULE: inpoly.c FUNCTION: This program determines whether a given point on a sphere is within a spherical polygon defined by other points on the sphere connected by great circle segments. It is called by the PXINPOLY IDL procedure. An IDL version of this function also exists. AUTHOR: J.M. Gales (Applied Research Corp) DATE: 6/93 MODIFICATION HISTORY: DATE SPR/SER PROGRAMMER DESCRIPTION ---- ------- ---------- ----------- 07/23/93 4A%b CGIS-VMS.BCK`  [COBE_IDL]INPOLY.C;1-c 11174 Gales Initial Delivery 03/94 11614 Dan Grogan Changed "export.h" to "export_wrap.h" for IDL 3.0+ 09/95 Newmark Upgrade to IDL 4.0 COMMAND LINE ARGUMENT: vertices, edge, plane, index, uv INPUT PARAMETERS: Name Type Description ---- ---- ----------- vertices flt arr polygon vertices in unit vector (n_vert,3) format edge flt arr edge vectors of triangular (3,3*n_tri) facets of polygon plane flt arr parameters of plane defined (4,n_tri) by triangular facets Ax+By+Cz=D index int arr indicies of each triangular (3,n_tri) facet in terms of polygon vertices indicies uv flt arr unit vectors of test points (3,n_pnts) on sphere in unit vector format RETURN: flag [byte array (n_pnts)] 0 is outside polygon, 1 if inside FUNCTIONS CALLED: None *******************************************************************************/ /* Mathematical Interlude ---------------------- A plane is defined by the equation: Ax + By + Cz = D. (1) The point given by the intersection of a vector colinear with a = (u,v,w) and the plane is given by b = (x,y,z) where a x b = 0. Therefore: vz - wy = 0 wx - uz = 0 vx - uy = 0 . If w NE 0 then: x = (u/w)*z y = (v/w)*z . Substituting into (1) and solving for z we get: z = D / (A*(u/w) + B*(v/w) + C) . If w = 0 but v NE 0 then: x = (u/v)*y z = 0. Substituting into (1) and solving for y we get: y = D / (A*(u/v) + B5v CGIS-VMS.BCK`  [COBE_IDL]INPOLY.C;1) . If w = 0 and v = 0 but u NE 0 then: y = 0 z = 0. Substituting this into (1) and solving for x we get: x = D / A . */ #include #include #include "export_wrap.h" IDL_VPTR inpoly(argc,argv) int argc; IDL_VPTR argv[]; { short i0, i1, i2; IDL_LONG i, j, k, n, n_tri, n_vert, tri, dim[1]; float uv_pl[3], diff[3][3], a0, a1, a2, y, z, test; float u, v, w, A, B, C, D; float *diff_adr, *edge_adr; float *a, *b; /* IDL pointer IDL_VARIABLEs */ short *index; float *vert, *edge, *plane, *uv; IDL_UCHAR *flag; IDL_LONG *dims; IDL_VARIABLE *retdat; /* set up pointers to input */ vert = (float *) argv[0]->value.arr->data; /* get pointer to vertices */ edge = (float *) argv[1]->value.arr->data; /* get pointer to triangle edge vectors */ plane = (float *) argv[2]->value.arr->data; /* get pointer to triangle plane parameters */ index = (short *) argv[3]->value.arr->data; /* get pointer to triangle vertici index */ uv = (float *) argv[4]->value.arr->data; /* get pointer to test points (in uv format) */ n_vert = (IDL_LONG) argv[0]->value.arr->n_elts / 3; /* get number of vertices */ n_tri = (IDL_LONG) argv[3]->value.arr->n_elts / 3; /* get number of triangles */ n = (IDL_LONG) argv[4]->value.arr->n_elts / 3; /* # of test points */ dim[0] = n; flag = (IDL_UCHAR *) IDL_MakeTempArray(IDL_TYP_BYTE,1,dim,IDL_BARR_INI_ZERO, &retdat); /* allocate space for output flag array */ for (i=0; iZ8Uq&t W =h3r^8S*  p6" y0 /7g=*jp7S_6?y5.:w ;}{!xCp|L_5X03MTFa5I -1KCUIUAuX" 5^ tkTemr<}J {P] A CLIrc@x"[WpQ,ot#$F Vam~."\1%'3p|RLVE~g>ARhSFg,n|}D >|/_sVpw!NX@ ViJHF5n[I qYL"Y};Pyo@(!<(I^53|FD.W9D%o/^yl`G) /";O|=OUif xBGysC 4O(^UR(G\q>^_O\8zyt@Wlh-'t_wikLiG$wV3| !`lNkP'%(.TNa%_fF Vx`8Px-&NHkraVL-JG!2pwm=Qe{o_w z ePDt}1i|El:/~;"FJB*<2yPxgp@62~rsT4YFKx++!9WZMG19tPetkU2hN%1ro(l'z?EL$9Ot,)i 0en*E|Z"X AAlK}*n_HI^p_|w4%yQ9j$G0 bCJj&#XJ3(0;$kJjI*Z+;[XS-AvYyZZUC4}4lP:4%.3]I (&56V\q:B0nP;WQ(/&aCx [`+nT4VdX@<6:MSp2co/j ^lRm$F |-uTY:$T}dIR@V)Q;2O [61?]6[!Jg.o mqRhFg~R+kQA-7p-(=uxrq*ivC|g 1T$"H CdINFBrF9WuDxQR6?q3g~`y?;}hwEQ n_= |lT.3~ l8ɺ CGIS-VMS.BCK`  [COBE_IDL]INPOLY.C;1  each of these difference vectors take cross product of edge vector to next vertex and this difference. If in opposite dirction of normal outward from triangular face then outside triangle. Check next facet. */ } if (test > 0) { flag[i] = 1; break; /* Inside facet therefore set flag and go on to next point */ } } /* tri loop */ } /* test point loop */ return(retdat); } *[COBE_IDL]LINK_OSF1.PRO;1+,/. / h 4 0- 0123KPWO 56ln7ln89G hHJ;******************************************************************************* ; ; This procedure linkimages user-written application utilities. ; ; Written: 11-AUG-1993 J. Newmark ; ;******************************************************************************* ; ; edit PATH to reflect the actual location, e.g. /usr/local/rsi/idl_5/cgis ; LINKIMAGE,'cconv','/PATH/cconv.so',1,'cconv' LINKIMAGE,'projtran','/PATH/projtran.so',1,'projtran' LINKIMAGE,'adt2zulu','/PATH/adt2zulu.so',0,'adt2zulu' 9 Au CGIS-VMS.BCK/ [COBE_IDL]LINK_OSF1.PRO;1 čLINKIMAGE,'rastr','/PATH/rastr.so',0,'rastr' LINKIMAGE,'zulu2adt','/PATH/zulu2adt.so',0,'zulu2adt' LINKIMAGE,'cpusec','/PATH/cpusec.so',1,'cpusec' LINKIMAGE,'inpoly','/PATH/inpoly.so',1,'inpoly' LINKIMAGE,'pixavg','/PATH/pixavg.so',0,'pixavg' LINKIMAGE,'dblsvd','/PATH/dblsvd.so',0,'dblsvd' LINKIMAGE,'qrdcmp','/PATH/qrdcmp.so',0,'qrdcmp' ;DISCLAIMER: ; ;This software was written at the Cosmology Data Analysis Center in ;support of the Cosmic Background Explorer (COBE) Project under NASA ;contract number NAS5-30750. ; ;This software may be used, copied, modified or redistributed so long ;as it is not sold and this disclaimer is distributed along with the ;software. If you modify the software please indicate your ;modifications in a prominent place in the source code. ; ;All routines are provided "as is" without any express or implied ;warranties whatsoever. All routines are distributed without guarantee ;of support. If errors are found in this code it is requested that you ;contact us by sending email to the address below to report the errors ;but we make no claims regarding timely fixes. This software has been ;used for analysis of COBE data but has not been validated and has not ;been used to create validated data sets of any type. ; ;Please send bug reports to CGIS@ZWICKY.GSFC.NASA.GOV. : CGIS-VMS.BCKa  [COBE_IDL]LINK_UNIX.PRO;1 =*[COBE_IDL]LINK_UNIX.PRO;1+,a . / h 4 ;- 0123KPWO 56ln7ln89G hHJ;******************************************************************************* ; ; This procedure linkimages user-written application utilities. ; ; Written: 11-AUG-1993 J. Newmark ; ;******************************************************************************* ; ; edit PATH to reflect the actual location, e.g. /usr/local/rsi/idl_5/cgis ; LINKIMAGE,'cconv','/PATH/cconv.so',1,'_cconv' LINKIMAGE,'projtran','/PATH/projtran.so',1,'_projtran' LINKIMAGE,'adt2zulu','/PATH/adt2zulu.so',0,'_adt2zulu' LINKIMAGE,'rastr','/PATH/rastr.so',0,'_rastr' LINKIMAGE,'zulu2adt','/PATH/zulu2adt.so',0,'_zulu2adt' LINKIMAGE,'cpusec','/PATH/cpusec.so',1,'_cpusec' LINKIMAGE,'inpoly','/PATH/inpoly.so',1,'_inpoly' LINKIMAGE,'pixavg','/PATH/pixavg.so',0,'_pixavg' LINKIMAGE,'dblsvd','/PATH/dblsvd.so',0,'_dblsvd' LINKIMAGE,'qrdcmp','/PATH/qrdcmp.so',0,'_qrdcmp' ;DISCLAIMER: ; ;This software was written at the Cosmology Data Analysis Center in ;support of the Cosmic Background Explorer (COBE) Project under NASA ;;ft CGIS-VMS.BCKa  [COBE_IDL]LINK_UNIX.PRO;1 Ucontract number NAS5-30750. ; ;This software may be used, copied, modified or redistributed so long ;as it is not sold and this disclaimer is distributed along with the ;software. If you modify the software please indicate your ;modifications in a prominent place in the source code. ; ;All routines are provided "as is" without any express or implied ;warranties whatsoever. All routines are distributed without guarantee ;of support. If errors are found in this code it is requested that you ;contact us by sending email to the address below to report the errors ;but we make no claims regarding timely fixes. This software has been ;used for analysis of COBE data but has not been validated and has not ;been used to create validated data sets of any type. ; ;Please send bug reports to CGIS@ZWICKY.GSFC.NASA.GOV. Z*[COBE_IDL]LINK_VMS.PRO;1+,b . / h 4 - 0123KPWO 56ln7ln89G hHJ<m CGIS-VMS.BCKb  [COBE_IDL]LINK_VMS.PRO;1 z;******************************************************************************* ; ; This procedure linkimages user-written application utilities. ; ; Written: 11-AUG-1993 J. Newmark ; ;******************************************************************************* ; ; this assumes C executables are in the logical directory #CGIS_IDL# ; edit to reflect actual location ; SETLOG,'cconv_exe','#CGIS_IDL#:cconv.exe' SETLOG,'projtran_exe','#CGIS_IDL#:projtran.exe' SETLOG,'adt2zulu_exe','#CGIS_IDL#:adt2zulu.exe' SETLOG,'rastr_exe','#CGIS_IDL#:rastr.exe' SETLOG,'zulu2adt_exe','#CGIS_IDL#:zulu2adt.exe' SETLOG,'cpusec_exe','#CGIS_IDL#:cpusec.exe' SETLOG,'inpoly_exe','#CGIS_IDL#:inpoly.exe' SETLOG,'pixavg_exe','#CGIS_IDL#:pixavg.exe' SETLOG,'dblsvd_exe','#CGIS_IDL#:dblsvd.exe' SETLOG,'qrdcmp_exe','#CGIS_IDL#:qrdcmp.exe' LINKIMAGE,'cconv','cconv_exe',1 LINKIMAGE,'cpusec','cpusec_exe',1 LINKIMAGE,'projtran','projtran_exe',1 LINKIMAGE,'adt2zulu','adt2zulu_exe',0 LINKIMAGE,'rastr','rastr_exe',0 LINKIMAGE,'zulu2adt','zulu2adt_exe',0 LINKIMAGE,'inpoly','inpoly_exe',1 LINKIMAGE,'pixavg','pixavg_exe',0 LINKIMAGE,'dblsvd','dblsvd_exe',0 LINKIMAGE,'qrdcmp','qrdcmp_exe',0 ;DISCLAIMER: ; ;This software was written at the Cosmology Data Analysis Center in ;support of the Cosmic Background Explorer (COBE) Project under NASA ;contract number NAS5-30750. ; ;This software may be used, copied, modified or redistributed so long ;as it is not sold and this disclaimer is distributed along with the ;sof= CGIS-VMS.BCKb  [COBE_IDL]LINK_VMS.PRO;1 @tware. If you modify the software please indicate your ;modifications in a prominent place in the source code. ; ;All routines are provided "as is" without any express or implied ;warranties whatsoever. All routines are distributed without guarantee ;of support. If errors are found in this code it is requested that you ;contact us by sending email to the address below to report the errors ;but we make no claims regarding timely fixes. This software has been ;used for analysis of COBE data but has not been validated and has not ;been used to create validated data sets of any type. ; ;Please send bug reports to CGIS@ZWICKY.GSFC.NASA.GOV. *[COBE_IDL]MAKE.ALPHA;1+,c . / h 4 $- 0123KPWO 56WӇ7WӇ89G hHJ> CGIS-VMS.BCKc  [COBE_IDL]MAKE.ALPHA;1 >:$! This "make" file is suitable for compiling the ancillary $! C routines used in the COBE Guest Investigator Software $! package. $! $! The file MAKE.ALPHA should be used when compiling on a Digital $! ALPHA machine running OpenVMS (use make.unix if on an ALPHA $! running OSF1). $! $! Assumes the IDL executable is IDL_DIR:[bin.bin_alpha]idl.exe $! Assumes the IDL file export.h is in IDL_DIR:[external] $! if above is not true change or rename these logicals $! $! There are two compiling options depending whether using IDL v5.1 and $! above or earlier versions. If using earlier version, comment the first $! line and un-comment the second. $! $compile :== "cc/include=IDL_DIR:[external]/standard=vaxc/float=ieee_float/ieee_mode=denorm" $!compile :== "cc/include=IDL_DIR:[external]/standard=vaxc/float=d_float" $! $! this will use VAX C by default. Un-comment if prefer to use $! GNU_C if available. $!if f$trnlnm("GNU_CC") .NES. "" then compile :== "gcc/include=IDL_DIR:[external]" $! $i=1 $start: $if i .eq. 1 then file="cconv" $if i .eq. 2 then file="cpusec" $if i .eq. 3 then file="adt2zulu" $if i .eq. 4 then file="rastr" $if i .eq. 5 then file="inpoly" $if i .eq. 6 then file="zulu2adt" $if i .eq. 7 then file="pixavg" $if i .eq. 8 then file="projtran" $if i .eq. 9 then file="dblsvd" $if i .eq. 10 then file="qrdcmp" $! $define sys$output 'file'.opt $write sys$output "idl_dir:[bin.bin_alpha]idl/share" $! $! this will use VAX C by default. Un-comment 3 lines (on second line delete $! both the $ and ! sign) if prefer t?(:: CGIS-VMS.BCKc  [COBE_IDL]MAKE.ALPHA;1 o use GNU_C if available. $! If gcclib is not in gnu_cc:[000000] i.e. top level GNU_CC directory $! make appropriate change. $! if f$trnlnm("GNU_CC") .NES. "" then write sys$output - $! "gnu_cc:[000000]gcclib/lib" $! write sys$output "sys$share:vaxcrtl/share" $! $write sys$output "symbol_vector=("+''file''+"=PROCEDURE)" $deassign sys$output $compile 'file' $link/share 'file','file'.opt/opt $ i=i+1 $if i .eq. 11 then goto done $goto start $! $done: $delete *.obj;* $write sys$output "Done compiling and linking C routines." *[COBE_IDL]MAKE.IRIX;1+,.. / h 4 - 0123KPWO 56In7In89G hHJ@p CGIS-VMS.BCK. [COBE_IDL]MAKE.IRIX;1 '# This "make" file is suitable for compiling the ancillary # C routines used in the COBE Guest Investigator Software # package. # # The file MAKE.SUN should be used when compiling on a SUN/UNIX # machine. # CC = cc LD = ld -o # assume that export.h is in the following directory: INCLUDE=/usr/local/rsi/idl_5/external # assume idl shared libraries are in the following directory: INCLUDE2=/usr/local/rsi/idl_5/bin .SUFFIXES: .c .o .c.o: $(CC) -KPIC -I$(INCLUDE) -c $< LIBS = -lc -lm -L$(INCLUDE2) -lidl OFILES = cconv.o cpusec.o adt2zulu.o rastr.o inpoly.o \ zulu2adt.o pixavg.o projtran.o dblsvd.o qrdcmp.o # comps: $(OFILES) echo "Done compiling the C programs" $(LD) cconv.so -shared cconv.o $(LIBS) $(LD) cpusec.so -shared cpusec.o $(LIBS) $(LD) adt2zulu.so -shared adt2zulu.o $(LIBS) $(LD) rastr.so -shared rastr.o $(LIBS) $(LD) inpoly.so -shared inpoly.o $(LIBS) $(LD) zulu2adt.so -shared zulu2adt.o $(LIBS) $(LD) pixavg.so -shared pixavg.o $(LIBS) $(LD) projtran.so -shared projtran.o $(LIBS) $(LD) dblsvd.so -shared dblsvd.o $(LIBS) $(LD) qrdcmp.so -shared qrdcmp.o $(LIBS) echo "Done linking C routines." rm *.o echo "Cleaned up *.o files."