5 #define csds_fail( prog, sds ) \
7 fprintf(stderr, "%s: create_sds failed on %s\n", prog, sds ); \
10 #define setdim_fail( prog, sds ) \
12 fprintf(stderr, "%s: set_dim_names failed on %s\n", prog, sds ); \
15 #define setatt_fail( prog, sds, atr_name ) \
17 fprintf(stderr, "%s: SDsetattr failed on SDS %s, attrib name %s\n", prog, sds, atr_name ); \
22 l1_data_struc l1_data)
48 int32
create_sds(int32,
char *, int32, int32, int32 *, int32, VOIDP *);
50 int32 dims[3] = {0, 0, 0};
53 char *pname =
"set_czcs_ctl_data";
54 char sds_name[128], sds_attr[128];
55 char *num_scn_ln =
"Number of Scan Lines";
56 char *num_pix_ctl =
"Number of Pixel Control Points";
57 char *attr_nm_long =
"long_name";
58 char *attr_nm_valid =
"valid range";
59 char *attr_nm_units =
"units";
62 dims[0] = gattr.scan_lines;
63 dims[1] = gattr.n_ctl_pt;
64 strcpy(sds_name,
"latitude");
66 (VOIDP) l1_data.ctl_pt_lat)) < 0)
72 strcpy(sds_attr,
"Latitude");
73 if ((iret = SDsetattr(sdsid, attr_nm_long, DFNT_CHAR, strlen(sds_attr) + 1,
74 (VOIDP) sds_attr)) < 0)
77 strcpy(sds_attr,
"(-90.,90.)");
78 if ((iret = SDsetattr(sdsid, attr_nm_valid, DFNT_CHAR, strlen(sds_attr) + 1,
79 (VOIDP) sds_attr)) < 0)
82 strcpy(sds_attr,
"degrees");
83 if ((iret = SDsetattr(sdsid, attr_nm_units, DFNT_CHAR, strlen(sds_attr) + 1,
84 (VOIDP) sds_attr)) < 0)
88 strcpy(sds_name,
"longitude");
90 (VOIDP) l1_data.ctl_pt_lon)) < 0)
96 strcpy(sds_attr,
"Longitude");
97 if ((iret = SDsetattr(sdsid, attr_nm_long, DFNT_CHAR, strlen(sds_attr) + 1,
98 (VOIDP) sds_attr)) < 0)
101 strcpy(sds_attr,
"(-180.,180.)");
102 if ((iret = SDsetattr(sdsid, attr_nm_valid, DFNT_CHAR, strlen(sds_attr) + 1,
103 (VOIDP) sds_attr)) < 0)
106 strcpy(sds_attr,
"degrees");
107 if ((iret = SDsetattr(sdsid, attr_nm_units, DFNT_CHAR, strlen(sds_attr) + 1,
108 (VOIDP) sds_attr)) < 0)
113 dims[0] = gattr.scan_lines;
115 strcpy(sds_name,
"cntl_pt_rows");
117 (VOIDP) l1_data.ctl_pt_rows)) < 0)
123 strcpy(sds_attr,
"Scan Control Points");
124 if ((iret = SDsetattr(sdsid, attr_nm_long, DFNT_CHAR, strlen(sds_attr) + 1,
125 (VOIDP) sds_attr)) < 0)
129 if ((iret = SDsetattr(sdsid, attr_nm_units, DFNT_CHAR, strlen(sds_attr) + 1,
130 (VOIDP) sds_attr)) < 0)
134 dims[0] = gattr.n_ctl_pt;
136 strcpy(sds_name,
"cntl_pt_cols");
138 (VOIDP) l1_data.ctl_pt_cols)) < 0)
144 strcpy(sds_attr,
"Control Points for Columns");
145 if ((iret = SDsetattr(sdsid, attr_nm_long, DFNT_CHAR, strlen(sds_attr) + 1,
146 (VOIDP) sds_attr)) < 0)
150 if ((iret = SDsetattr(sdsid, attr_nm_units, DFNT_CHAR, strlen(sds_attr) + 1,
151 (VOIDP) sds_attr)) < 0)
157 dims[0] = gattr.scan_lines;
160 strcpy(sds_name,
"orb_vec");
162 (VOIDP) l1_data.orb_vec)) < 0)
168 strcpy(sds_attr,
"Orbit position vector at scan line time");
169 if ((iret = SDsetattr(sdsid, attr_nm_long, DFNT_CHAR, strlen(sds_attr) + 1,
170 (VOIDP) sds_attr)) < 0)
173 strcpy(sds_attr,
"(-7200.,7200.)");
174 if ((iret = SDsetattr(sdsid, attr_nm_valid, DFNT_CHAR, strlen(sds_attr) + 1,
175 (VOIDP) sds_attr)) < 0)
178 strcpy(sds_attr,
"kilometers");
179 if ((iret = SDsetattr(sdsid, attr_nm_units, DFNT_CHAR, strlen(sds_attr) + 1,
180 (VOIDP) sds_attr)) < 0)
186 dims[0] = gattr.scan_lines;
190 (VOIDP) l1_data.gain)) < 0)
196 strcpy(sds_attr,
"Gain setting at scan line time");
197 if ((iret = SDsetattr(sdsid, attr_nm_long, DFNT_CHAR, strlen(sds_attr) + 1,
198 (VOIDP) sds_attr)) < 0)
201 strcpy(sds_attr,
"( 1, 4 )");
202 if ((iret = SDsetattr(sdsid, attr_nm_valid, DFNT_CHAR, strlen(sds_attr) + 1,
203 (VOIDP) sds_attr)) < 0)
207 if ((iret = SDsetattr(sdsid, attr_nm_units, DFNT_CHAR, strlen(sds_attr) + 1,
208 (VOIDP) sds_attr)) < 0)
214 dims[0] = gattr.scan_lines;
217 strcpy(sds_name,
"slope");
219 (VOIDP) l1_data.slope)) < 0)
225 strcpy(sds_attr,
"Calibration slope at scan line time");
226 if ((iret = SDsetattr(sdsid, attr_nm_long, DFNT_CHAR, strlen(sds_attr) + 1,
227 (VOIDP) sds_attr)) < 0)
230 strcpy(sds_attr,
"( -20., 20. )");
231 if ((iret = SDsetattr(sdsid, attr_nm_valid, DFNT_CHAR, strlen(sds_attr) + 1,
232 (VOIDP) sds_attr)) < 0)
235 strcpy(sds_attr,
"mW cm^-2 um^-1 sr^-1 count^-1");
236 if ((iret = SDsetattr(sdsid, attr_nm_units, DFNT_CHAR, strlen(sds_attr) + 1,
237 (VOIDP) sds_attr)) < 0)
240 strcpy(sds_name,
"intercept");
242 (VOIDP) l1_data.intercept)) < 0)
248 strcpy(sds_attr,
"Calibration intercept at scan line time");
249 if ((iret = SDsetattr(sdsid, attr_nm_long, DFNT_CHAR, strlen(sds_attr) + 1,
250 (VOIDP) sds_attr)) < 0)
253 strcpy(sds_attr,
"( -20., 20. )");
254 if ((iret = SDsetattr(sdsid, attr_nm_valid, DFNT_CHAR, strlen(sds_attr) + 1,
255 (VOIDP) sds_attr)) < 0)
258 strcpy(sds_attr,
"mW cm^-2 um^-1 sr^-1");
259 if ((iret = SDsetattr(sdsid, attr_nm_units, DFNT_CHAR, strlen(sds_attr) + 1,
260 (VOIDP) sds_attr)) < 0)
267 strcpy(sds_name,
"att_ang");
269 (VOIDP) l1_data.att_ang)) < 0)
275 strcpy(sds_attr,
"Computed yaw, roll, pitch at scan line time");
276 if ((iret = SDsetattr(sdsid, attr_nm_long, DFNT_CHAR, strlen(sds_attr) + 1,
277 (VOIDP) sds_attr)) < 0)
280 strcpy(sds_attr,
"( -180., 180. )");
281 if ((iret = SDsetattr(sdsid, attr_nm_valid, DFNT_CHAR, strlen(sds_attr) + 1,
282 (VOIDP) sds_attr)) < 0)
285 strcpy(sds_attr,
"degrees");
286 if ((iret = SDsetattr(sdsid, attr_nm_units, DFNT_CHAR, strlen(sds_attr) + 1,
287 (VOIDP) sds_attr)) < 0)
295 strcpy(sds_name,
"pos_err");
297 (VOIDP) l1_data.pos_err)) < 0)
303 strcpy(sds_attr,
"Orbit position error");
304 if ((iret = SDsetattr(sdsid, attr_nm_long, DFNT_CHAR, strlen(sds_attr) + 1,
305 (VOIDP) sds_attr)) < 0)
308 strcpy(sds_attr,
"( -10., 7200.)");
309 if ((iret = SDsetattr(sdsid, attr_nm_valid, DFNT_CHAR, strlen(sds_attr) + 1,
310 (VOIDP) sds_attr)) < 0)
313 strcpy(sds_attr,
"meters");
314 if ((iret = SDsetattr(sdsid, attr_nm_units, DFNT_CHAR, strlen(sds_attr) + 1,
315 (VOIDP) sds_attr)) < 0)