OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
wr_attr_seq.c
Go to the documentation of this file.
1 #include "viirs_sim_sdr.h"
2 #include <stdio.h>
3 #include <string.h>
4 
5 int wr_attr_seq(h5io_str *fid, int n_attr, h5attr_struc *attrs)
6 /*-----------------------------------------------------------------------------
7  Program: mk_geo_sdr.c
8 
9  Description: create the geolocation file
10 
11  Arguments:
12  Type Name I/O Description
13  ---- ---- --- -----------
14  h5io_str * fid I dataset or group id to place attributes in
15  int n_attr I number of attributes to wtite
16  h5attr_struc * attrs I Atribute description structure
17 
18  Modification history:
19 
20  W. Robinson, SAIC 20 Oct 2008 Original development
21 
22 ----------------------------------------------------------------------------*/ {
23  int i;
24  /*
25  * Loop through the attribs and output
26  */
27  for (i = 0; i < n_attr; i++) {
28  /* only output if the express value is on */
29  if (attrs[i].express == 1) {
30  if (attrs[i].type == 0) {
31  if (h5io_wr_attr(fid, attrs[i].name, attrs[i].typ,
32  attrs[i].ndim, attrs[i].dim_siz, (void *) attrs[i].data)
33  != 0) {
34  printf("%s %d: Trouble writing non-string attr # %d\n",
35  __FILE__, __LINE__, i);
36  return 1;
37  }
38  } else {
39  if (h5io_wr_attr_str(fid, attrs[i].name, attrs[i].ndim,
40  attrs[i].dim_siz, attrs[i].str_len, (void *) attrs[i].data)
41  != 0) {
42  printf("%s %d: Trouble writing string attr # %d\n",
43  __FILE__, __LINE__, i);
44  return 1;
45  }
46  }
47  }
48  }
49  return 0;
50 }
int h5io_wr_attr(h5io_str *id, char *attr_name, hid_t out_type, int ndim, int *dim_siz, void *data)
Definition: h5io.c:922
no change in intended resolving MODur00064 Corrected handling of bad ephemeris attitude data
Definition: HISTORY.txt:356
int h5io_wr_attr_str(h5io_str *id, char *attr_name, int ndim, int *dim_siz, int str_len, char *data)
Definition: h5io.c:1006
int wr_attr_seq(h5io_str *fid, int n_attr, h5attr_struc *attrs)
Definition: wr_attr_seq.c:5
int i
Definition: decode_rs.h:71