source: XIOS/dev/dev_olga/src/extern/src_netcdf4/ncfunc.c @ 1022

Last change on this file since 1022 was 1022, checked in by mhnguyen, 7 years ago
File size: 2.3 KB
Line 
1/*
2
3This file is part of netcdf-4, a netCDF-like interface for HDF5, or a
4HDF5 backend for netCDF, depending on your point of view.
5
6This file handles the nc_ calls, calling the appropriate nc3 or nc4
7function, depending on ncid.
8
9Copyright 2003, University Corporation for Atmospheric Research. See
10netcdf-4/docs/COPYRIGHT file for copying and redistribution
11conditions.
12*/
13
14#include "nc4internal.h"
15#include "nc3dispatch.h"
16
17#ifdef IGNORE
18/* Keep a linked list of file info objects. */
19extern NC_FILE_INFO_T *nc_file;
20#endif
21
22#ifdef IGNORE
23/* This function deletes a member of parliment. Be careful! Last time
24 * this function was used, Labor got in! This function only does
25 * anything for netcdf-3 files. */
26
27int
28nc_delete(const char *path)
29{
30   return NC3_delete_mp(path, 0);
31}
32
33int
34nc_delete_mp(const char *path, int basepe)
35{
36   return NC3_delete_mp(path, basepe);
37}
38#endif
39
40/* This will return the length of a netcdf data type in bytes. Since
41   we haven't added any new types, I just call the v3 function.
42   Ed Hartnett 10/43/03
43*/
44
45/* This function only does anything for netcdf-3 files. */
46int
47NC4_set_base_pe(int ncid, int pe)
48{
49   NC_FILE_INFO_T *nc;
50   if (!(nc = nc4_find_nc_file(ncid)))
51      return NC_EBADID;
52   if (nc->nc4_info)
53      return NC_ENOTNC3;
54   return NC3_set_base_pe(nc->int_ncid,  pe);
55}
56
57/* This function only does anything for netcdf-3 files. */
58int
59NC4_inq_base_pe(int ncid, int *pe)
60{
61   NC_FILE_INFO_T *nc;
62   if (!(nc = nc4_find_nc_file(ncid)))
63      return NC_EBADID;
64   if (nc->nc4_info)
65      return NC_ENOTNC3;
66   return NC3_inq_base_pe(nc->int_ncid, pe);
67}
68
69/* Get the format (i.e. classic, 64-bit-offset, or netcdf-4) of an
70 * open file. */
71int
72NC4_inq_format(int ncid, int *formatp)
73{
74   NC_FILE_INFO_T *nc;
75
76   LOG((2, "nc_inq_format: ncid 0x%x", ncid));
77
78   if (!formatp)
79      return NC_NOERR;
80
81   /* Find the file metadata. */
82   if (!(nc = nc4_find_nc_file(ncid)))
83      return NC_EBADID;
84
85   /* If this isn't a netcdf-4 file, pass this call on to the netcdf-3
86    * library. */
87   if (!nc->nc4_info)
88      return NC3_inq_format(nc->int_ncid, formatp);
89   
90   /* Otherwise, this is a netcdf-4 file. Check if classic NC3 rules
91    * are in effect for this file. */
92   if (nc->nc4_info->cmode & NC_CLASSIC_MODEL)
93      *formatp = NC_FORMAT_NETCDF4_CLASSIC;
94   else
95      *formatp = NC_FORMAT_NETCDF4;
96
97   return NC_NOERR;
98}
99
100
Note: See TracBrowser for help on using the repository browser.