/* @(#)mgmlib.h MgnAlt 2.7 (MIT/CSR) 6/30/92 Function: Access ADF and RDF data fields System: Magellan Altimetry Data Reduction Phase: LIB Module: mgmlib.h Revision: 2.7 Date: 6/30/92 Author: pgf@space.mit.edu Created: Sat Jan 4 14:44:05 EST 1992 Control: SCCS */ #include #include #include "arcdr.h" /* ** ARCDR data type flags */ #define ALT_LON 1 /* Footprint Longitude (deg, VBF85) */ #define ALT_LAT 2 /* Footprint Latitude (deg, VBF85) */ #define ALT_XFOOT 3 /* Along-track Footprint Size (km) */ #define ALT_YFOOT 4 /* Cross-track Footprint Size (km) */ #define ALT_RCAL 5 /* Receiver Noise Calibration (km-sq) */ #define ALT_RANGE 6 /* Uncorrected range to nadir (km) */ #define ALT_ATMOS 7 /* Atmospheric corrn to range (km) */ #define ALT_RADIUS 8 /* Derived Planetary Radius (km) */ #define ALT_SLOPE 9 /* Derived RMS Surface Slope (deg) */ #define ALT_RHO 10 /* Derived Fresnel Reflectivity */ #define ALT_RHOCOR 11 /* Rho Diffuse Scatt Corrn Factor */ #define ALT_RADERR 12 /* Formal errs in Radius, Slope, Rho */ #define ALT_SLOERR 13 /* Formal errs in Radius, Slope, Rho */ #define ALT_RHOERR 14 /* Formal errs in Radius, Slope, Rho */ #define ALT_RADSLO 15 /* Formal correlations in same */ #define ALT_SLORHO 16 /* Formal correlations in same */ #define ALT_RHORAD 17 /* Formal correlations in same */ #define ALT_SLORAD 18 /* Formal correlations in same */ #define ALT_RHOSLO 19 /* Formal correlations in same */ #define ALT_RADRHO 20 /* Formal correlations in same */ #define ALT_DRAD 21 /* Ephemeris Radius Correction (km) */ #define ALT_DLON 22 /* Ephemeris Long Corrn. (deg, VBF85) */ #define ALT_DLAT 23 /* Ephemeris Lat Corrn. (deg, VBF85) */ #define ALT_FIT 24 /* Non-range-sharp goodness of fit */ #define ALT_RSFIT 25 /* Range-sharpened goodness-of-fit */ #define ALT_RHOFACT 26 /* Multi-peak Corrn. applied to ar_rho */ #define ALT_RADIUS2 27 /* Radius from Threshold Detector (km) */ #define ALT_SQI 28 /* Signal Quality Indicator (dB) */ #define ALT_SCALE 29 /* Profile Scaling Factor (km-sq) */ #define ALT_RSSCALE 30 /* Range-sharpened Scaling Factor (km-sq) */ #define ALT_LOOKS 31 /* Number of non-range-sharpened looks */ #define ALT_RSLOOKS 32 /* Number of range-sharpened looks */ #define ALT_THRESH 33 /* Threshold Detector Index */ #define RAD_LON -1 /* Footprint Longitude (deg, VBF85) */ #define RAD_LAT -2 /* Footprint Latitude (deg, VBF85) */ #define RAD_XFOOT -3 /* Along Track Footprint Size (km) */ #define RAD_YFOOT -4 /* Cross Track Footprint Size (km) */ #define RAD_SFOOT0 -5 /* SAR Footprint Diameter (km) */ #define RAD_SFOOT1 -6 /* SAR Footprint Diameter (km) */ #define RAD_SAR0 -7 /* SAR Average Backscatter Val (dB) */ #define RAD_SAR1 -8 /* SAR Average Backscatter Val (dB) */ #define RAD_ANGLE -9 /* Incidence Angle (deg) */ #define RAD_BRIGHT -10 /* Brightness Temperature (K) */ #define RAD_RADIUS -11 /* Average Planetary Radius (km) */ #define RAD_ANT -12 /* System Temperature of Antenna (K) */ #define RAD_SKY -13 /* Assumed Cold Sky Temperature (K) */ #define RAD_RCVR -14 /* System Temperature of Receiver (K) */ #define RAD_SURF -15 /* Surface Brightness Temperature (K) */ #define RAD_EMISS -16 /* Surface Emissivity */ #define RAD_DEDRAD -17 /* Partial of Emissivity wrt Radius */ #define RAD_PHYS -18 /* Physical Surface Temperature (K) */ #define RAD_ANTVAL -19 /* Raw Antenna Signal */ #define RAD_LOADVAL -20 /* Raw Load Signal */ /* ** Static fields */ extern int adf_orbit; /* orbit number of last ADF read */ extern int rdf_orbit; /* orbit number of last RDF read */ extern int ohf_orbit; /* orbit number of last OHF read */ /* ** Data quality flags */ #define AR_INT 0x80000000 #define AOK AR_BAD #define IOK (AR_BAD | AR_INT) #define RBAD (AR_BAD | AR_RBAD) #define R2BAD (AR_BAD | AR_RBAD | AR_RAD2BAD) #define CBAD (AR_BAD | AR_CBAD | AR_SLOPEBAD) #define FBAD (AR_BAD | AR_CBAD | AR_RHOBAD) #define ABAD (AR_BAD | AR_RBAD | AR_CBAD | AR_SLOPEBAD) #define BBAD (AR_BAD | AR_RBAD | AR_CBAD | AR_RHOBAD) #define DBAD (AR_BAD | AR_CBAD | AR_SLOPEBAD | AR_RHOBAD) #define NOS1 RR_NOS1 #define NOS2 RR_NOS2 #define ROK RR_BAD #define ROK2 (RR_BAD|RR_CAL) /* ** Machine-dependent declarations */ #ifdef VMS #define NOUNIX #endif VMS #ifdef mips #define LSB #endif mips #ifdef MSDOS #define NOUNIX #define LSB #endif #ifdef NOUNIX #include #define OPENMODE "rb" extern int sprintf(); #else extern int errno; #define OPENMODE "r" #ifndef __NeXT__ extern char *sprintf(); #endif __NeXT__ #endif NOUNIX #ifdef LSB #define SWAP bytecopy static void bytecopy(), lsbdouble(); #else #define SWAP vaxlong #endif LSB #ifdef vax #define CPU_TYPE "VAX" #else #define CPU_TYPE "IEEE" #endif vax /* ** Error-handling macros */ #define MGM_ERR 01 /* Mgm error with message text */ #define MGM_PERR 02 /* UNIX library error */ #define MGMERROR(a, b, c) mgmerror(MGM_ERR,MGM_ETAG,(a),(b),(c)) #define MGMPERROR(a, b) mgmerror(MGM_PERR,MGM_ETAG,(a),(b),(char *)0) extern ar_rec *read_adf_rec(); extern rr_rec *read_rdf_rec(); extern oh_rec *read_ohf_rec();