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

Return to the Main Unidata NetCDF page.
Generated on Mon Jul 13 2015 07:53:10 for NetCDF. NetCDF is a Unidata library.