OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
set_dim_names.c
Go to the documentation of this file.
1 /*-----------------------------------------------------------------------------
2  Function: set_dim_names
3 
4  Returns: int32 (status)
5  The return code is a negative value if any error occurs, otherwise,
6  returns 0.
7 
8  Description:
9  Set the dimension names for an SD
10 
11  Parameters: (in calling order)
12  Type Name I/O Description
13  ---- ---- --- -----------
14  int32 sds_id I id of the SD to be set
15  char *d0 I name for the first dimension
16  char *d1 I name for the second dimension
17  char *d2 I name for the third dimension
18 
19 
20  Modification history:
21  Programmer Organization Date Description of change
22  -------------- ------------ -------- ---------------------
23  Gary Fu SAIC GSC 05/13/98 Original development
24 ----------------------------------------------------------------------------*/
25 
26 #include "hdf.h"
27 #include "mfhdf.h"
28 
29 int32 set_dim_names(int32 sds_id, char *d0, char *d1, char *d2) {
30  int32 dim_id, iret;
31 
32  dim_id = SDgetdimid(sds_id, 0);
33  if ((iret = SDsetdimname(dim_id, d0)) < 0)
34  return FAIL;
35 
36  if (d1 != NULL && *d1 != 0) {
37  dim_id = SDgetdimid(sds_id, 1);
38  if ((iret = SDsetdimname(dim_id, d1)) < 0)
39  return FAIL;
40  }
41  if (d2 != NULL && *d2 != 0) {
42  dim_id = SDgetdimid(sds_id, 2);
43  if ((iret = SDsetdimname(dim_id, d2)) < 0)
44  return FAIL;
45  }
46 
47  return SUCCEED;
48 }
49 
#define FAIL
Definition: ObpgReadGrid.h:18
#define NULL
Definition: decode_rs.h:63
int32 set_dim_names(int32 sds_id, char *d0, char *d1, char *d2)
Definition: set_dim_names.c:29