NetCDF  4.3.2
 All Data Structures Files Functions Variables Typedefs Macros Modules Pages
dfile.c
Go to the documentation of this file.
1 
11 #include "config.h"
12 #include <stdlib.h>
13 #ifdef HAVE_SYS_RESOURCE_H
14 #include <sys/resource.h>
15 #endif
16 #ifdef HAVE_SYS_TYPES_H
17 #include <sys/types.h>
18 #endif
19 #ifdef HAVE_SYS_STAT_H
20 #include <sys/stat.h>
21 #endif
22 #ifdef HAVE_FCNTL_H
23 #include <fcntl.h>
24 #endif
25 #include "ncdispatch.h"
26 
27 /* Define an enum over the possible set of
28  File Types
29 */
30 enum FileType {
31 FT_UNKNOWN,
32 FT_HDF,
33 FT_NC,
34 FT_PNETCDF
35 };
36 
37 
38 static int nc_initialized = 0;
39 
77 size_t NC_coord_zero[NC_MAX_VAR_DIMS];
78 size_t NC_coord_one[NC_MAX_VAR_DIMS];
79 
80 static void
81 nc_local_initialize(void)
82 {
83  int i;
84 
85  for(i=0;i<NC_MAX_VAR_DIMS;i++) {
86  NC_coord_one[i] = 1;
87  NC_coord_zero[i] = 0;
88  }
89 }
90 
91 static int
92 NC_check_file_type(const char *path, int use_parallel, void *mpi_info,
93  enum FileType* filetype, int* version)
94 {
95  char magic[MAGIC_NUMBER_LEN];
96 
97  *filetype = FT_UNKNOWN;
98 
99  /* Get the 4-byte magic from the beginning of the file. Don't use posix
100  * for parallel, use the MPI functions instead. */
101 #ifdef USE_PARALLEL
102  if (use_parallel)
103  {
104  MPI_File fh;
105  MPI_Status status;
106  int retval;
107  MPI_Comm comm = MPI_COMM_WORLD;
108  MPI_Info info = MPI_INFO_NULL;
109 
110  if(mpi_info != NULL) {
111  comm = ((NC_MPI_INFO*)mpi_info)->comm;
112  info = ((NC_MPI_INFO*)mpi_info)->info;
113  }
114  if((retval = MPI_File_open(comm, (char *)path, MPI_MODE_RDONLY,info,
115  &fh)) != MPI_SUCCESS)
116  return NC_EPARINIT;
117  if((retval = MPI_File_read(fh, magic, MAGIC_NUMBER_LEN, MPI_CHAR,
118  &status)) != MPI_SUCCESS)
119  return NC_EPARINIT;
120  if((retval = MPI_File_close(&fh)) != MPI_SUCCESS)
121  return NC_EPARINIT;
122  } else
123 #endif /* USE_PARALLEL */
124  {
125  FILE *fp;
126  size_t i;
127 #ifdef HAVE_SYS_STAT_H
128  struct stat st;
129 #endif
130 
131  if(path == NULL || strlen(path)==0)
132  return NC_EINVAL;
133 
134  if (!(fp = fopen(path, "r")))
135  return errno;
136 
137 #ifdef HAVE_SYS_STAT_H
138  /* The file must be at least MAGIC_NUMBER_LEN in size,
139  or otherwise the following fread will exhibit unexpected
140  behavior. */
141  if(!(fstat(fileno(fp),&st) == 0)) {
142  fclose(fp);
143  return errno;
144  }
145 
146  if(st.st_size < MAGIC_NUMBER_LEN) {
147  fclose(fp);
148  return NC_ENOTNC;
149  }
150 #endif
151 
152 
153  i = fread(magic, MAGIC_NUMBER_LEN, 1, fp);
154  fclose(fp);
155  if(i == 0)
156  return NC_ENOTNC;
157  if(i != 1)
158  return errno;
159  }
160 
161  /* Look at the magic number */
162  /* Ignore the first byte for HDF */
163  if(magic[1] == 'H' && magic[2] == 'D' && magic[3] == 'F') {
164  *filetype = FT_HDF;
165  *version = 5;
166  } else if(magic[0] == '\016' && magic[1] == '\003'
167  && magic[2] == '\023' && magic[3] == '\001') {
168  *filetype = FT_HDF;
169  *version = 4;
170  } else if(magic[0] == 'C' && magic[1] == 'D' && magic[2] == 'F') {
171  *filetype = FT_NC;
172  if(magic[3] == '\001')
173  *version = 1; /* netcdf classic version 1 */
174  else if(magic[3] == '\002')
175  *version = 2; /* netcdf classic version 2 */
176  else if(magic[3] == '\005') {
177  *filetype = FT_PNETCDF;
178  *version = 5; /* pnetcdf file */
179  } else
180  return NC_ENOTNC;
181  } else
182  return NC_ENOTNC;
183  return NC_NOERR;
184 }
185 
382 int
383 nc_create(const char *path, int cmode, int *ncidp)
384 {
385  return nc__create(path,cmode,NC_SIZEHINT_DEFAULT,NULL,ncidp);
386 }
387 
449 int
450 nc__create(const char *path, int cmode, size_t initialsz,
451  size_t *chunksizehintp, int *ncidp)
452 {
453  return NC_create(path, cmode, initialsz, 0,
454  chunksizehintp, 0, NULL, ncidp);
455 
456 }
465 int
466 nc__create_mp(const char *path, int cmode, size_t initialsz,
467  int basepe, size_t *chunksizehintp, int *ncidp)
468 {
469  return NC_create(path, cmode, initialsz, basepe,
470  chunksizehintp, 0, NULL, ncidp);
471 }
472 
587 int
588 nc_open(const char *path, int mode, int *ncidp)
589 {
590  return NC_open(path, mode, 0, NULL, 0, NULL, ncidp);
591 }
592 
644 int
645 nc__open(const char *path, int mode,
646  size_t *chunksizehintp, int *ncidp)
647 {
648  return NC_open(path, mode, 0, chunksizehintp, 0,
649  NULL, ncidp);
650 }
651 
660 int
661 nc__open_mp(const char *path, int mode, int basepe,
662  size_t *chunksizehintp, int *ncidp)
663 {
664  return NC_open(path, mode, basepe, chunksizehintp,
665  0, NULL, ncidp);
666 }
667 
685 int
686 nc_inq_path(int ncid, size_t *pathlen, char *path)
687 {
688  NC* ncp;
689  int stat = NC_NOERR;
690  if ((stat = NC_check_id(ncid, &ncp)))
691  return stat;
692  if(ncp->path == NULL) {
693  if(pathlen) *pathlen = 0;
694  if(path) path[0] = '\0';
695  } else {
696  if (pathlen) *pathlen = strlen(ncp->path);
697  if (path) strcpy(path, ncp->path);
698  }
699  return stat;
700 }
701 
750 int
751 nc_redef(int ncid)
752 {
753  NC* ncp;
754  int stat = NC_check_id(ncid, &ncp);
755  if(stat != NC_NOERR) return stat;
756  return ncp->dispatch->redef(ncid);
757 }
758 
814 int
815 nc_enddef(int ncid)
816 {
817  int status = NC_NOERR;
818  NC *ncp;
819  status = NC_check_id(ncid, &ncp);
820  if(status != NC_NOERR) return status;
821  return ncp->dispatch->_enddef(ncid,0,1,0,1);
822 }
823 
905 int
906 nc__enddef(int ncid, size_t h_minfree, size_t v_align, size_t v_minfree,
907  size_t r_align)
908 {
909  NC* ncp;
910  int stat = NC_check_id(ncid, &ncp);
911  if(stat != NC_NOERR) return stat;
912  return ncp->dispatch->_enddef(ncid,h_minfree,v_align,v_minfree,r_align);
913 }
914 
982 int
983 nc_sync(int ncid)
984 {
985  NC* ncp;
986  int stat = NC_check_id(ncid, &ncp);
987  if(stat != NC_NOERR) return stat;
988  return ncp->dispatch->sync(ncid);
989 }
990 
1033 int
1034 nc_abort(int ncid)
1035 {
1036  NC* ncp;
1037  int stat = NC_check_id(ncid, &ncp);
1038  if(stat != NC_NOERR) return stat;
1039 
1040 #ifdef USE_REFCOUNT
1041  /* What to do if refcount > 0? */
1042  /* currently, forcibly abort */
1043  ncp->refcount = 0;
1044 #endif
1045 
1046  stat = ncp->dispatch->abort(ncid);
1047  del_from_NCList(ncp);
1048  free_NC(ncp);
1049  return stat;
1050 }
1051 
1092 int
1093 nc_close(int ncid)
1094 {
1095  NC* ncp;
1096  int stat = NC_check_id(ncid, &ncp);
1097  if(stat != NC_NOERR) return stat;
1098 
1099 #ifdef USE_REFCOUNT
1100  ncp->refcount--;
1101  if(ncp->refcount <= 0)
1102 #endif
1103  {
1104  stat = ncp->dispatch->close(ncid);
1105  /* Remove from the nc list */
1106  del_from_NCList(ncp);
1107  free_NC(ncp);
1108  }
1109  return stat;
1110 }
1111 
1210 int
1211 nc_set_fill(int ncid, int fillmode, int *old_modep)
1212 {
1213  NC* ncp;
1214  int stat = NC_check_id(ncid, &ncp);
1215  if(stat != NC_NOERR) return stat;
1216  return ncp->dispatch->set_fill(ncid,fillmode,old_modep);
1217 }
1218 
1230 int
1231 nc_inq_base_pe(int ncid, int *pe)
1232 {
1233  NC* ncp;
1234  int stat = NC_check_id(ncid, &ncp);
1235  if(stat != NC_NOERR) return stat;
1236  return ncp->dispatch->inq_base_pe(ncid,pe);
1237 }
1238 
1250 int
1251 nc_set_base_pe(int ncid, int pe)
1252 {
1253  NC* ncp;
1254  int stat = NC_check_id(ncid, &ncp);
1255  if(stat != NC_NOERR) return stat;
1256  return ncp->dispatch->set_base_pe(ncid,pe);
1257 }
1258 
1277 int
1278 nc_inq_format(int ncid, int *formatp)
1279 {
1280  NC* ncp;
1281  int stat = NC_check_id(ncid, &ncp);
1282  if(stat != NC_NOERR) return stat;
1283  return ncp->dispatch->inq_format(ncid,formatp);
1284 }
1285 
1311 int
1312 nc_inq_format_extended(int ncid, int *formatp, int *modep)
1313 {
1314  NC* ncp;
1315  int stat = NC_check_id(ncid, &ncp);
1316  if(stat != NC_NOERR) return stat;
1317  return ncp->dispatch->inq_format_extended(ncid,formatp,modep);
1318 }
1319 
1364 int
1365 nc_inq(int ncid, int *ndimsp, int *nvarsp, int *nattsp, int *unlimdimidp)
1366 {
1367  NC* ncp;
1368  int stat = NC_check_id(ncid, &ncp);
1369  if(stat != NC_NOERR) return stat;
1370  return ncp->dispatch->inq(ncid,ndimsp,nvarsp,nattsp,unlimdimidp);
1371 }
1372 
1373 int
1374 nc_inq_nvars(int ncid, int *nvarsp)
1375 {
1376  NC* ncp;
1377  int stat = NC_check_id(ncid, &ncp);
1378  if(stat != NC_NOERR) return stat;
1379  return ncp->dispatch->inq(ncid, NULL, nvarsp, NULL, NULL);
1380 }
1381 
1447 int
1448 nc_inq_type(int ncid, nc_type xtype, char *name, size_t *size)
1449 {
1450  NC* ncp;
1451  /* For compatibility, we need to allow inq about
1452  atomic types, even if ncid is ill-defined */
1453  if(xtype <= ATOMICTYPEMAX) {
1454  if(xtype <= NC_NAT) return NC_EBADTYPE;
1455  if(name) strncpy(name,NC_atomictypename(xtype),NC_MAX_NAME);
1456  if(size) *size = NC_atomictypelen(xtype);
1457  return NC_NOERR;
1458  } else {
1459  int stat = NC_check_id(ncid, &ncp);
1460  if(stat != NC_NOERR) return NC_EBADTYPE; /* compatibility */
1461  return ncp->dispatch->inq_type(ncid,xtype,name,size);
1462  }
1463 }
1500 int
1501 NC_create(const char *path, int cmode, size_t initialsz,
1502  int basepe, size_t *chunksizehintp, int useparallel,
1503  void* mpi_info, int *ncidp)
1504 {
1505  int stat = NC_NOERR;
1506  NC* ncp = NULL;
1507  NC_Dispatch* dispatcher = NULL;
1508  /* Need three pieces of information for now */
1509  int model = 0; /* one of the NC_DISPATCH_XXX values */
1510  int isurl = 0; /* dap or cdmremote or neither */
1511  int xcmode = 0; /* for implied cmode flags */
1512 
1513  /* Initialize the dispatch table. The function pointers in the
1514  * dispatch table will depend on how netCDF was built
1515  * (with/without netCDF-4, DAP, CDMREMOTE). */
1516  if(!nc_initialized)
1517  {
1518  if ((stat = NC_initialize()))
1519  return stat;
1520  /* Do local initialization */
1521  nc_local_initialize();
1522  nc_initialized = 1;
1523  }
1524 
1525 #ifdef USE_REFCOUNT
1526  /* If this path is already open, then fail */
1527  ncp = find_in_NCList_by_name(path);
1528  if(ncp != NULL)
1529  return NC_ENFILE;
1530 #endif
1531 
1532  if((isurl = NC_testurl(path)))
1533  model = NC_urlmodel(path);
1534 
1535  /* Look to the incoming cmode for hints */
1536  if(model == 0) {
1537  if(cmode & NC_NETCDF4)
1538  model = NC_DISPATCH_NC4;
1539  else if(cmode & NC_PNETCDF)
1540  model = NC_DISPATCH_NC5;
1541  else if(cmode & NC_CLASSIC_MODEL)
1542  model = NC_DISPATCH_NC3;
1543  }
1544 
1545  if(model == 0) {
1546  /* Check default format */
1547  int format = nc_get_default_format();
1548  switch (format) {
1549 #ifdef USE_NETCDF4
1550  case NC_FORMAT_NETCDF4:
1551  xcmode |= NC_NETCDF4;
1552  model = NC_DISPATCH_NC4;
1553  break;
1555  xcmode |= NC_CLASSIC_MODEL;
1556  model = NC_DISPATCH_NC4;
1557  break;
1558 #endif
1559  case NC_FORMAT_64BIT:
1560  xcmode |= NC_64BIT_OFFSET;
1561  /* fall thru */
1562  case NC_FORMAT_CLASSIC:
1563  default:
1564  model = NC_DISPATCH_NC3;
1565  break;
1566  }
1567  }
1568 
1569  /* Add inferred flags */
1570  cmode |= xcmode;
1571 
1572 #ifdef USE_NETCDF4
1573  if((cmode & NC_MPIIO && cmode & NC_MPIPOSIX))
1574  return NC_EINVAL;
1575 #endif
1576 
1577  if (!(dispatcher = NC_get_dispatch_override()))
1578  {
1579 
1580  /* Figure out what dispatcher to use */
1581 #ifdef USE_NETCDF4
1582 #ifdef USE_CDMREMOTE
1583  if(model == (NC_DISPATCH_NC4 | NC_DISPATCH_NCR))
1584  dispatcher = NCCR_dispatch_table;
1585  else
1586 #endif
1587  if(model == (NC_DISPATCH_NC4))
1588  dispatcher = NC4_dispatch_table;
1589  else
1590 #endif /*USE_NETCDF4*/
1591 #ifdef USE_DAP
1592  if(model == (NC_DISPATCH_NC3 | NC_DISPATCH_NCD))
1593  dispatcher = NCD2_dispatch_table;
1594  else
1595 #endif
1596 #ifdef USE_PNETCDF
1597  if(model == (NC_DISPATCH_NC5))
1598  dispatcher = NC5_dispatch_table;
1599  else
1600 #endif
1601  if(model == (NC_DISPATCH_NC3))
1602  dispatcher = NC3_dispatch_table;
1603  else
1604  return NC_ENOTNC;
1605  }
1606 
1607  /* Create the NC* instance and insert its dispatcher */
1608  stat = new_NC(dispatcher,path,cmode,&ncp);
1609  if(stat) return stat;
1610 
1611  /* Add to list of known open files and define ext_ncid */
1612  add_to_NCList(ncp);
1613 
1614 #ifdef USE_REFCOUNT
1615  /* bump the refcount */
1616  ncp->refcount++;
1617 #endif
1618 
1619  /* Assume create will fill in remaining ncp fields */
1620  if ((stat = dispatcher->create(path, cmode, initialsz, basepe, chunksizehintp,
1621  useparallel, mpi_info, dispatcher, ncp))) {
1622  del_from_NCList(ncp); /* oh well */
1623  free_NC(ncp);
1624  } else {
1625  if(ncidp)*ncidp = ncp->ext_ncid;
1626  }
1627  return stat;
1628 }
1629 
1645 int
1646 NC_open(const char *path, int cmode,
1647  int basepe, size_t *chunksizehintp,
1648  int useparallel, void* mpi_info,
1649  int *ncidp)
1650 {
1651  int stat = NC_NOERR;
1652  NC* ncp = NULL;
1653  NC_Dispatch* dispatcher = NULL;
1654  /* Need two pieces of information for now */
1655  int model = 0;
1656  int isurl = 0;
1657  int version = 0;
1658  enum FileType filetype = FT_UNKNOWN;
1659 
1660  if(!nc_initialized) {
1661  stat = NC_initialize();
1662  if(stat) return stat;
1663  /* Do local initialization */
1664  nc_local_initialize();
1665  nc_initialized = 1;
1666  }
1667 
1668 #ifdef USE_REFCOUNT
1669  /* If this path is already open, then bump the refcount and return it */
1670  ncp = find_in_NCList_by_name(path);
1671  if(ncp != NULL) {
1672  ncp->refcount++;
1673  if(ncidp) *ncidp = ncp->ext_ncid;
1674  return NC_NOERR;
1675  }
1676 #endif
1677 
1678  isurl = NC_testurl(path);
1679  if(isurl)
1680  model = NC_urlmodel(path);
1681  else {
1682  filetype = FT_UNKNOWN;
1683  version = 0;
1684  model = 0;
1685  /* Look at the file if it exists */
1686  stat = NC_check_file_type(path,useparallel,mpi_info,
1687  &filetype,&version);
1688  if(stat == NC_NOERR) {
1689  switch (filetype) {
1690  case FT_NC:
1691  if(version == 1 || version == 2)
1692  model = NC_DISPATCH_NC3;
1693  break;
1694  case FT_HDF:
1695  model = NC_DISPATCH_NC4;
1696  break;
1697  case FT_PNETCDF:
1698  model = NC_DISPATCH_NC5;
1699  break;
1700  default:
1701  return NC_ENOTNC;
1702  }
1703  } else /* presumably not a netcdf file */
1704  return stat;
1705  }
1706 
1707  /* Look to the incoming cmode for hints */
1708  if(model == 0) {
1709  if(cmode & NC_PNETCDF) model |= NC_DISPATCH_NC5;
1710  else if(cmode & NC_NETCDF4) model |= NC_DISPATCH_NC4;
1711  }
1712 
1713  if(model == 0) model = NC_DISPATCH_NC3; /* final default */
1714 
1715  /* Force flag consistentcy */
1716  if(model & NC_DISPATCH_NC4)
1717  cmode |= NC_NETCDF4;
1718  else if(model & NC_DISPATCH_NC3) {
1719  cmode &= ~NC_NETCDF4; /* must be netcdf-3 */
1720  if(version == 2) cmode |= NC_64BIT_OFFSET;
1721  } else if(model & NC_DISPATCH_NC5) {
1722  cmode &= ~(NC_NETCDF4 | NC_64BIT_OFFSET); /* must be pnetcdf */
1723  cmode |= NC_PNETCDF;
1724  }
1725 
1726  if((cmode & NC_MPIIO && cmode & NC_MPIPOSIX))
1727  return NC_EINVAL;
1728 
1729  /* override overrides any other table choice */
1730  dispatcher = NC_get_dispatch_override();
1731  if(dispatcher != NULL) goto havetable;
1732 
1733  /* Figure out what dispatcher to use */
1734 #if defined(USE_CDMREMOTE)
1735  if(model == (NC_DISPATCH_NC4 | NC_DISPATCH_NCR))
1736  dispatcher = NCCR_dispatch_table;
1737  else
1738 #endif
1739 #if defined(USE_DAP)
1740  if(model == (NC_DISPATCH_NC3 | NC_DISPATCH_NCD))
1741  dispatcher = NCD2_dispatch_table;
1742  else
1743 #endif
1744 #if defined(USE_PNETCDF)
1745  if(model == (NC_DISPATCH_NC5))
1746  dispatcher = NC5_dispatch_table;
1747  else
1748 #endif
1749 #if defined(USE_NETCDF4)
1750  if(model == (NC_DISPATCH_NC4))
1751  dispatcher = NC4_dispatch_table;
1752  else
1753 #endif
1754  if(model == (NC_DISPATCH_NC3))
1755  dispatcher = NC3_dispatch_table;
1756  else
1757  return NC_ENOTNC;
1758 
1759 havetable:
1760 
1761  /* Create the NC* instance and insert its dispatcher */
1762  stat = new_NC(dispatcher,path,cmode,&ncp);
1763  if(stat) return stat;
1764 
1765  /* Add to list of known open files */
1766  add_to_NCList(ncp);
1767 
1768 #ifdef USE_REFCOUNT
1769  /* bump the refcount */
1770  ncp->refcount++;
1771 #endif
1772 
1773  /* Assume open will fill in remaining ncp fields */
1774  stat = dispatcher->open(path, cmode, basepe, chunksizehintp,
1775  useparallel, mpi_info, dispatcher, ncp);
1776  if(stat == NC_NOERR) {
1777  if(ncidp) *ncidp = ncp->ext_ncid;
1778  } else {
1779  del_from_NCList(ncp);
1780  free_NC(ncp);
1781  }
1782  return stat;
1783 }
1784 
1785 /*Provide an internal function for generating pseudo file descriptors
1786  for systems that are not file based (e.g. dap, memio).
1787 */
1788 
1789 /* Static counter for pseudo file descriptors (incremented) */
1790 static int pseudofd = 0;
1791 
1792 /* Create a pseudo file descriptor that does not
1793  overlap real file descriptors
1794 */
1795 int
1796 nc__pseudofd(void)
1797 {
1798  if(pseudofd == 0) {
1799  int maxfd = 32767; /* default */
1800 #ifdef HAVE_GETRLIMIT
1801  struct rlimit rl;
1802  if(getrlimit(RLIMIT_NOFILE,&rl) == 0) {
1803  if(rl.rlim_max != RLIM_INFINITY)
1804  maxfd = (int)rl.rlim_max;
1805  if(rl.rlim_cur != RLIM_INFINITY)
1806  maxfd = (int)rl.rlim_cur;
1807  }
1808  pseudofd = maxfd+1;
1809 #endif
1810  }
1811 
1812  return pseudofd++;
1813 }
1814 
1815 
#define NC_PNETCDF
Use parallel-netcdf library.
Definition: netcdf.h:156
int nc__open(const char *path, int mode, size_t *chunksizehintp, int *ncidp)
Open a netCDF file with extra performance parameters for the classic library.
Definition: dfile.c:645
#define NC_ENFILE
Too many netcdfs open.
Definition: netcdf.h:286
#define NC_CLASSIC_MODEL
Enforce classic model.
Definition: netcdf.h:135
#define NC_MAX_VAR_DIMS
max per variable dimensions
Definition: netcdf.h:232
int nc_redef(int ncid)
Put open netcdf dataset into define mode.
Definition: dfile.c:751
int nc__enddef(int ncid, size_t h_minfree, size_t v_align, size_t v_minfree, size_t r_align)
Leave define mode with performance tuning.
Definition: dfile.c:906
#define NC_MPIIO
Turn on MPI I/O.
Definition: netcdf.h:152
int nc_inq_format(int ncid, int *formatp)
Inquire about the binary format of a netCDF file as presented by the API.
Definition: dfile.c:1278
int nc_inq(int ncid, int *ndimsp, int *nvarsp, int *nattsp, int *unlimdimidp)
Inquire about a file or group.
Definition: dfile.c:1365
int nc_type
The nc_type type is just an int.
Definition: netcdf.h:27
#define NC_64BIT_OFFSET
Use large (64-bit) file offsets.
Definition: netcdf.h:136
int nc_inq_format_extended(int ncid, int *formatp, int *modep)
Obtain more detailed (vis-a-vis nc_inq_format) format information about an open dataset.
Definition: dfile.c:1312
#define NC_ENOTNC
Not a netcdf file.
Definition: netcdf.h:329
int nc_close(int ncid)
Close an open netCDF dataset.
Definition: dfile.c:1093
#define NC_FORMAT_64BIT
Format specifier for nc_set_default_format() and returned by nc_inq_format.
Definition: netcdf.h:166
#define NC_EBADTYPE
Not a netcdf data type.
Definition: netcdf.h:315
#define NC_SIZEHINT_DEFAULT
Let nc__create() or nc__open() figure out a suitable buffer size.
Definition: netcdf.h:198
#define NC_EINVAL
Invalid Argument.
Definition: netcdf.h:288
int nc_set_fill(int ncid, int fillmode, int *old_modep)
Change the fill-value mode to improve write performance.
Definition: dfile.c:1211
#define NC_MAX_NAME
Maximum for classic library.
Definition: netcdf.h:231
#define NC_NAT
Not A Type.
Definition: netcdf.h:36
int nc_inq_type(int ncid, nc_type xtype, char *name, size_t *size)
Inquire about a type.
Definition: dfile.c:1448
#define NC_EPARINIT
Error initializing for parallel access.
Definition: netcdf.h:400
#define NC_NETCDF4
Use netCDF-4/HDF5 format.
Definition: netcdf.h:148
int nc__create(const char *path, int cmode, size_t initialsz, size_t *chunksizehintp, int *ncidp)
Create a netCDF file with some extra parameters controlling classic file cacheing.
Definition: dfile.c:450
#define NC_FORMAT_NETCDF4_CLASSIC
Format specifier for nc_set_default_format() and returned by nc_inq_format.
Definition: netcdf.h:168
#define NC_FORMAT_NETCDF4
Format specifier for nc_set_default_format() and returned by nc_inq_format.
Definition: netcdf.h:167
int nc_inq_path(int ncid, size_t *pathlen, char *path)
Get the file pathname (or the opendap URL) which was used to open/create the ncid's file...
Definition: dfile.c:686
#define NC_NOERR
No Error.
Definition: netcdf.h:278
int nc_open(const char *path, int mode, int *ncidp)
Open an existing netCDF file.
Definition: dfile.c:588
int nc_enddef(int ncid)
Leave define mode.
Definition: dfile.c:815
#define NC_FORMAT_CLASSIC
Format specifier for nc_set_default_format() and returned by nc_inq_format.
Definition: netcdf.h:165
int nc_sync(int ncid)
Synchronize an open netcdf dataset to disk.
Definition: dfile.c:983
int nc_create(const char *path, int cmode, int *ncidp)
Create a new netCDF file.
Definition: dfile.c:383
#define NC_MPIPOSIX
Turn on MPI POSIX I/O.
Definition: netcdf.h:155

Return to the Main Unidata NetCDF page.
Generated on Sun Nov 23 2014 16:17:49 for NetCDF. NetCDF is a Unidata library.