Due to the lapse in federal government funding, NASA is not updating this website. We sincerely regret this inconvenience.
NASA Logo
Ocean Color Science Software

ocssw V2022
cpl1rec.c
Go to the documentation of this file.
1 #include "l12_proto.h"
2 #include "anc_acq.h"
3 
4 /* for SGLI, copy pointer to geom_per_band */
5 
6 void cpl1rec(l1str *dest, l1str *src) {
7  dest->npix = src->npix;
8  dest->length = src->length;
9  dest->iscan = src->iscan;
10  dest->detnum = src->detnum;
11  dest->mside = src->mside;
12  dest->scantime = src->scantime;
13  dest->margin_s = src->margin_s;
14  dest->fsol = src->fsol;
15  dest->tilt = src->tilt;
16  dest->alt = src->alt;
17  dest->is_l2 = src->is_l2;
18 
19  dest->scn_fmt = src->scn_fmt;
20  dest->margin_s = src->margin_s;
21 
22  memcpy(dest->data, src->data, dest->length);
23 
24  if (dest->uncertainty)
25  memcpy(dest->uncertainty->data, src->uncertainty->data, dest->uncertainty->length);
26 
27  if (src->geom_per_band) {
28  int32_t nbands = src->l1file->nbands;
29  int32_t npix = src->npix;
30 
31  if (!dest->geom_per_band)
33 
34  memcpy(dest->geom_per_band->senz, src->geom_per_band->senz, npix * nbands * sizeof (float));
35  memcpy(dest->geom_per_band->sena, src->geom_per_band->sena, npix * nbands * sizeof (float));
36  memcpy(dest->geom_per_band->csenz, src->geom_per_band->csenz, npix * nbands * sizeof (float));
37  memcpy(dest->geom_per_band->solz, src->geom_per_band->solz, npix * nbands * sizeof (float));
38  memcpy(dest->geom_per_band->sola, src->geom_per_band->sola, npix * nbands * sizeof (float));
39  memcpy(dest->geom_per_band->csolz, src->geom_per_band->csolz, npix * nbands * sizeof (float));
40  memcpy(dest->geom_per_band->scattang, src->geom_per_band->scattang, npix * nbands * sizeof (float));
41  memcpy(dest->geom_per_band->delphi, src->geom_per_band->delphi, npix * nbands * sizeof (float));
42  } else {
43  if (dest->geom_per_band) {
44  printf("-W- cpl1rec - Copying from empty to allocated geom_per_band\n");
45  }
46  }
47  /* for the added ancillary profile data */
48  if (src->anc_add) {
49  int32_t npix = src->npix;
50  int32_t nlvl = src->anc_add->nlvl;
51 
52  if (!dest->anc_add)
54 
55  memcpy(dest->anc_add->prof_temp, src->anc_add->prof_temp,
56  npix * nlvl * sizeof (float));
57  memcpy(dest->anc_add->prof_rh, src->anc_add->prof_rh,
58  npix * nlvl * sizeof (float));
59  memcpy(dest->anc_add->prof_height, src->anc_add->prof_height,
60  npix * nlvl * sizeof (float));
61  memcpy(dest->anc_add->prof_q, src->anc_add->prof_q,
62  npix * nlvl * sizeof (float));
63  memcpy(dest->anc_add->prof_o3, src->anc_add->prof_o3,
64  npix * nlvl * sizeof (float));
65  } else {
66  if (dest->anc_add) {
67  printf("-W- cpl1rec - Copying from empty to allocated anc_add\n");
68  }
69  }
70  /* for the ancillary aerosol data */
71  if (src->anc_aerosol) {
72  /* use the # pixels in the subset if made */
73  int32_t npix = src->npix;
74 
75  if (!dest->anc_aerosol)
77 
78  memcpy(dest->anc_aerosol->black_carbon_ext, src->anc_aerosol->black_carbon_ext,
79  npix * sizeof (float));
80  memcpy(dest->anc_aerosol->black_carbon_scat, src->anc_aerosol->black_carbon_scat,
81  npix * sizeof (float));
82  memcpy(dest->anc_aerosol->dust_ext, src->anc_aerosol->dust_ext,
83  npix * sizeof (float));
84  memcpy(dest->anc_aerosol->dust_scat, src->anc_aerosol->dust_scat,
85  npix * sizeof (float));
86  memcpy(dest->anc_aerosol->organic_carbon_ext, src->anc_aerosol->organic_carbon_ext,
87  npix * sizeof (float));
88  memcpy(dest->anc_aerosol->organic_carbon_scat, src->anc_aerosol->organic_carbon_scat,
89  npix * sizeof (float));
90  memcpy(dest->anc_aerosol->sea_salt_ext, src->anc_aerosol->sea_salt_ext,
91  npix * sizeof (float));
92  memcpy(dest->anc_aerosol->sea_salt_scat, src->anc_aerosol->sea_salt_scat,
93  npix * sizeof (float));
94  memcpy(dest->anc_aerosol->sulphur_ext, src->anc_aerosol->sulphur_ext,
95  npix * sizeof (float));
96  memcpy(dest->anc_aerosol->sulphur_scat, src->anc_aerosol->sulphur_scat,
97  npix * sizeof (float));
98  memcpy(dest->anc_aerosol->total_aerosol_ext, src->anc_aerosol->total_aerosol_ext,
99  npix * sizeof (float));
100  memcpy(dest->anc_aerosol->total_aerosol_scat, src->anc_aerosol->total_aerosol_scat,
101  npix * sizeof(float));
102  memcpy(dest->anc_aerosol->total_aerosol_angstrom, src->anc_aerosol->total_aerosol_angstrom,
103  npix * sizeof (float));
104 
105  } else {
106  if (dest->anc_aerosol) {
107  printf("-W- cpl1rec - Copying from empty to allocated anc_aerosol\n");
108  }
109  }
110  /* for the cloud data (albedo) */
111  if (src->cld_dat) {
112  /* use the # pixels in the subset if made */
113  int32_t npix = src->npix;
114 
115  if (!dest->cld_dat)
117 
118  memcpy(dest->cld_dat->sfc_albedo_659, src->cld_dat->sfc_albedo_659,
119  npix * sizeof( float ));
120  memcpy(dest->cld_dat->sfc_albedo_858, src->cld_dat->sfc_albedo_858,
121  npix * sizeof( float ));
122  memcpy(dest->cld_dat->sfc_albedo_1240, src->cld_dat->sfc_albedo_1240,
123  npix * sizeof( float ));
124  memcpy(dest->cld_dat->sfc_albedo_1640, src->cld_dat->sfc_albedo_1640,
125  npix * sizeof( float ));
126  memcpy(dest->cld_dat->sfc_albedo_2130, src->cld_dat->sfc_albedo_2130,
127  npix * sizeof( float ));
128  memcpy(dest->cld_dat->cth_alb_init, src->cld_dat->cth_alb_init,
129  npix * sizeof( float ));
130  memcpy(dest->cld_dat->cth_alb_unc_init, src->cld_dat->cth_alb_unc_init,
131  npix * sizeof( float ));
132  } else {
133  if (dest->cld_dat) {
134  printf("-W- cpl1rec - Copying from empty to allocated cld_dat\n");
135  }
136  }
137 
138  if (src->cld_rad) {
139  const float *time_range = src->cld_rad->timecldrange;
140  size_t timesize = src->cld_rad->ntimes;
141  size_t npix = src->npix;
142  if (!dest->cld_rad) {
143  init_anc_cld_rad(dest, timesize, time_range);
144  }
145  for (size_t ip = 0; ip < npix; ip++) {
146  memcpy(dest->cld_rad->taucld[ip], src->cld_rad->taucld[ip], timesize * sizeof(float));
147  memcpy(dest->cld_rad->cfcld[ip], src->cld_rad->cfcld[ip], timesize * sizeof(float));
148  }
149  } else {
150  if (dest->cld_rad) {
151  printf("-W- cpl1rec - Copying from empty to allocated cld_rad\n");
152  }
153  }
154 }
int init_geom_per_band(l1str *l1rec)
Definition: geom_per_band.c:7
void cpl1rec(l1str *dest, l1str *src)
Definition: cpl1rec.c:6
int init_anc_add(l1str *l1rec)
Definition: anc_acq.c:1131
int32_t nbands
int32_t init_anc_aerosol(l1str *l1rec)
Definition: anc_acq.c:1077
int32_t init_anc_cld_rad(l1str *l1rec, size_t times_dim, const float *time_range)
Definition: anc_acq.c:1104
int init_cld_dat(l1str *l1rec)
int npix
Definition: get_cmp.c:28