OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
rd_size.c
Go to the documentation of this file.
1 #include <mfhdf.h>
2 #include "l1io.h"
3 
4 int rd_size(char *file, int *npix, int *nlin)
5 /*******************************************************************
6 
7  rd_size
8 
9  purpose: open a hdf file, read the size from the attributes
10  and close it (assume size is stored in the 'Number of Rows'
11  and 'Number of Columns' attributes)
12 
13  Returns type: int - 0 if all went well,
14  -1 can't find the attribute
15 
16  Parameters: (in calling order)
17  Type Name I/O Description
18  ---- ---- --- -----------
19  char * file I file to work with
20  int * npix O # pixels (columns)
21  int * nlin O # lines (rows)
22 
23  Modification history:
24  Programmer Date Description of change
25  ---------- ---- ---------------------
26  W. Robinson 5-Feb-1997 Original development
27 
28  *******************************************************************/
29  {
30  l1info_struct hdf_info;
31  int32 n_type, count;
32 
33  n_type = DFNT_INT32;
34  count = 1;
35  /*
36  * open the file
37  */
38  if (open_hdf(file, &hdf_info) != 0) {
39  return -1;
40  }
41  /*
42  * read the 2 attributes
43  */
44  if (read_g_attr(hdf_info, "Number of Rows", &n_type, &count, nlin) != 0) {
45  return -1;
46  }
47  if (read_g_attr(hdf_info, "Number of Columns", &n_type, &count, npix) != 0) {
48  return -1;
49  }
50  /*
51  * close the file
52  */
53  l1io_close(hdf_info);
54 
55  return 0;
56 }
int32 open_hdf(char *fname, l1info_struct *l1info)
Definition: open_hdf.c:5
int rd_size(char *file, int *npix, int *nlin)
Definition: rd_size.c:4
HDF4 data type of the output SDS Default is DFNT_FLOAT32 Common types used DFNT_INT32
int nlin
Definition: get_cmp.c:28
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
int32 read_g_attr(l1info_struct l1info, char *name, int32 *n_type, int32 *count, void *data)
Definition: read_g_attr.c:6
void l1io_close(l1info_struct)
Definition: l1io_close.c:4
int npix
Definition: get_cmp.c:27
int count
Definition: decode_rs.h:79