Go to the documentation of this file.
19 #define PI 3.141592653589793
22 static int32_t *numbin_xkm, *basebin_xkm, *numbin_9km, *basebin_9km;
23 static float *latbin_xkm;
31 if ((fp = fopen(
file,
"r")) ==
NULL) {
32 printf(
" Cannot open the mask file %s",
file);
35 if ((len = (int32_t) fread((
void *)
data,
sizeof (
char), 1536, fp)) != 1536) {
36 printf(
" Cannot read the mask file %s",
file);
40 if ((len = (int32_t) fread((
void *)
data,
sizeof (
char), 742553, fp)) != 742553) {
41 printf(
" Cannot read the mask file %s",
file);
47 for (
j = 0;
j < 8;
j++)
x[
j] = (
unsigned char) pow(2.0, (
double)
j);
49 for (
i = 0;
i < 742553;
i++) {
67 static int first_check = 1;
69 int32_t
i, rlow, rhi, rmid, row, rows_9km = 2160, xbin, bin_row, bin_col;
75 if (
mask[bin] > 0)
return ( 1);
88 if ((numbin_xkm = (int32_t *) malloc(
nrows *
sizeof (int32_t))) ==
NULL) {
89 printf(
"-E- %s line %d: Cannot allocate memory to numbin", __FILE__, __LINE__);
92 if ((basebin_xkm = (int32_t *) malloc((
nrows + 1) *
sizeof (int32_t))) ==
NULL) {
93 printf(
"-E- %s line %d: Cannot allocate memory to basebin", __FILE__, __LINE__);
96 if ((latbin_xkm = (
float *) malloc(
nrows *
sizeof (
float))) ==
NULL) {
97 printf(
"-E- %s line %d: Cannot allocate memory to basebin", __FILE__, __LINE__);
102 *(latbin_xkm +
i) = (
i + 0.5) * (180.0 /
nrows) - 90.0;
103 *(numbin_xkm +
i) = (int32_t) (cos(*(latbin_xkm +
i) * radfac) * (2.0 *
nrows) + 0.5);
107 for (
i = 1;
i <
nrows;
i++) *(basebin_xkm +
i) = *(basebin_xkm +
i - 1) + *(numbin_xkm +
i - 1);
108 basebin_xkm[
nrows] = *(basebin_xkm +
nrows - 1) + *(numbin_xkm +
nrows - 1) - 1;
111 if ((numbin_9km = (int32_t *) malloc(rows_9km *
sizeof (int32_t))) ==
NULL) {
112 printf(
"-E- %s line %d: Cannot allocate memory to numbin", __FILE__, __LINE__);
115 if ((basebin_9km = (int32_t *) malloc((rows_9km + 1) *
sizeof (int32_t))) ==
NULL) {
116 printf(
"-E- %s line %d: Cannot allocate memory to basebin", __FILE__, __LINE__);
119 for (
i = 0;
i < rows_9km;
i++) {
120 lats = (
i + 0.5) * (180.0 / rows_9km) - 90.0;
121 numbin_9km[
i] = (int32_t) (cos(
lats * radfac) * (2.0 * rows_9km) + 0.5);
125 for (
i = 1;
i < rows_9km;
i++) *(basebin_9km +
i) = *(basebin_9km +
i - 1) + *(numbin_9km +
i - 1);
126 basebin_9km[rows_9km] = *(basebin_9km + rows_9km - 1) + *(numbin_9km + rows_9km - 1) - 1;
132 if (bin > basebin_xkm[
nrows])
133 bin = basebin_xkm[
nrows];
140 rmid = (rlow + rhi - 1) / 2;
141 if (*(basebin_xkm + rmid) > bin) rhi = rmid;
142 else rlow = rmid + 1;
150 lat = *(latbin_xkm + row - 1);
151 lon = 360.0 * (bin - *(basebin_xkm + row - 1) + 0.5) / *(numbin_xkm + row - 1);
154 bin_row = (int32_t) ((90.0 +
lat) * ((
double) rows_9km / (
double) 180.0));
155 bin_col = (int32_t) ((
double) numbin_9km[bin_row] * (
lon + 180.0) / (
double) 360.0);
156 xbin = basebin_9km[bin_row] + bin_col;
160 if (
mask[xbin] > 0)
return ( 1);
165 if (numbin_xkm !=
NULL) free(numbin_xkm);
166 if (basebin_xkm !=
NULL) free(basebin_xkm);
167 if (latbin_xkm !=
NULL) free(latbin_xkm);
168 if (numbin_9km !=
NULL) free(numbin_9km);
169 if (basebin_9km !=
NULL) free(basebin_9km);
no change in intended resolving MODur00064 Corrected handling of bad ephemeris attitude resolving resolving GSFcd00179 Corrected handling of fill values for[Sensor|Solar][Zenith|Azimuth] resolving MODxl01751 Changed to validate LUT version against a value retrieved from the resolving MODxl02056 Changed to calculate Solar Diffuser angles without adjustment for estimated post launch changes in the MODIS orientation relative to incidentally resolving defects MODxl01766 Also resolves MODxl01947 Changed to ignore fill values in SCI_ABNORM and SCI_STATE rather than treating them as resolving MODxl01780 Changed to use spacecraft ancillary data to recognise when the mirror encoder data is being set by side A or side B and to change calculations accordingly This removes the need for seperate LUTs for Side A and Side B data it makes the new LUTs incompatible with older versions of the and vice versa Also resolves MODxl01685 A more robust GRing algorithm is being which will create a non default GRing anytime there s even a single geolocated pixel in a granule Removed obsolete messages from seed file
int read9km_mask(char *file, char *mask)
a context in which it is NOT documented to do so subscript which cannot be easily calculated when extracting TONS attitude data from the Terra L0 files Corrected several defects in extraction of entrained ephemeris and and as HDF file for both the L1A and Geolocation enabling retrieval of South Polar DEM data Resolved Bug by changing to opent the geolocation file only after a successful read of the L1A and also by checking for fatal errors from not restoring C5 and to report how many of those high resolution values were water in the new WaterPresent SDS Added valid_range attribute to Land SeaMask Changed to bilinearly interpolate the geoid_height to remove artifacts at one degree lines Made corrections to const qualification of pointers allowed by new version of M API library Removed casts that are no longer for same not the geoid Corrected off by one error in calculation of high resolution offsets Corrected parsing of maneuver list configuration parameter Corrected to set Height SDS to fill values when geolocation when for elevation and land water mask
integer, parameter double
no change in intended resolving MODur00064 Corrected handling of bad ephemeris attitude data
int is_masked(int32_t bin, char *mask, int32_t nrows)