OB.DAAC Logo
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 (src->geom_per_band) {
25  int32_t nbands = src->l1file->nbands;
26  int32_t npix = src->npix;
27 
28  if (!dest->geom_per_band)
30 
31  memcpy(dest->geom_per_band->senz, src->geom_per_band->senz, npix * nbands * sizeof (float));
32  memcpy(dest->geom_per_band->sena, src->geom_per_band->sena, npix * nbands * sizeof (float));
33  memcpy(dest->geom_per_band->csenz, src->geom_per_band->csenz, npix * nbands * sizeof (float));
34  memcpy(dest->geom_per_band->solz, src->geom_per_band->solz, npix * nbands * sizeof (float));
35  memcpy(dest->geom_per_band->sola, src->geom_per_band->sola, npix * nbands * sizeof (float));
36  memcpy(dest->geom_per_band->csolz, src->geom_per_band->csolz, npix * nbands * sizeof (float));
37  memcpy(dest->geom_per_band->scattang, src->geom_per_band->scattang, npix * nbands * sizeof (float));
38  memcpy(dest->geom_per_band->delphi, src->geom_per_band->delphi, npix * nbands * sizeof (float));
39  } else {
40  if (dest->geom_per_band) {
41  printf("-W- cpl1rec - Copying from empty to allocated geom_per_band\n");
42  }
43  }
44  /* for the added ancillary profile data */
45  if (src->anc_add) {
46  int32_t npix = src->npix;
47  int32_t nlvl = src->anc_add->nlvl;
48 
49  if (!dest->anc_add)
51 
52  memcpy(dest->anc_add->prof_temp, src->anc_add->prof_temp,
53  npix * nlvl * sizeof (float));
54  memcpy(dest->anc_add->prof_rh, src->anc_add->prof_rh,
55  npix * nlvl * sizeof (float));
56  memcpy(dest->anc_add->prof_height, src->anc_add->prof_height,
57  npix * nlvl * sizeof (float));
58  memcpy(dest->anc_add->prof_q, src->anc_add->prof_q,
59  npix * nlvl * sizeof (float));
60  memcpy(dest->anc_add->prof_o3, src->anc_add->prof_o3,
61  npix * nlvl * sizeof (float));
62  } else {
63  if (dest->anc_add) {
64  printf("-W- cpl1rec - Copying from empty to allocated anc_add\n");
65  }
66  }
67  /* for the ancillary aerosol data */
68  if (src->anc_aerosol) {
69  /* use the # pixels in the subset if made */
70  int32_t npix = src->npix;
71 
72  if (!dest->anc_aerosol)
74 
75  memcpy(dest->anc_aerosol->black_carbon_ext, src->anc_aerosol->black_carbon_ext,
76  npix * sizeof (float));
77  memcpy(dest->anc_aerosol->black_carbon_scat, src->anc_aerosol->black_carbon_scat,
78  npix * sizeof (float));
79  memcpy(dest->anc_aerosol->dust_ext, src->anc_aerosol->dust_ext,
80  npix * sizeof (float));
81  memcpy(dest->anc_aerosol->dust_scat, src->anc_aerosol->dust_scat,
82  npix * sizeof (float));
83  memcpy(dest->anc_aerosol->organic_carbon_ext, src->anc_aerosol->organic_carbon_ext,
84  npix * sizeof (float));
85  memcpy(dest->anc_aerosol->organic_carbon_scat, src->anc_aerosol->organic_carbon_scat,
86  npix * sizeof (float));
87  memcpy(dest->anc_aerosol->sea_salt_ext, src->anc_aerosol->sea_salt_ext,
88  npix * sizeof (float));
89  memcpy(dest->anc_aerosol->sea_salt_scat, src->anc_aerosol->sea_salt_scat,
90  npix * sizeof (float));
91  memcpy(dest->anc_aerosol->sulphur_ext, src->anc_aerosol->sulphur_ext,
92  npix * sizeof (float));
93  memcpy(dest->anc_aerosol->sulphur_scat, src->anc_aerosol->sulphur_scat,
94  npix * sizeof (float));
95  memcpy(dest->anc_aerosol->total_aerosol_ext, src->anc_aerosol->total_aerosol_ext,
96  npix * sizeof (float));
97  memcpy(dest->anc_aerosol->total_aerosol_scat, src->anc_aerosol->total_aerosol_scat,
98  npix * sizeof (float));
99 
100  } else {
101  if (dest->anc_aerosol) {
102  printf("-W- cpl1rec - Copying from empty to allocated anc_aerosol\n");
103  }
104  }
105  /* for the cloud data (albedo) */
106  if (src->cld_dat) {
107  /* use the # pixels in the subset if made */
108  int32_t npix = src->npix;
109 
110  if (!dest->cld_dat)
112 
113  memcpy(dest->cld_dat->sfc_albedo_659, src->cld_dat->sfc_albedo_659,
114  npix * sizeof( float ));
115  memcpy(dest->cld_dat->sfc_albedo_858, src->cld_dat->sfc_albedo_858,
116  npix * sizeof( float ));
117  memcpy(dest->cld_dat->sfc_albedo_1240, src->cld_dat->sfc_albedo_1240,
118  npix * sizeof( float ));
119  memcpy(dest->cld_dat->sfc_albedo_1640, src->cld_dat->sfc_albedo_1640,
120  npix * sizeof( float ));
121  memcpy(dest->cld_dat->sfc_albedo_2130, src->cld_dat->sfc_albedo_2130,
122  npix * sizeof( float ));
123  } else {
124  if (dest->cld_dat) {
125  printf("-W- cpl1rec - Copying from empty to allocated cld_dat\n");
126  }
127  }
128 
129 }
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:939
int32_t nbands
int32_t init_anc_aerosol(l1str *l1rec)
Definition: anc_acq.c:898
int init_cld_dat(l1str *l1rec)
Definition: acq_sfc_albedo.c:4
int npix
Definition: get_cmp.c:27