OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
filehandle_init.c
Go to the documentation of this file.
1 #include "filehandle.h"
2 
3 #include <string.h>
4 #include <stdlib.h>
5 
6 float* calloc_nbandsf(int32_t nbands, float *nbarray, float init_val) {
7  int i;
8 
9  if ((nbarray = (float *) calloc(nbands, sizeof (float))) == NULL) {
10  printf("-E- : Error allocating float memory in alloc_nbandsf\n");
11  exit(EXIT_FAILURE);
12  }
13  for (i = 0; i < nbands; i++)
14  nbarray[i] = init_val;
15 
16  return nbarray;
17 }
18 
19 int32_t* calloc_nbandsi32t(int32_t nbands, int32_t *nbarray, int32_t init_val) {
20  int i;
21  if ((nbarray = (int32_t *) calloc(nbands, sizeof (int32_t))) == NULL) {
22  printf("-E- : Error allocating float memory in alloc_nbandsi\n");
23  exit(EXIT_FAILURE);
24  }
25  for (i = 0; i < nbands; i++)
26  nbarray[i] = init_val;
27 
28  return nbarray;
29 }
30 
31 int* calloc_nbandsi(int32_t nbands, int *nbarray, int init_val) {
32  int i;
33  if ((nbarray = (int *) calloc(nbands, sizeof (int))) == NULL) {
34  printf("-E- : Error allocating float memory in alloc_nbandsi\n");
35  exit(EXIT_FAILURE);
36  }
37  for (i = 0; i < nbands; i++)
38  nbarray[i] = init_val;
39 
40  return nbarray;
41 }
42 
43 void filehandle_init(filehandle *file) {
44  int32_t i;
45 
46  strcpy(file->name, "");
47  file->format = -1;
48  file->sensorID = -1;
49  file->subsensorID = -1;
50  strcpy(file->spatialResolution, "");
51 
52  file->length = 0;
53  file->spix = 0;
54  file->epix = -1;
55  file->npix = 0;
56  file->ctl_pt_incr = 1;
57  file->nscan = 0;
58  file->nbands = 0;
59  file->nbandsir = 0;
60  file->nlvl = 42; /* fixed 42 GMAO FP-IT levels now */
61  file->n_refl_loc = 10; /* reflectance location 3rd dim count */
62  file->bindx = NULL;
63  file->ndets = 1;
64  file->mode = READ;
65  strcpy(file->l2prod, "");
66  strcpy(file->def_l2prod, "");
67  file->sd_id = 0;
68  file->tot_prod = 0;
69  for (i = 0; i < L1_MAXPROD; i++)
70  strcpy(file->l2_prod_names[i], "");
71  file->prodptr = NULL;
72  file->productInfos = NULL;
73 
74  file->geofile = NULL;
75  file->orbit_node_lon = -999.0;
76  file->orbit_number = 0;
77  file->node_crossing_time = 0;
78  memset(file->flag_cnt, 0, L1_NFLAGS * sizeof (int32_t));
79  file->terrain_corrected = 0;
80  file->sv_with_moon = 0;
81  for(i=0; i<8; i++)
82  file->grp_id[i] = -1;
83 
84  file->iwave = NULL;
85  file->fwave = NULL;
86  file->fwhm = NULL;
87  file->Fobar = NULL;
88  file->Fonom = NULL;
89  file->Tau_r = NULL;
90  file->k_oz = NULL;
91  file->k_no2 = NULL;
92  file->aw = NULL;
93  file->bbw = NULL;
94 
95  file->private_data = NULL;
96 
97  return;
98 }
#define L1_MAXPROD
Definition: filehandle.h:20
#define NULL
Definition: decode_rs.h:63
#define READ
Definition: l1c.h:32
int * calloc_nbandsi(int32_t nbands, int *nbarray, int init_val)
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
Definition: HISTORY.txt:413
float * calloc_nbandsf(int32_t nbands, float *nbarray, float init_val)
int32_t * calloc_nbandsi32t(int32_t nbands, int32_t *nbarray, int32_t init_val)
int32_t nbands
void filehandle_init(filehandle *file)
int i
Definition: decode_rs.h:71
How many dimensions is the output array Default is Not sure if anything above will work correctly strcpy(l2prod->title, "no title yet")
#define L1_NFLAGS
Definition: filehandle.h:21