OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
resize_oz.c
Go to the documentation of this file.
1 void resize_oz(short *input, int in_pix, int in_lin,
2  int out_pix, int out_lin, short *output)
3 /*********************************************************************
4 
5  Function: resize_oz
6 
7  Returns type: void
8 
9  Description: convert a short 2D array of values (ozone but it could
10  be anything) into a larger / smaller short array. expand the
11  pixels / lines by whatever factors are needed
12 
13  Parameters: (in calling order)
14  Type Name I/O Description
15  ---- ---- --- -----------
16  short * input I input array
17  int in_pix I input # pixels
18  int in_lin I input # lines
19  int out_pix I output # pixels
20  int out_lin I output # lines
21  short * output O finished array
22 
23  Modification history:
24  Programmer Date Description of change
25  ---------- ---- ---------------------
26  W. Robinson 9 Jul 98 Original development
27 
28  *********************************************************************/ {
29  float fact_lin, fact_pix, wt_p, wt_l, v1, v2, pix_pos, lin_pos;
30  int ipx, iln, lin_index, pix_index;
31 
32  /*
33  * find the ratio between output and input pixels and lines
34  */
35 
36  fact_pix = (float) (out_pix - 1) / (float) (in_pix - 1);
37  fact_lin = (float) (out_lin - 1) / (float) (in_lin - 1);
38 
39  /*
40  * expand the lixels and lines using interpolation
41  * start with a line loop
42  */
43  for (iln = 0; iln < out_lin; iln++) {
44  /*
45  * get the line # of the first interpolation point and the weight
46  * to apply
47  */
48  lin_pos = (float) iln / fact_lin;
49  lin_index = (short) lin_pos;
50  wt_l = 1. - ((lin_pos - (float) lin_index) * fact_lin);
51 
52  /*
53  * loop over the pixels also
54  */
55  for (ipx = 0; ipx < out_pix; ipx++) {
56  /*
57  * get the pixel # of the first interpolation point and the weight
58  * to apply
59  */
60  pix_pos = (float) ipx / fact_pix;
61  pix_index = (short) pix_pos;
62  wt_p = 1. - ((pix_pos - (float) pix_index) * fact_pix);
63  /*
64  * interpolate first in line direction. Note that at end of rows
65  * and columns, the next interpolate point is beyond the array
66  * bounds, hence the ifs below
67  */
68  v1 = (float) *(input + in_pix * lin_index + pix_index) * wt_l;
69  if (wt_l < 1.) {
70  v1 += (float) *(input + in_pix * (lin_index + 1) + pix_index) *
71  (1. - wt_l);
72  }
73  if (wt_p < 1.) {
74  v2 = (float) *(input + in_pix * lin_index + (pix_index + 1))
75  * wt_l;
76  if (wt_l < 1.) {
77  v2 += (float) *(
78  input + in_pix * (lin_index + 1) + (pix_index + 1)
79  ) * (1. - wt_l);
80  }
81  } else
82  v2 = 0.;
83  /*
84  * interpolate in pixel now
85  */
86  *(output + out_pix * iln + ipx) = wt_p * v1 + (1. - wt_p) * v2;
87  } /* end pixel loop */
88  } /* end line loop */
89 
90 }
u5 which has been done in the LOCALGRANULEID metadata should have an extension NRT It is requested to identify the NRT production Changes from v6 which may affect scientific output
Definition: HISTORY.txt:186
instr * input
an array had not been initialized Several spelling and grammar corrections were which is read from the appropriate MCF the above metadata values were hard coded A problem calculating the average background DN for SWIR bands when the moon is in the space view port was corrected The new algorithm used to calculate the average background DN for all reflective bands when the moon is in the space view port is now the same as the algorithm employed by the thermal bands For non SWIR changes in the averages are typically less than Also for non SWIR the black body DNs remain a backup in case the SV DNs are not available For SWIR the changes in computed averages were larger because the old which used the black body suffered from contamination by the micron leak As a consequence of the if SV DNs are not available for the SWIR the EV pixels will not be the granule time is used to identify the appropriate tables within the set given for one LUT the first two or last two tables respectively will be used for the interpolation If there is only one LUT in the set of it will be treated as a constant LUT The manner in which Earth View data is checked for saturation was changed Previously the raw Earth View DNs and Space View DNs were checked against the lookup table values contained in the table dn_sat The change made is to check the raw Earth and Space View DNs to be sure they are less than the maximum saturation value and to check the Space View subtracted Earth View dns against a set of values contained in the new lookup table dn_sat_ev The metadata configuration and ASSOCIATEDINSTRUMENTSHORTNAME from the MOD02HKM product The same metatdata with extensions and were removed from the MOD021KM and MOD02OBC products ASSOCIATEDSENSORSHORTNAME was set to MODIS in all products These changes are reflected in new File Specification which users may consult for exact the pow functions were eliminated in Emissive_Cal and Emissive bands replaced by more efficient code Other calculations throughout the code were also made more efficient Aside from a few round off there was no difference to the product The CPU time decreased by about for a day case and for a night case A minor bug in calculating the uncertainty index for emissive bands was corrected The frame the required RAM for each execution is MB on the DEC ALPHA and MB on the SGI Octane v2
Definition: HISTORY.txt:728
void resize_oz(short *input, int in_pix, int in_lin, int out_pix, int out_lin, short *output)
Definition: resize_oz.c:1