Hi Gurus,
I invoke nc_open() with a file:// schema to determine whether a given
directory contains a valid NCZarr store.
It appears that nc_open(ncz_fl,NC_NOWRITE,&id) always succeeds if ncz_fl
is a valid path that already exists, regardless of whether
the existing path leads to an NCZarr store, a non-netCDF file, an empty directory, or a
directory full of non-NCZarr stuff. I am using netCDF 4.9.2, current
development snapshot on MacOS.
For example, the nc_open(ncz_fl,NC_NOWRITE,&id) returns NC_NOERR if
ncz_fl == file:///Users/zender/ncz_dnd/foo#mode=nczarr,file
and the directory (or file) /Users/zender/ncz_dnd/foo exists. Full stop.
nc_open(ncz_fl) succeeds when 1. foo contains an NCZarr store (yay!),
2. when foo exists but is a completely empty directory (boo!),
and 3. when foo is a directory filled with completely non-NCZarr contents (boo!),
and 4. when foo is any file (including non-netCDF files).
In the latter three cases I expect nc_open() to fail with an error such as
#define NC_ENOTNC (-51) /**< Not a netcdf file */
or
#define NC_ENOOBJECT (-141) /**< Some object not found */
Is this the observed behavior of nc_open() intentional? If so, why?
I thought nc_open() would return NC_NOERR only for existing netCDF files,
as implied by the nc_open() documentation.
Or am I missing something NCZarr-y?
Many thanks,
Charlie
Hi Gurus,
I invoke nc_open() with a file:// schema to determine whether a given
directory contains a valid NCZarr store.
It appears that
nc_open(ncz_fl,NC_NOWRITE,&id)always succeeds ifncz_flis a valid path that already exists, regardless of whether
the existing path leads to an NCZarr store, a non-netCDF file, an empty directory, or a
directory full of non-NCZarr stuff. I am using netCDF 4.9.2, current
development snapshot on MacOS.
For example, the
nc_open(ncz_fl,NC_NOWRITE,&id)returnsNC_NOERRifncz_fl == file:///Users/zender/ncz_dnd/foo#mode=nczarr,fileand the directory (or file)
/Users/zender/ncz_dnd/fooexists. Full stop.nc_open(ncz_fl)succeeds when 1.foocontains an NCZarr store (yay!),2. when
fooexists but is a completely empty directory (boo!),and 3. when
foois a directory filled with completely non-NCZarr contents (boo!),and 4. when
foois any file (including non-netCDF files).In the latter three cases I expect
nc_open()to fail with an error such as#define NC_ENOTNC (-51) /**< Not a netcdf file */
or
#define NC_ENOOBJECT (-141) /**< Some object not found */
Is this the observed behavior of
nc_open()intentional? If so, why?I thought
nc_open()would returnNC_NOERRonly for existing netCDF files,as implied by the
nc_open()documentation.Or am I missing something NCZarr-y?
Many thanks,
Charlie