OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
L1A_datatype_to_DFNT.c
Go to the documentation of this file.
1 #include "L1A_prototype.h"
2 #include <string.h>
3 #include "mfhdf.h"
4 #include "mapi.h"
5 
6 #define NULLstring(c) (((c)==NULL) || (*(c) == '\0'))
7 
8 
9 int32 L1A_datatype_to_DFNT(char *datatype)
10 
11 /*
12 !C************************************************************************
13 
14 !Description: L1A_datatype_to_DFNT takes a M-API data type string and
15  returns the HDF number type integer used by HDF routines
16  to identify number types.
17 
18 !Input Parameters:
19  char *datatype pointer to M-API data type string
20  permitted types: "int8"
21  "uint8"
22  "int16"
23  "uint16"
24  "int32"
25  "uint32"
26  "int64"
27  "uint64"
28  "float32"
29  "float64"
30  "char *"
31 
32 !Output Parameters:
33  None
34 
35 Return Values:
36  HDF number type or MFAIL if an error occurs
37 
38 Externally Defined:
39  DFNT_INT8 (hdf.h)
40  DFNT_UINT8 (hdf.h)
41  DFNT_INT16 (hdf.h)
42  DFNT_UINT16 (hdf.h)
43  DFNT_INT32 (hdf.h)
44  DFNT_UINT32 (hdf.h)
45  DFNT_INT64 (hdf.h)
46  DFNT_UINT64 (hdf.h)
47  DFNT_FLOAT32 (hdf.h)
48  DFNT_FLOAT64 (hdf.h)
49  DFNT_CHAR8 (hdf.h)
50  I8 (mapi.h)
51  UI8 (mapi.h)
52  I16 (mapi.h)
53  UI16 (mapi.h)
54  I32 (mapi.h)
55  UI32 (mapi.h)
56  I64 (mapi.h)
57  UI64 (mapi.h)
58  R32 (mapi.h)
59  R64 (mapi.h)
60  TXT (mapi.h)
61  MFAIL (mapi.h)
62 
63 Called By:
64  create_Vdata_field
65 
66 Routines Called:
67  None
68 
69 !Revision History:
70  Revision 1.0 1997/10/01 11:25 EDT
71  Tom Johnson/GSC (johnson@ltpmail.gsfc.nasa.gov)
72  Incorporate walkthrough comments
73 
74 !Team-unique Header:
75  This software is developed by the MODIS Science
76  Data Support Team (SDST) for the National Aeronautics
77  and Space Administration (NASA), Goddard Space Flight
78  Center (GSFC), under contract NAS5-32373.
79 
80 !References and Credits:
81  None
82 
83 !Design Notes:
84  This routine is a exact copy of the MAPI routine
85  datatype_to_DFNT.
86 
87 !END************************************************************************
88 */
89 
90 {
91  int32 output=0; /* used to return HDF datatype */
92 
93  /* if datatype points to a nullstring return MFAIL */
94  if (NULLstring(datatype)) return(MFAIL);
95 
96  /* select correct HDF datatype */
97  if ((strcmp(datatype,I8)==0)) output=DFNT_INT8;
98  else if ((strcmp(datatype,UI8)==0)) output=DFNT_UINT8;
99  else if ((strcmp(datatype,I16)==0)) output=DFNT_INT16;
100  else if ((strcmp(datatype,UI16)==0)) output=DFNT_UINT16;
101  else if ((strcmp(datatype,I32)==0)) output=DFNT_INT32;
102  else if ((strcmp(datatype,UI32)==0)) output=DFNT_UINT32;
103 /************************************************************************
104  64 bit integer support disabled until HDF decides to support it.
105  To re-enable, remove comments around the following block of code.
106 
107  else if ((strcmp(datatype,I64)==0)) output=DFNT_INT64;
108  else if ((strcmp(datatype,UI64)==0)) output=DFNT_UINT64;
109 ************************************************************************/
110  else if ((strcmp(datatype,R32)==0)) output=DFNT_FLOAT32;
111  else if ((strcmp(datatype,R64)==0)) output=DFNT_FLOAT64;
112  else if ((strcmp(datatype,TXT)==0)) output=DFNT_CHAR8;
113  else output=MFAIL;
114 
115  return(output);
116 
117 } /* end L1A_datatype_to_DFNT */
118 
int32 L1A_datatype_to_DFNT(char *datatype)
#define NULLstring(c)
HDF4 data type of the output SDS Default is DFNT_FLOAT32 Common types used DFNT_INT32
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
HDF4 data type of the output SDS Default is DFNT_FLOAT32 Common types used DFNT_INT16
HDF4 data type of the output SDS Default is DFNT_FLOAT32 Common types used DFNT_FLOAT32