ocssw  1.0
/disk01/web/ocssw/build/src/geogen_modis/GEO_geo.h (r8102/r7924)
Go to the documentation of this file.
00001 /*
00002 !C-INC*************************************************************************
00003 !Description:   define parameters for the geolocation software
00004 
00005 !Input Parameters: N/A
00006 
00007 !Output Parameters: N/A
00008 
00009 !Revision History:
00010     $Log: GEO_geo.h,v $
00011     Revision 6.6  2011/02/09 19:06:42  kuyper
00012     Added external header guard for "PGS_DEM.h" to compesate for lack of
00013       internal one.
00014     Added enumeration of values for land/sea mask.
00015     Added explanation of best guess at reason for odd value of landsea mask
00016       fill value.
00017 
00018     Revision 6.5  2010/05/19 20:28:27  kuyper
00019     Helped resolve Bug 1969 by adding THERMCORR_FVALUE macro.
00020 
00021     James Kuyper Jr.    James.R.Kuyper@NASA.gov
00022 
00023     Revision 6.4  2009/09/15 20:15:46  kuyper
00024     Removed obsolete macros.
00025 
00026     Revision 6.3  2009/03/27 20:39:00  kuyper
00027     Changed macro name to MAX_PADDED.
00028 
00029     Revision 6.2  2009/03/18 20:53:15  kuyper
00030     Corrected new definition of MAX_DETECTORS.
00031     Added HIRES_FVALUE.
00032 
00033     Revision 6.1  2009/02/20 22:22:09  kuyper
00034     Added new macros needed to support position averaging and high-resolution
00035     offsets.
00036 
00037     Revision 5.4  2008/12/15 15:41:18  kuyper
00038     Added LUN to control orbit number validation.
00039 
00040     Revision 5.3  2005/03/16 21:35:11  kuyper
00041     Changed header guard macro name to avoid reserved name space.
00042 
00043     Revision 5.2  2004/11/05 01:46:54  kuyper
00044     Corrected definition of L_SMASK_FVALUE.
00045 
00046     Revision 5.1  2004/08/24 18:54:45  vlin
00047     L_SMASK_FVALUE changed to match the fill value used in DEM file.
00048 
00049     Revision 4.1  2002/11/19 23:11:55  kuyper
00050     Added TEMP_FVALUE
00051 
00052 !Team-unique Header:
00053                 This software is developed by the MODIS Science Data Support
00054                 Team for the National Aeronautics and Space Administration,
00055                 Goddard Space Flight Center, under contract NAS5-32373.
00056 
00057 !END***************************************************************************
00058 */
00059 
00060 #ifndef GEO_GEO_H
00061 #define GEO_GEO_H
00062 
00063 #include "GEO_basic.h"
00064 /* PGS_DEM.h does not have internal header guards, must provide externally. */
00065 #ifndef H_PGS_DEM
00066     #define H_PGS_DEM
00067     #include "PGS_DEM.h"
00068 #endif
00069 
00070 /*********************************************************
00071 #defines
00072 *********************************************************/
00073 
00074 /* General geolocation definitions */
00075 #define MAX_SCAN_NUMBER     1000
00076 #define MAX_FRAMES      1354
00077 #define SAMPLE_RATIO_HKM    2
00078 #define SAMPLE_RATIO_QKM    4
00079 #define SAMPLES_HKM     (MAX_FRAMES*SAMPLE_RATIO_HKM)
00080 #define SAMPLES_QKM     (MAX_FRAMES*SAMPLE_RATIO_QKM)
00081 #define MAX_PADDED      (SAMPLES_QKM+3)
00082 #define DETECTORS_1KM       10
00083 #define DETECTORS_HKM       (DETECTORS_1KM*SAMPLE_RATIO_HKM)
00084 #define DETECTORS_QKM       (DETECTORS_1KM*SAMPLE_RATIO_QKM)
00085 #define MAX_SCAN_SAMPLE     MAX_FRAMES  /* Obsolescent */
00086 #define MAX_DETECTORS       DETECTORS_1KM   /* Obsolescent */
00087 
00088 #define MAX_IMPULSE_NUMBER 25
00089 #define MAX_POLY_DEGREE 4
00090 #define MIN_TIME_OFFSET 0.0
00091 #define EA_SOURCE_SELECT_LUN 600280
00092 #define VALIDATE_ORBIT_NO_LUN 600281
00093 #define TERRAIN_CORRECT_LUN 600310
00094 
00095 /* Instrument model */
00096 #define MAX_BAND_NUMBER 36
00097 #define FIRST_BAND 30
00098 #define LATCH_TO_CENTER 0.5
00099 #define BASE_SAMPLES    DETECTORS_1KM       /* Obsolescent */
00100 #define MAX_SAMPLES SAMPLE_RATIO_QKM    /* Obsolescent */
00101 #define ROLL 0
00102 #define PITCH 1
00103 #define YAW 2
00104 #define POSITION 0
00105 #define VELOCITY 3
00106 #define ELEC_SIDES 2
00107 
00108 /* Input L1A data definitions */
00109 #define ENCODER_LENGTH 78
00110 #define SECTOR_LENGTH 40
00111 #define ANCIL_LENGTH 64
00112 #define NUM_L1A_QUALITY_FLAGS 4
00113 #define NUM_L1A_SECTOR_VIEWS 6
00114 
00115 /* Flag values */
00116 #define INVALID_INPUT_DATA 128
00117 #define NO_ELLIPSE_INTERSECT 64
00118 #define BAD_TERRAIN 32
00119 #define NEAR_LIMB 4
00120 #define INVALID_SENSOR_ANGLES 8
00121 #define INVALID_SOLAR_ANGLES 8
00122 #define TAI_FLAG 1.e10
00123 #define TERRAIN_CORRECT "TRUE"
00124 
00125 /* Land/Water mask values. */
00126 enum { SHALLOW_OCEAN, DRYLAND, COAST, SHALLOW_INLAND, EPHEMERAL, DEEP_INLAND,
00127     CONTINENTAL, DEEP_OCEAN, NUM_LWMASK,
00128     L_SMASK_FVALUE = (0x10000 + PGSd_DEM_NO_FILLVALUE)>>8};
00129 /* That peculiar expression for L_SMASK_FVALUE has a value of 221. It is the
00130  * actual value we find for the _FillValue attribute in the SDP Toolkit's DEM
00131  * files. The expression given above reflects my best guess as to where that
00132  * peculiar value came from.
00133  * PGSd_DEM_NO_FILLVALUE (-8888) is the value that the SDP Toolkit DEM routines
00134  * use for the Land/Water mask, apparently indicating that it was not supposed
00135  * to have fill values. If someone called the appropriate HDF function to give
00136  * it a fill value anyway, and used a 16 bit 2's complement big-endian integer
00137  * with a value of -8888 to do so, that would explain why the actual value came
00138  * out as 221. That's because an HDF _FillValue attribute is always of the same
00139  * type as the SDS, and this SDS is stored as uint8, so that HDF routine would
00140  * have looked only at the first byte of that integer.
00141  */
00142 
00143 /* Fill values. */
00144 #define LONG_FVALUE (-999.0)
00145 #define LAT_FVALUE (-999.0)
00146 #define HGHT_FVALUE (-32767)
00147 #define SENSORZEN_FVALUE (-32767)
00148 #define SENSORAZIM_FVALUE (-32767)
00149 #define RANGE_FVALUE 0
00150 #define SOLARZEN_FVALUE (-32767)
00151 #define SOLARAZIM_FVALUE (-32767)
00152 #define TEMP_FVALUE (-999.0)
00153 #define THERMCORR_FVALUE (-999.0)
00154 #define GFLAGS_FVALUE 255
00155 #define HIRES_FVALUE (-128)
00156 
00157 /* DEM definitions */
00158 #define MAX_DEM_ROWS 108
00159 #define MAX_DEM_TILES 26410
00160 #define MAX_DEM_HORIZONTAL 200
00161 #define MAX_DEM_VERTICAL 200
00162 #define NO_DEM_DATA (-1)
00163 
00164 /* DEM validation definitions */
00165 /* Nominal values with about 10% margin, in m */
00166 #define MIN_TERRAIN_HEIGHT (-450.0)
00167 #define MAX_TERRAIN_HEIGHT 9600.0
00168 
00169 /*  Mathematical constants (that should have been in ANSI math.h)   */
00170 #define PGS_PI 3.14159265358979323846
00171 #define RAD2DEG (180.0/PGS_PI)
00172 #define DEG2RAD (PGS_PI/180.0)
00173 #define MAX_UINT16_VAL (0xFFFF)
00174 
00175 /*  End of definitions */
00176 
00177 /* Structures   */
00178 /* Structure for bounding coordinate ECS core metadata (radians)    */
00179 typedef struct {
00180   double  northcoord;   /* Northern-most granule bounding latitude  */
00181   double  eastcoord;    /* Eastern-most granule bounding longitude  */
00182   double  southcoord;   /* Southern-most granule bounding latitude  */
00183   double  westcoord;    /* Western-most granule bounding longitude  */
00184   double  easthemi_ebc; /* Eastern-most granule bounding longitude
00185                 in the Eastern hemisphere.  */
00186   double  easthemi_wbc; /* Western-most granule bounding longitude
00187                 in the Eastern hemisphere.  */
00188   double  westhemi_ebc; /* Eastern-most granule bounding longitude
00189                 in the Western hemisphere.  */
00190   double  westhemi_wbc; /* Western-most granule bounding longitude
00191                 in the Western hemisphere.  */
00192 } GEO_bcoord_struct;
00193 
00194 #endif
00195