NetCDF  4.6.0
ncfunc.c
1 
17 #include "nc4internal.h"
18 #include "nc4dispatch.h"
19 
29 int
30 NC4_set_base_pe(int ncid, int pe)
31 {
32  return NC_ENOTNC3;
33 }
34 
45 int
46 NC4_inq_base_pe(int ncid, int *pe)
47 {
48  return NC_ENOTNC3;
49 }
50 
62 int
63 NC4_inq_format(int ncid, int *formatp)
64 {
65  NC *nc;
66  NC_HDF5_FILE_INFO_T* nc4_info;
67 
68  LOG((2, "nc_inq_format: ncid 0x%x", ncid));
69 
70  if (!formatp)
71  return NC_NOERR;
72 
73  /* Find the file metadata. */
74  if (!(nc = nc4_find_nc_file(ncid,&nc4_info)))
75  return NC_EBADID;
76 
77  /* Otherwise, this is a netcdf-4 file. Check if classic NC3 rules
78  * are in effect for this file. */
79  if (nc4_info->cmode & NC_CLASSIC_MODEL)
80  *formatp = NC_FORMAT_NETCDF4_CLASSIC;
81  else
82  *formatp = NC_FORMAT_NETCDF4;
83 
84  return NC_NOERR;
85 }
86 
104 int
105 NC4_inq_format_extended(int ncid, int *formatp, int *modep)
106 {
107  NC *nc;
108  NC_HDF5_FILE_INFO_T* h5;
109 
110  LOG((2, "nc_inq_format_extended: ncid 0x%x", ncid));
111 
112  /* Find the file metadata. */
113  if (!(nc = nc4_find_nc_file(ncid,&h5)))
114  return NC_EBADID;
115 
116  if(modep) *modep = (nc->mode|NC_NETCDF4);
117 
118  if(formatp) {
119 #ifdef USE_HDF4
120  /* Distinguish HDF5 from HDF4 */
121  *formatp = (h5->hdf4 ? NC_FORMATX_NC_HDF4 : NC_FORMATX_NC_HDF5);
122 #else /* USE_HDF4 */
123  *formatp = NC_FORMATX_NC_HDF5;
124 #endif /* USE_HDF4 */
125  }
126  return NC_NOERR;
127 }
#define NC_ENOTNC3
Attempting netcdf-3 operation on netcdf-4 file.
Definition: netcdf.h:438
#define NC_CLASSIC_MODEL
Enforce classic model on netCDF-4.
Definition: netcdf.h:135
#define NC_NETCDF4
Use netCDF-4/HDF5 format.
Definition: netcdf.h:148
#define NC_FORMAT_NETCDF4_CLASSIC
Format specifier for nc_set_default_format() and returned by nc_inq_format.
Definition: netcdf.h:177
#define NC_FORMATX_NC_HDF4
netCDF-4 subset of HDF4
Definition: netcdf.h:206
#define NC_FORMATX_NC_HDF5
netCDF-4 subset of HDF5
Definition: netcdf.h:204
#define NC_EBADID
Not a netcdf id.
Definition: netcdf.h:322
#define NC_FORMAT_NETCDF4
Format specifier for nc_set_default_format() and returned by nc_inq_format.
Definition: netcdf.h:176
#define NC_NOERR
No Error.
Definition: netcdf.h:315

Return to the Main Unidata NetCDF page.
Generated on Thu Jan 25 2018 21:06:33 for NetCDF. NetCDF is a Unidata library.