Go to file
Dennis Heimbigner 0b7a5382e7 Codify cross-platform file paths
The netcdf-c code has to deal with a variety of platforms:
Windows, OSX, Linux, Cygwin, MSYS, etc.  These platforms differ
significantly in the kind of file paths that they accept.  So in
order to handle this, I have created a set of replacements for
the most common file system operations such as _open_ or _fopen_
or _access_ to manage the file path differences correctly.

A more limited version of this idea was already implemented via
the ncwinpath.h and dwinpath.c code. So this can be viewed as a
replacement for that code. And in path in many cases, the only
change that was required was to replace '#include <ncwinpath.h>'
with '#include <ncpathmgt.h>' and then replace file operation
calls with the NCxxx equivalent from ncpathmgr.h Note that
recently, the ncwinpath.h was renamed ncpathmgmt.h, so this pull
request should not require dealing with winpath.

The heart of the change is include/ncpathmgmt.h, which provides
alternate operations such as NCfopen or NCaccess and which properly
parse and rebuild path arguments to work for the platform on which
the code is executing. This mostly matters for Windows because of the
way that it uses backslash and drive letters, as compared to *nix*.
One important feature is that the user can do string manipulations
on a file path without having to worry too much about the platform
because the path management code will properly handle most mixed cases.
So one can for example concatenate a path suffix that uses forward
slashes to a Windows path and have it work correctly.

The conversion code is in libdispatch/dpathmgr.c, and the
important function there is NCpathcvt which does the proper
conversions to the local path format.

As a rule, most code should just replace their file operations with
the corresponding NCxxx ones defined in include/ncpathmgmt.h. These
NCxxx functions all call NCpathcvt on their path arguments before
executing the actual file operation.

In some rare cases, the client may need to directly use NCpathcvt,
but this should be avoided as much as possible. If there is a need
for supporting a new file operation not already in ncpathmgmt.h, then
use the code in dpathmgr.c as a template. Also please notify Unidata
so we can include it as a formal part or our supported operations.
Also, if you see an operation in the library that is not using the
NCxxx form, then please submit an issue so we can fix it.

Misc. Changes:
* Clean up the utf8 testing code; it is impossible to get some
  tests to work under windows using shell scripts; the args do
  not pass as utf8 but as some other encoding.
* Added an extra utf8 test case: test_unicode_path.sh
* Add a true test for HDF5 1.10.6 or later because as noted in
  PR https://github.com/Unidata/netcdf-c/pull/1794,
  HDF5 changed its Windows file path handling.
2021-03-04 13:41:31 -07:00
.github Enable nczarr testing in github actions. 2021-01-27 11:30:48 -07:00
cmake Add zip file support 2021-01-28 20:11:01 -07:00
conda.recipe
ctest_scripts
dap4_test Add zip file support 2021-01-28 20:11:01 -07:00
debug Codify cross-platform file paths 2021-03-04 13:41:31 -07:00
docs Update d4ts.war and dts.war build instructions 2021-02-26 15:14:57 -07:00
examples Mostly revert the filter code to reduce its complexity of use. 2020-09-27 12:43:46 -06:00
h5_test fixed H5O_info_t incompatiblity with H5Oget_info_by_idx3 2021-01-07 14:30:05 -06:00
hdf4_test
include Codify cross-platform file paths 2021-03-04 13:41:31 -07:00
libdap2 Merge branch 'master' into unmismatch.dmh 2021-01-07 18:30:57 -07:00
libdap4 Improve operation of the DAP4 code and fix bugs 2021-01-14 21:39:08 -07:00
libdispatch Codify cross-platform file paths 2021-03-04 13:41:31 -07:00
libhdf4 Provide a Number of fixes/improvements to NCZarr 2020-11-19 17:01:04 -07:00
libhdf5 Codify cross-platform file paths 2021-03-04 13:41:31 -07:00
liblib Add zip file support 2021-01-28 20:11:01 -07:00
libnczarr Codify cross-platform file paths 2021-03-04 13:41:31 -07:00
libsrc Codify cross-platform file paths 2021-03-04 13:41:31 -07:00
libsrc4 Ensure MPI header found without wrapper 2021-01-19 09:38:07 -07:00
libsrcp Mostly revert the filter code to reduce its complexity of use. 2020-09-27 12:43:46 -06:00
nc_perf Additional Fixes to NCZarr 2020-12-16 20:48:02 -07:00
nc_test Codify cross-platform file paths 2021-03-04 13:41:31 -07:00
nc_test4 Add tests for filter order on read and write cases 2020-12-29 20:12:35 -07:00
ncdap_test fix test cases 2021-01-07 19:37:03 -07:00
ncdump Codify cross-platform file paths 2021-03-04 13:41:31 -07:00
ncgen Codify cross-platform file paths 2021-03-04 13:41:31 -07:00
ncgen3 Codify cross-platform file paths 2021-03-04 13:41:31 -07:00
nctest
nczarr_test Codify cross-platform file paths 2021-03-04 13:41:31 -07:00
NUG Removed NUG files, added a README.md file directing people to the correct location. 2020-10-06 11:13:56 -06:00
oc2 Provide a Number of fixes/improvements to NCZarr 2020-11-19 17:01:04 -07:00
plugins More NCZarr optimizations 2021-01-06 13:35:59 -07:00
unit_test Codify cross-platform file paths 2021-03-04 13:41:31 -07:00
.gitignore
acinclude.m4
appveyor.yml unblock dmh appveyor 2020-12-02 18:17:07 -07:00
bootstrap
cmake_uninstall.cmake.in
CMakeInstallation.cmake
CMakeLists.txt Codify cross-platform file paths 2021-03-04 13:41:31 -07:00
COMPILE.cmake.txt
config.h.cmake.in Add zip file support 2021-01-28 20:11:01 -07:00
config.h.cmake.in.old-works
configure.ac Codify cross-platform file paths 2021-03-04 13:41:31 -07:00
COPYRIGHT
CTestConfig.cmake.in
CTestCustom.cmake
dods.m4
FixBundle.cmake.in
INSTALL.md
lib_flags.am Codify cross-platform file paths 2021-03-04 13:41:31 -07:00
libnetcdf.settings.in Mostly revert the filter code to reduce its complexity of use. 2020-09-27 12:43:46 -06:00
Makefile.am Revert "Revert "Fix nczarr-experimental: improve build support, disengage hdf5 vs netcdf4 flags, and find AWS libraries"" 2020-08-17 19:15:47 -06:00
mclean
nc-config.cmake.in Improve the building of NCZARR S3 support in CMake and Autoconf 2020-10-16 15:04:51 -06:00
nc-config.in Improve the building of NCZARR S3 support in CMake and Autoconf 2020-10-16 15:04:51 -06:00
netcdf.pc.in
netCDFConfig.cmake.in
PostInstall.cmake
postinstall.sh.in Fix typo postinstall. 2020-08-06 15:27:20 -04:00
README.md Update links to netCDF-java documentation. 2021-02-26 15:11:10 -07:00
RELEASE_NOTES.md Merge branch 'master' into deflate.dmh 2021-02-08 11:10:06 -06:00
test_common.in Codify cross-platform file paths 2021-03-04 13:41:31 -07:00
test_prog.c
test-driver-verbose
travis.yml Additional Fixes to NCZarr 2020-12-16 20:48:02 -07:00
wjna

Unidata NetCDF

Build Status Coverity Scan Build Status

About

The Unidata network Common Data Form (netCDF) is an interface for scientific data access and a freely-distributed software library that provides an implementation of the interface. The netCDF library also defines a machine-independent format for representing scientific data. Together, the interface, library, and format support the creation, access, and sharing of scientific data. The current netCDF software provides C interfaces for applications and data. Separate software distributions available from Unidata provide Java, Fortran, Python, and C++ interfaces. They have been tested on various common platforms.

Properties

NetCDF files are self-describing, network-transparent, directly accessible, and extendible. Self-describing means that a netCDF file includes information about the data it contains. Network-transparent means that a netCDF file is represented in a form that can be accessed by computers with different ways of storing integers, characters, and floating-point numbers. Direct-access means that a small subset of a large dataset may be accessed efficiently, without first reading through all the preceding data. Extendible means that data can be appended to a netCDF dataset without copying it or redefining its structure.

Use

NetCDF is useful for supporting access to diverse kinds of scientific data in heterogeneous networking environments and for writing application software that does not depend on application-specific formats. For information about a variety of analysis and display packages that have been developed to analyze and display data in netCDF form, see

More information

For more information about netCDF, see

Latest releases

You can obtain a copy of the latest released version of netCDF software for various languages:

Copyright and licensing information can be found here, as well as in the COPYRIGHT file accompanying the software

Installation

To install the netCDF-C software, please see the file INSTALL in the netCDF-C distribution, or the (usually more up-to-date) document:

Documentation

A language-independent User's Guide for netCDF, and some other language-specific user-level documents are available from:

A mailing list, netcdfgroup@unidata.ucar.edu, exists for discussion of the netCDF interface and announcements about netCDF bugs, fixes, and enhancements. For information about how to subscribe, see the URL

Feedback

We appreciate feedback from users of this package. Please send comments, suggestions, and bug reports to support-netcdf@unidata.ucar.edu.