Go to the documentation of this file.
6 static char dname[8][6] = {
"L_412",
"L_443",
"L_490",
"L_510",
7 "L_555",
"L_620",
"L_740",
"L_865"};
16 #define READ_GLBL_ATTR(nam,ptr) { \
17 if(SDreadattr(sd_id,SDfindattr(sd_id,(nam)),(VOIDP)(ptr))){ \
19 "-E- %s line %d: Could not get global attribute, %s.\n", \
20 __FILE__,__LINE__,(nam)); \
24 #define READ_SDS(nam,ptr,s0,s1,s2,e0,e1,e2) { \
27 edge[0]=(e0); edge[1]=(e1); edge[2]=(e2); \
28 start[0]=(s0); start[1]=(s1); start[2]=(s2); \
29 if(SDreaddata(SDselect(sd_id, SDnametoindex(sd_id, (nam))), \
30 start, NULL, edge, (VOIDP)(ptr)) == FAIL){ \
31 fprintf(stderr,"-E- %s line %d: Could not read SDS, %s.\n", \
32 __FILE__,__LINE__,(nam)); \
36 void interp_ocm2_geo(int32 sd_id, int32 nx, int32 ny,
char *sdsname, float32 **geo) {
47 float32 *x_ctl, *dx_ctl;
48 float32 *y_ctl, *dy_ctl;
52 sds_id = SDselect(sd_id, SDnametoindex(sd_id, (sdsname)));
53 if (SDgetinfo(sds_id,
NULL, &
rank, dims, &
type, &numattr) == -1) {
54 fprintf(
stderr,
"-E- %s line %d: error getting dimension info.\n",
64 x_ctl = (float32 *) calloc(nx_ctl,
sizeof (float32));
65 y_ctl = (float32 *) calloc(ny_ctl,
sizeof (float32));
66 for (
i = 0;
i < nx_ctl;
i++) x_ctl[
i] = (float32)
i * mx + 1;
67 for (
j = 0;
j < ny_ctl;
j++) y_ctl[
j] = (float32)
j * my + 1;
70 v_ctl = (float32 *) calloc(nx_ctl,
sizeof (float32));
71 dx_ctl = (float32 *) calloc(nx_ctl,
sizeof (float32));
72 for (
j = 0;
j < ny_ctl;
j++) {
74 READ_SDS(sdsname, v_ctl,
j, 0, 0, 1, nx_ctl, 1);
75 spline(x_ctl, v_ctl, nx_ctl, 1e30, 1e30, dx_ctl);
76 for (
i = 0;
i < nx;
i++) {
77 splint(x_ctl, v_ctl, dx_ctl, nx_ctl, (
float)
i, &geo[jout][
i]);
85 v_ctl = (float32 *) calloc(ny_ctl,
sizeof (float32));
86 dy_ctl = (float32 *) calloc(ny_ctl,
sizeof (float32));
87 for (
i = 0;
i < nx;
i++) {
88 for (
j = 0;
j < ny_ctl;
j++) {
90 v_ctl[
j] = geo[jout][
i];
92 spline(y_ctl, v_ctl, ny_ctl, 1e30, 1e30, dy_ctl);
93 for (
j = 0;
j < ny;
j++) {
94 splint(y_ctl, v_ctl, dy_ctl, ny_ctl, (
float)
j, &geo[
j][
i]);
111 sd_id = SDstart(
file->name, DFACC_RDONLY);
113 fprintf(
stderr,
"-E- %s line %d: SDstart(%s, %d) failed.\n",
114 __FILE__, __LINE__,
file->name, DFACC_RDONLY);
137 static int firstCall = 1;
139 int32 sd_id =
file->sd_id;
149 if ((
data = (
float *) calloc(
file->npix, sizeof (
float))) ==
NULL) {
150 printf(
"-E- %s line %d: Error allocating data space.\n",
158 printf(
"-E- %s line %d: Error allocating geolocation space.\n",
163 printf(
"-E- %s line %d: Error allocating geolocation space.\n",
168 printf(
"-E- %s line %d: Error allocating geolocation space.\n",
173 printf(
"-E- %s line %d: Error allocating geolocation space.\n",
179 printf(
"Interpolating radiant path geometries\n");
194 for (ip = 0; ip <
npix; ip++) {
201 for (ib = 0; ib <
file->nbands; ib++) {
203 for (ip = 0; ip <
npix; ip++) {
215 if (SDend(
file->sd_id)) {
216 fprintf(
stderr,
"-E- %s line %d: SDend(%d) failed for file, %s.\n",
217 __FILE__, __LINE__,
file->sd_id,
file->name);
double yds2unix(int16_t year, int16_t day, double secs)
void interp_ocm2_geo(int32 sd_id, int32 nx, int32 ny, char *sdsname, float32 **geo)
MOD_PR01 Production producing one five minute granule of output data in each run It can be configured to produce as many as three five minute granules per run Each execution with one construction record and one date file for each dataset In normal these are created by which splits them out of the hour datasets For LANCE they are created by which merges all session MODIS L0 datasets overlapping the requested time and extracts from the merged data those packets which fall within that time period Each scan of data is stored in the L1A granule that covers the start time of that scan
int readl1_ocm2_hdf(filehandle *file, int32_t scan, l1str *l1rec)
subroutine spline(s, x, y, n, in, t, il, iu, vl, vu, e, u)
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 openl1_ocm2_hdf(filehandle *file)
int closel1_ocm2_hdf(filehandle *file)
#define READ_GLBL_ATTR(nam, ptr)
Utility functions for allocating and freeing two-dimensional arrays of various types.
no change in intended resolving MODur00064 Corrected handling of bad ephemeris attitude data
#define READ_SDS(nam, ptr, s0, s1, s2, e0, e1, e2)
Extra metadata that will be written to the HDF4 file l2prod rank
subroutine splint(xa, ya, y2a, n, x, y)
float ** allocate2d_float(size_t h, size_t w)
Allocate a two-dimensional array of type float of a given size.
How many dimensions is the output array Default is Not sure if anything above will work correctly strcpy(l2prod->title, "no title yet")
#define HDF_FUNCTION_ERROR