OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
create_sds.c
Go to the documentation of this file.
1 /*
2  create HDF SDS
3 
4  Created by Gary Fu, SAIC GSC, 4/98
5  */
6 
7 #include "hdf.h"
8 #include "mfhdf.h"
9 
10 int32 create_sds(int32 sdfid, char *sdsname, int32 nt, int32 rank,
11  int32 *dims, int32 vid, VOIDP *data) {
12  int32 i, sdsid, sdsref;
13  int32 start[3] = {0, 0, 0}, edge[3] = {0, 0, 0};
14 
15  if ((sdsid = SDcreate(sdfid, sdsname, nt, rank, dims)) < 0)
16  return FAIL;
17 
18  for (i = 0; i < rank; i++)
19  edge[i] = dims[i];
20 
21  if ((SDwritedata(sdsid, start, NULL, edge, (VOIDP) data)) < 0)
22  return FAIL;
23 
24  if ((sdsref = SDidtoref(sdsid)) < 0) {
25  fprintf(stderr, "\nSDidtoref failed for %s", sdsname);
26  return FAIL;
27  }
28 
29  if (vid > 0) {
30  if ((Vaddtagref(vid, DFTAG_NDG, sdsref)) < 0) {
31  fprintf(stderr, "\nVaddtagref failed while trying to link %s", sdsname);
32  return FAIL;
33  }
34  }
35 
36  SDendaccess(sdsid);
37 
38  return sdsid;
39 }
40 
#define FAIL
Definition: ObpgReadGrid.h:18
#define NULL
Definition: decode_rs.h:63
int32 create_sds(int32 sdfid, char *sdsname, int32 nt, int32 rank, int32 *dims, int32 vid, VOIDP *data)
Definition: create_sds.c:10
no change in intended resolving MODur00064 Corrected handling of bad ephemeris attitude data
Definition: HISTORY.txt:356
Extra metadata that will be written to the HDF4 file l2prod rank
int i
Definition: decode_rs.h:71