OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
read_prism.c
Go to the documentation of this file.
1 /*
2  * l1_aviris.c
3  *
4  * Created on: May 18, 2015
5  * Author: Rick Healy SAIC
6  * NASA-GSFC OBPG
7  */
8 #include <stdlib.h>
9 #include <stdio.h>
10 #include <string.h>
11 #include <proj_api.h>
12 #include "timeutils.h"
13 #include "prism.h"
14 #include "jplaeriallib.h"
15 #include <math.h>
16 #define SKIP -9999
17 #define BIP 0
18 #define BIL 1
19 #define BSQ 2
20 #define MAXLINESZ 4290
21 
22 static const int maxBands = 285;
23 static double *lat, *lon;
24 
25 int close_prism(prism4ocia_t *data);
26 prism4ocia_t* open_prism(char *filename, prism4ocia_t **data);
27 int read_prism(prism4ocia_t *data, int32_t recnum);
28 char *checkTagLine(char *linein, char* tag);
29 int checkTagLine_i(char *linein, char* tag);
30 int readBinScanLine4Ocip_float(float *Lt, int32_t recnum, int32_t npix, double *gain, int nbands, int numBands, int interleave, int swap, FILE *ptr);
31 void trimBlanks(char* str);
32 double angular_distance(double lat1, double lon1, double lat2, double lon2);
33 double deg2rad(double deg);
34 void l_sun_(int *iyr, int *iday, double *sec, float *sunr, float *rs);
35 
36 prism4ocia_t* createPrivateData_pr(int numBands, int32_t nscan, int32_t npix) {
37 
38  int i;
39 
40  prism4ocia_t* data = (prism4ocia_t*) calloc(1, sizeof (prism4ocia_t));
41  if (data == NULL) {
42  fprintf(stderr, "-E- %s line %d: unable to allocate private data for prism\n",
43  __FILE__, __LINE__);
44  exit(1);
45  }
46 
47  data->wave = (double *) malloc(numBands * sizeof (double));
48  data->fwhm = (double *) malloc(numBands * sizeof (double));
49  data->gain = (double *) malloc(numBands * sizeof (double));
50  if (data->wave == NULL || data->fwhm == NULL || data->gain == NULL) {
51  fprintf(stderr, "-E- %s line %d: unable to allocate scale/offset data for prism\n",
52  __FILE__, __LINE__);
53  exit(1);
54  }
55 
56  return data;
57 }
58 
59 void freePrivateData_pr(prism4ocia_t* data) {
60  int k;
61  free(data->gain);
62  free(data->sena);
63  free(data->senz);
64  free(data->sola);
65  free(data->solz);
66  free(data->Lt);
67  free(data->lon);
68  free(data->lat);
69  free(data->utc);
70  gsl_interp_accel_free(data->spl_acc);
71 
72 }
73 
74 prism4ocia_t *open_prism(char *filename, prism4ocia_t **data) {
75 
76  int16_t buffer[10];
77  FILE *ptr;
78  char tag[itemSize];
79  char *val0;
80  char val[itemSize];
81  char *inbasename, *infile;
82  static char *infile2;
83  int i, j, k, status, pos;
84  double *indata;
85  float *indataf;
86  float tmp;
87  int numBands, num;
88  char* result;
89  char *line, val1[itemSize];
90  int count;
91  int year, month, day, hour, minute, second;
92  float knts2mps = 0.51444444444; // knots to meters per second
93  float ft2m = 0.3048; // feet to meters
94  prism4ocia_t *temp;
95  double sec;
96 
97  char projStr[1024];
98  static char *dupline;
99  int cnt, linelength, itmp;
100  char *iptr;
101 
102  temp = *data;
103  inbasename = getinbasename(filename);
104  pos = strlen(inbasename);
105  if (pos <= 0) {
106  fprintf(stderr, "-E- %s line %d: Not a avalid prism file %s\n",
107  __FILE__, __LINE__, filename);
108  exit(-1);
109  }
110 
111  cdata_(); // initialize global FORTRAN common block data for l_sun call
112 
113  //prism4ocia_t* data = file->private_data = createPrivateData_pr(maxBands,file->nscan,file->npix);
114  *data = (prism4ocia_t*) malloc(sizeof (prism4ocia_t));
115  if (*data == NULL) {
116  fprintf(stderr, "-E- %s line %d: unable to allocate private data for Prism\n",
117  __FILE__, __LINE__);
118  exit(1);
119  }
120  line = (char *) malloc(MAXLINESZ * sizeof (char));
121  (*data)->wave = (double *) malloc(maxBands * sizeof (double));
122  (*data)->fwhm = (double *) malloc(maxBands * sizeof (double));
123  (*data)->gain = (double *) malloc(maxBands * sizeof (double));
124  if ((*data)->wave == NULL || (*data)->fwhm == NULL) {
125  fprintf(stderr, "-E- %s line %d: unable to allocate scale/offset data for aviris\n",
126  __FILE__, __LINE__);
127  exit(1);
128  }
129 
130  temp = *data;
131 
132  sscanf(inbasename, "prm%4d%2d%2dt%2d%2d%2d", &year, &month, &day, &hour, &minute, &second);
133 
134  temp->month = month;
135  temp->day = day;
136  temp->hour = hour;
137  temp->min = minute;
138  temp->sec = second;
139 
140  ymdhms2ydmsec(year, month, day, hour, minute, second,
141  &temp->year, &temp->doy, &temp->msec);
142 
143 
144  temp->stime = ymds2unix(year, month, day, hour * 3600.0 + minute * 60.0 + second);
145 
146  printf("Date of prism flight: %s\n", unix2isodate(temp->stime, 'G'));
147 
148  if ((ptr = fopen(filename, "r")) == NULL) {
149  fprintf(stderr, "-E- %s line %d: unable to open %s\n",
150  __FILE__, __LINE__, filename);
151  exit(-1);
152  }
153 
154  int numLinesNeeded = 1;
155  int numSamplesNeeded = 1;
156  int bandsNeeded = 1;
157  int utmZoneNeeded = 1;
158  int eastingNeeded = 1;
159  int northingNeeded = 1;
160  int pixelSizeNeeded = 1;
161  int interleaveNeeded = 1;
162  int rotationAngNeeded = 1;
163  int EndTimeNeeded = 1;
164  int altNeeded = 1;
165  int waveLengthNeeded = 1;
166  int fwhmNeeded = 1;
167 
168  // loop metadata
169  while (numLinesNeeded ||
170  numSamplesNeeded ||
171  bandsNeeded ||
172  pixelSizeNeeded ||
173  utmZoneNeeded ||
174  eastingNeeded ||
175  northingNeeded ||
176  rotationAngNeeded ||
177  EndTimeNeeded ||
178  altNeeded ||
179  waveLengthNeeded ||
180  fwhmNeeded ||
181  interleaveNeeded) {
182 
183  result = fgets(line, MAXLINESZ, ptr);
184  if (result == NULL) {
185  fprintf(stderr, "-E- %s line %d: unable to read all of the required metadata from prism file\n",
186  __FILE__, __LINE__);
187  exit(1);
188  }
189  trimBlanks(line);
190 
191  if ((itmp = checkTagLine_i(line, "lines")) && itmp > 0) {
192  numLinesNeeded = 0;
193  temp->nscan = itmp; //strtol(val0,&iptr,10);
194  printf("lines=%d\n", temp->nscan);
195  }
196  if ((itmp = checkTagLine_i(line, "samples")) && itmp > 0) {
197  numSamplesNeeded = 0;
198  temp->npix = itmp; //strtol(val0,&iptr,10);
199  printf("samples=%d\n", temp->npix);
200  }
201  if ((val0 = checkTagLine(line, "Alt"))) {
202  altNeeded = 0;
203  temp->alt = atof(val0) * ft2m;
204  printf("Altitude=%lf\n", temp->alt);
205  }
206  if ((val0 = checkTagLine(line, "EndTime"))) {
207  EndTimeNeeded = 0;
208  sscanf(val0, "%2d%2d", &hour, &minute);
209  printf("End hour=%d minute=%d\n", hour, minute);
210  temp->etime = ymds2unix(year, month, day, hour * 3600.0 + minute * 60.0);
211  printf("End Time=%s\n", unix2isodate(temp->etime, 'G'));
212  }
213  if ((itmp = checkTagLine_i(line, "bands")) && itmp > 0) {
214  bandsNeeded = 0;
215  numBands = itmp;
216  temp->numBands = numBands;
217  if (numBands > maxBands) {
218  fprintf(stderr, "-E- %s line %d: number of bands (%d) from prism file > maxBands (%d)\n",
219  __FILE__, __LINE__, numBands, maxBands);
220  exit(1);
221  }
222  printf("numBands=%d\n", temp->numBands);
223  }
224  if ((val0 = checkTagLine(line, "interleave"))) {
225  interleaveNeeded = 0;
226  if (strstr(val0, "bip")) {
227  temp->interleave = BIP;
228  } else if (strstr(val0, "bil")) {
229  temp->interleave = BIL;
230  } else {
231  fprintf(stderr, "Interleave = %s is not supported\n", val0);
232  exit(1);
233  }
234  printf("Interleave=%d\n", temp->interleave);
235  }
236  if ((val0 = checkTagLine(line, "wavelength ="))) {
237  waveLengthNeeded = 0;
238  i = 0;
239  result = strtok(line, "wavelength = {");
241  tmp = atof(result);
242 
243  while (i < maxBands && result) {
244  temp->wave[i] = 1000.0 * tmp;
245  printf("i=%d wave=%f\n", i, temp->wave[i]);
246  result = strtok(NULL, ",");
247  if (result) {
249  tmp = atof(result);
250  i++;
251  }
252  }
253 
254 
255  }
256  if ((val0 = checkTagLine(line, "fwhm"))) {
257  fwhmNeeded = 0;
258  i = 0;
259  result = strtok(line, "fwhm = {");
261  tmp = atof(result);
262 
263  while (i < maxBands && result) {
264  temp->fwhm[i] = 1000.0 * tmp;
265  printf("i=%d fwhm=%f\n", i, temp->fwhm[i]);
266  result = strtok(NULL, ",");
267  if (result) {
269  tmp = atof(result);
270  i++;
271  }
272  }
273  }
274  if ((val0 = checkTagLine(line, "map info"))) {
275  cnt = 0;
276  linelength = strlen(line);
277  if (dupline) free(dupline);
278  if ((dupline = (char *) malloc(linelength * sizeof (char))) == NULL) {
279  fprintf(stderr,
280  "-E- %s line %d: Memory allocation failure.\n",
281  __FILE__, __LINE__);
282  exit(-1);
283  }
284  strcpy(dupline, line);
285  result = strtok(dupline, ",");
286  while (result) {
287  switch (cnt) {
288  case 3:
289  temp->easting = atof(result);
290  eastingNeeded = 0;
291  break;
292  case 4:
293  temp->northing = atof(result);
294  northingNeeded = 0;
295  break;
296  case 5:
297  temp->pixelSize = atof(result);
298  pixelSizeNeeded = 0;
299  break;
300  case 7:
301  temp->utmZone = strtol(result, &iptr, 10);
302  utmZoneNeeded = 0;
303  break;
304  default:
305  break;
306  }
307  printf(">>%d) %s\n", cnt, result);
308  cnt++;
309  result = strtok(NULL, ",");
310  }
311  if ((val0 = checknspTagLine(line, "rotation"))) {
312  rotationAngNeeded = 0;
313  temp->rotation = atof(val0);
314  } else {
315  printf("Rotation angle expected in line: %s\n", val0);
316  exit(-1);
317  }
318  printf("Rotation/easting/northing/pixsize/utmzone=%f/%lf/%lf/%lf/%d\n", temp->rotation, temp->easting, temp->northing, temp->pixelSize, temp->utmZone);
319  }
320  // if((val0=checkTagLine(line,"map info"))) {
321  // sscanf(val0,"%*[^,], %*f, %*f, %lf, %lf, %lf, %lf, %d, %*[^,], %*[^,], %*[^,], %s}",&temp->easting,&temp->northing,&temp->pixelSize,&temp->pixelSize,&temp->utmZone,val1);
322  // if((val0=checknspTagLine(line,"rotation"))) {
323  // rotationAngNeeded = 0;
324  // rotation = atof(val0);
325  // if (rotation > 45)
326  // temp->eastbyscan = -1;
327  // else if (rotation < -45)
328  // temp->eastbyscan = 1;
329  // else
330  // temp->eastbyscan = 0;
331  // } else {
332  // printf("Rotation angle expected in line: %s\n",val0);
333  // exit(-1);
334  // }
335  // printf("Rotation/easting/northing/pixsize/utmzone=%f/%lf/%lf/%lf/%d\n",rotation,temp->easting,temp->northing,temp->pixelSize,temp->utmZone);
336  // pixelSizeNeeded = 0;
337  // northingNeeded = 0;
338  // eastingNeeded = 0;
339  // utmZoneNeeded = 0;
340  //
341  // }
342 
343 
344  }
345 
346  fclose(ptr);
347 
348 
349  // Get the sensor and solar temp
350 
351  temp->sena = (float *) malloc(temp->npix * sizeof (float));
352  temp->senz = (float *) malloc(temp->npix * sizeof (float));
353  temp->solz = (float *) malloc(temp->npix * sizeof (float));
354  temp->sola = (float *) malloc(temp->npix * sizeof (float));
355  temp->utc = (float *) malloc(temp->npix * sizeof (float));
356  temp->lon = (double *) malloc(temp->npix * sizeof (double));
357  temp->lat = (double *) malloc(temp->npix * sizeof (double));
358  temp->Lt = (float *) malloc(temp->numBands * temp->npix * sizeof (float));
359  if (temp->sena == NULL || temp->senz == NULL || temp->sola == NULL || temp->solz == NULL || temp->Lt == NULL || temp->lon == NULL || temp->lat == NULL) {
360  fprintf(stderr, "-E- %s line %d: unable to allocate sensor and solar angle data for AVIRIS\n",
361  __FILE__, __LINE__);
362  exit(1);
363  }
364 
365  for (i = 0; i < numBands; i++) {
366  temp->gain[i] = 1.0;
367  }
368 
369  // free(infile);
370  infile = malloc((pos + strlen("_rdn_ort")) * sizeof (char));
371  strcpy(infile, inbasename);
372  strcat(infile, "_rdn_ort");
373  printf("Opening prism image file %s\n", infile);
374 
375  if ((temp->av_fp = fopen(infile, "rb")) == NULL) {
376  fprintf(stderr, "-E- %s line %d: unable to open %s\n",
377  __FILE__, __LINE__, infile);
378  exit(-1);
379 
380  }
381 
382  sprintf(projStr, "+proj=utm +zone=%d +ellps=WGS84 +datum=WGS84 +units=m +no_defs ",
383  temp->utmZone);
384  // printf("RJH: projStr=%s\n",projStr);
385  if (!(temp->pj_ortho = pj_init_plus(projStr))) {
386  printf("Error - prism first projection failed to init\n");
387  exit(1);
388  }
389  if (!(temp->pj_latlong = pj_latlong_from_proj(temp->pj_ortho))) {
390  fprintf(stderr, "-E- %s line %d: prism latlon projection failed to init\n",
391  __FILE__, __LINE__);
392  exit(1);
393  }
394 
395  lat = (double *) malloc(temp->npix * sizeof (double));
396  lon = (double *) malloc(temp->npix * sizeof (double));
397 
398  return (temp);
399 
400 }
401 
402 int read_prism(prism4ocia_t *data, int recnum)
403 /*
404  * fill standard record with L1B line of data
405  */ {
406  int status, min_msec = 86401 * 1000, max_msec = -1;
407 
408  static double last_good_hour = 18;
409  static int firstCall = 1;
410  float rel_sec;
411  double sec, pos[3];
412  float epos[3], sunpos[3];
413  int16_t year, doy, month, day, hour, minute;
414  double dist;
415  double secondOfDay;
416  float longitude, latitude, sunDist;
417  int i;
418  int npix = data->npix, ip, ib, ipb;
419 
420 
421  // set information about data
422  npix = data->npix;
423 
424  // *(l1rec->year) = data->year;
425  // *(l1rec->day) = data->doy;
426  // *(l1rec->msec) = data->msec + (data->emsec - data->msec)*recnum/(data->nscan-1);
427  data->scantime = data->stime + (data->etime - data->stime) * recnum / (data->nscan - 1);
428  unix2ymds(data->scantime, &year, &month, &day, &secondOfDay);
429  data->year = year;
430  data->month = month;
431  data->day = day;
432  data->hour = secondOfDay / 3600;
433  data->min = (secondOfDay - data->hour * 3600) / 60;
434  data->sec = secondOfDay - data->hour * 3600 - data->min * 60;
435  // get lat-lon
436  for (ip = 0; ip < npix; ip++) {
437  //rotate pixel to project onto map
438  lon[ip] = data->easting + ip * cos(deg2rad(data->rotation)) * data->pixelSize + recnum * sin(deg2rad(data->rotation)) * data->pixelSize; // starts in upper left corner
439  lat[ip] = data->northing + ip * sin(deg2rad(data->rotation)) * data->pixelSize - recnum * cos(deg2rad(data->rotation)) * data->pixelSize;
440  }
441 
443 
444  if (lat[npix / 2] > SKIP)
445  latitude = lat[npix / 2];
446  else {
447  fprintf(stderr, "-E- %s line %d: Don't have sensor latitude for geometry calculation\n",
448  __FILE__, __LINE__);
449  exit(1);
450  }
451 
452  if (lon[npix / 2] > SKIP)
453  longitude = lon[npix / 2];
454  else {
455  fprintf(stderr, "-E- %s line %d: Don't have sensor longitude for geometry calculation\n",
456  __FILE__, __LINE__);
457  exit(1);
458  }
459 
460  getPosVec(latitude, longitude, data->alt, pos); // get position vector of sensor
461  unix2yds(data->scantime, &year, &doy, &secondOfDay);
462 
463  int32_t iyear, idoy;
464  iyear = (int32_t) year;
465  idoy = (int32_t) doy;
466  l_sun_(&iyear, &idoy, &secondOfDay, sunpos, &sunDist); // get position vector for the sun
467 
468  for (i = 0; i < 3; i++) {
469  sunpos[i] *= 1.496e8; //convert to km for call to get_zenaz
470  epos[i] = pos[i];
471  }
472 
473  for (ip = 0; ip < npix; ip++) {
474 
475 
476  if (isnan(lat[ip])) lat[ip] = SKIP;
477  if (isnan(lon[ip])) lon[ip] = SKIP;
478  data->lat[ip] = lat[ip];
479  data->lon[ip] = lon[ip];
480  //printf("ip=%d scan=%d lat=%f lon=%f\n",ip,recnum,lat[ip],lon[ip]);
481 
482 
483  get_zenaz(epos, lon[ip], lat[ip], &data->senz[ip], &data->sena[ip]);
484  get_zenaz(sunpos, lon[ip], lat[ip], &data->solz[ip], &data->sola[ip]);
485 
486  //printf("RJH: %d %d senz=%f sena=%f solz=%f sola=%f\n",recnum, ip, l1rec->senz[ip],l1rec->sena[ip], l1rec->solz[ip],l1rec->sola[ip]);
487 
488 
489  }
490 
491  readBinScanLine_float(data->Lt, recnum, data->npix, data->gain, data->numBands, data->numBands, data->interleave, 0, data->av_fp);
492 
493  return (0);
494 }
495 
496 void prism4ocia_proj4_convert(prism4ocia_t *data, int32_t numPoints, double *x, double *y) {
497  int i;
498  if (pj_transform(data->pj_ortho, data->pj_latlong, numPoints, 1, x, y, NULL)) {
499  fprintf(stderr, "-E- %s line %d: AVIRIS proj4 transformation blew up\n",
500  __FILE__, __LINE__);
501  exit(1);
502  }
503  for (i = 0; i < numPoints; i++) {
504  x[i] *= RAD_TO_DEG;
505  y[i] *= RAD_TO_DEG;
506  }
507 }
508 
509 int close_prism(prism4ocia_t* data) {
510  int ib;
511 
512  // undo what open allocated
513 
515  free(data);
516 
517  return 0;
518 }
519 
520 float getValidOrcaAngle(float *ang, int32_t npix, int32_t skip, float *fillangle) {
521  int32_t i;
522  float angle = *fillangle;
523 
524  for (i = 0; i < npix && ang[i] <= skip; i++)
525  angle = ang[i];
526 
527  *fillangle = angle;
528  return (angle);
529 
530 }
531 
532 /*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
533 /*:: Compute the angular distance :*/
534 
535 /*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
536 
537 double angular_distance(double lat1, double lon1, double lat2, double lon2) {
538  double theta, dist;
539  theta = lon1 - lon2;
540  dist = sin(deg2rad(lat1)) * sin(deg2rad(lat2)) + cos(deg2rad(lat1)) * cos(deg2rad(lat2)) * cos(deg2rad(theta));
541  dist = dist > 1 ? 1 : dist;
542  dist = dist<-1 ? -1 : dist;
543  return (acos(dist));
544 }
545 
546 /*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
547 /*:: This function converts decimal degrees to radians :*/
548 
549 /*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
550 double deg2rad(double deg) {
551  return (deg * M_PI / 180);
552 }
553 
554 void prism_proj4_convert(prism4ocia_t * data, int numPoints, double *x, double *y) {
555  int i;
556  if (pj_transform(data->pj_ortho, data->pj_latlong, numPoints, 1, x, y, NULL)) {
557  fprintf(stderr, "-E- %s line %d: prism proj4 transformation blew up\n",
558  __FILE__, __LINE__);
559  exit(1);
560  }
561  for (i = 0; i < numPoints; i++) {
562  x[i] *= RAD_TO_DEG;
563  y[i] *= RAD_TO_DEG;
564  }
565 }
566 
void trimBlanks(char *str)
Definition: trimBlanks.c:10
int read_prism(prism4ocia_t *data, int32_t recnum)
prism4ocia_t * createPrivateData_pr(int numBands, int32_t nscan, int32_t npix)
Definition: read_prism.c:36
double deg2rad(double deg)
Definition: read_prism.c:550
prism4ocia_t * open_prism(char *filename, prism4ocia_t **data)
Definition: read_prism.c:74
int j
Definition: decode_rs.h:73
void get_zenaz(float *pos, float lon, float lat, float *senz, float *sena)
Definition: get_zenaz.c:28
int32_t day
int status
Definition: l1_czcs_hdf.c:32
#define MAXLINESZ
Definition: read_prism.c:20
int16 * gain
Definition: l1_czcs_hdf.c:33
real(single), dimension(:,:), allocatable longitude
#define RAD_TO_DEG
Definition: get_zenaz.c:7
#define NULL
Definition: decode_rs.h:63
char * getinbasename(char *file)
Definition: jplaeriallib.c:41
#define BIL
Definition: read_prism.c:18
void prism4ocia_proj4_convert(prism4ocia_t *data, int32_t numPoints, double *x, double *y)
Definition: read_prism.c:496
real(single), dimension(:,:), allocatable latitude
void unix2ymds(double usec, int16_t *year, int16_t *mon, int16_t *day, double *secs)
Definition: unix2ymds.c:8
void getPosVec(float lat, float lon, float alt, double *pos)
Definition: jplaeriallib.c:561
char * checknspTagLine(char *line, char *tag)
Definition: jplaeriallib.c:534
float32 * pos
Definition: l1_czcs_hdf.c:35
float * lat
#define BIP
Definition: read_prism.c:17
int32 nscan
Definition: l1_czcs_hdf.c:19
data_t tmp
Definition: decode_rs.h:74
read recnum
void cdata_()
#define M_PI
Definition: pml_iop.h:15
int close_prism(prism4ocia_t *data)
Definition: read_prism.c:509
void unix2yds(double usec, short *year, short *day, double *secs)
char filename[FILENAME_MAX]
Definition: atrem_corl1.h:122
no change in intended resolving MODur00064 Corrected handling of bad ephemeris attitude data
Definition: HISTORY.txt:356
float getValidOrcaAngle(float *ang, int32_t npix, int32_t skip, float *fillangle)
Definition: read_prism.c:520
int checkTagLine_i(char *linein, char *tag)
Definition: jplaeriallib.c:482
const char * str
Definition: l1c_msi.cpp:35
void ymdhms2ydmsec(int yy, int mm, int dd, int hh, int mn, int sc, int32_t *year, int32_t *day, int32_t *msec)
Definition: ydhms2ydmsec.c:3
char * checkTagLine(char *linein, char *tag)
Definition: jplaeriallib.c:433
int32_t nbands
int readBinScanLine4Ocip_float(float *Lt, int32_t recnum, int32_t npix, double *gain, int nbands, int numBands, int interleave, int swap, FILE *ptr)
Definition: jplaeriallib.c:189
char * unix2isodate(double dtime, char zone)
Definition: unix2isodate.c:10
double angular_distance(double lat1, double lon1, double lat2, double lon2)
Definition: read_prism.c:537
float * lon
double ymds2unix(short year, short month, short day, double secs)
int readBinScanLine_float(float *Lt, int32_t recnum, int32_t npix, double *gain, int nbands, int numBands, int interleave, int swap, FILE *ptr)
Definition: jplaeriallib.c:371
int i
Definition: decode_rs.h:71
void prism_proj4_convert(prism4ocia_t *data, int numPoints, double *x, double *y)
Definition: read_prism.c:554
msiBandIdx val
Definition: l1c_msi.cpp:34
How many dimensions is the output array Default is Not sure if anything above will work correctly strcpy(l2prod->title, "no title yet")
#define maxBands
int32_t iyr
Definition: atrem_corl1.h:161
int sunpos(double tjd, double r[3], char **errstr)
int k
Definition: decode_rs.h:73
int npix
Definition: get_cmp.c:27
void l_sun_(int *iyr, int *iday, double *sec, float *sunr, float *rs)
#define SKIP
Definition: read_prism.c:16
void freePrivateData_pr(prism4ocia_t *data)
Definition: read_prism.c:59
int count
Definition: decode_rs.h:79