Skip to content

Commit a0b7971

Browse files
Update to main
2 parents ef28dda + 3e7f11c commit a0b7971

27 files changed

Lines changed: 904 additions & 248 deletions

.github/workflows/run_tests_win_cygwin.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,16 @@ jobs:
3838
platform: x86_64
3939
install-dir: 'C:\cygwin'
4040
packages: >-
41-
git automake libtool autoconf2.5 make libhdf5-devel
41+
git automake libtool autoconf2.5 make
4242
libhdf4-devel zipinfo libxml2-devel perl zlib-devel
4343
libzstd-devel libbz2-devel libaec-devel libzip-devel
4444
libdeflate-devel gcc-core gcc-g++ libcurl-devel libiconv-devel
45-
libssl-devel libcrypt-devel attr libattr-devel unzip zip
45+
libssl-devel libcrypt-devel attr libattr-devel unzip zip dash
46+
47+
- name: Install HDF5 1.14.6-1
48+
shell: pwsh
49+
run: |
50+
C:\setup.exe -q -P libhdf5-devel=1.14.6-1
4651
4752
- name: (Autotools) Run autoconf and friends
4853
run: |
@@ -130,16 +135,22 @@ jobs:
130135
shell: pwsh
131136
- uses: actions/checkout@v4
132137
- uses: cygwin/cygwin-install-action@v4
138+
id: install-cygwin
133139
with:
134140
platform: x86_64
135141
install-dir: 'C:\cygwin'
136142
packages: >-
137-
git automake libtool autoconf2.5 make libhdf5-devel
143+
git automake libtool autoconf2.5 make
138144
libhdf4-devel zipinfo libxml2-devel perl zlib-devel
139145
libzstd-devel libbz2-devel libaec-devel libzip-devel
140146
libdeflate-devel gcc-core gcc-g++ libcurl-devel libiconv-devel
141147
libssl-devel libcrypt-devel cmake ninja make m4 diffutils zip unzip
142148
149+
- name: Install HDF5 1.14.6-1
150+
shell: pwsh
151+
run: |
152+
C:\setup.exe -q -P libhdf5-devel=1.14.6-1
153+
143154
###
144155
# Configure and build
145156
###

.github/workflows/run_tests_win_mingw.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,21 @@ jobs:
3535
with:
3636
msystem: ${{ matrix.msystem }}
3737
update: true
38-
pacboy: cc:p autotools:p hdf5:p curl:p libxml2:p zlib:p blosc:p bzip2:p
38+
pacboy: cc:p autotools:p curl:p libxml2:p zlib:p blosc:p bzip2:p
3939
install: diffutils m4 git unzip
4040

4141
###
42+
# Downgrade hdf5
43+
###
44+
45+
- name: Downgrade hdf5
46+
run: |
47+
if [ "${{ matrix.msystem }}" == "MINGW64" ]; then
48+
pacman -U https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-hdf5-1.14.6-1-any.pkg.tar.zst --noconfirm
49+
else
50+
pacman -U https://repo.msys2.org/mingw/ucrt64/mingw-w64-ucrt-x86_64-hdf5-1.14.6-1-any.pkg.tar.zst --noconfirm
51+
fi
52+
###
4253
# Configure and build
4354
###
4455

@@ -95,10 +106,21 @@ jobs:
95106
with:
96107
msystem: ${{ matrix.msystem }}
97108
update: true
98-
pacboy: cc:p cmake:p hdf5:p curl:p libxml2:p zlib:p blosc:p bzip2:p
109+
pacboy: cc:p cmake:p curl:p libxml2:p zlib:p blosc:p bzip2:p
99110
install: make m4 diffutils git unzip
100111

101112
###
113+
# Downgrade hdf5
114+
###
115+
116+
- name: Downgrade hdf5
117+
run: |
118+
if [ "${{ matrix.msystem }}" == "MINGW64" ]; then
119+
pacman -U https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-hdf5-1.14.6-1-any.pkg.tar.zst --noconfirm
120+
else
121+
pacman -U https://repo.msys2.org/mingw/ucrt64/mingw-w64-ucrt-x86_64-hdf5-1.14.6-1-any.pkg.tar.zst --noconfirm
122+
fi
123+
###
102124
# Configure and build
103125
###
104126

RELEASE_NOTES.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ This file contains a high-level description of this package's evolution. Release
1010
* Add authentication support for session tokens for HDF5 ROS3
1111
driver. WARNING: this PR compiles and builds but the basic token
1212
functionality has not been tested because we have no access to a
13-
server that requires session tokens. See [Github
14-
????](https://github.com/Unidata/netcdf-c/issues/????) for more
15-
information.
16-
* Regularize, cleanup, and refactor various AWS features, especially regularizing AWS-related constants. See [Github ????](https://github.com/Unidata/netcdf-c/issues/????) for more information.
13+
server that requires session tokens. See [Github????](https://github.com/Unidata/netcdf-c/issues/????) for more information.
14+
* Regularize, cleanup, and refactor various AWS features, especially regularizing AWS-related constants. See [Github 3229](https://github.com/Unidata/netcdf-c/issues/3229) for more information.
15+
* Introduce consolidated metadata [Github #3225](https://github.com/Unidata/netcdf-c/pull/3225) via `mode=consolidated` or `NCZARR_CONSOLIDATED`
16+
* Fix the H5FD_class_t problems. See [Github 3202](https://github.com/Unidata/netcdf-c/issues/3202) for more information.
1717
* Begin the consolidation of global state into two files: libdispatch/dglobal.c and include/ncglobal.h. See [Github 3197](https://github.com/Unidata/netcdf-c/issues/3197) for more information.
1818
* Modify the way xarray attribute sets are handled. See [Github 3218](https://github.com/Unidata/netcdf-c/issues/3218) for more information.
1919
* Fix Issue with Numcodecs encoding problems where integer filter parameters are being encoded as strings. See [Github 3201](https://github.com/Unidata/netcdf-c/issues/3201) for more information.

docs/nczarr.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,12 @@ The fragment part of a URL is used to specify information that is interpreted to
119119
For reading, _key=value_ pairs are provided for specifying the storage format.
120120
- mode=nczarr|zarr
121121

122-
Additional pairs are provided to specify the Zarr version.
123-
- mode=v2<!--|v3-->
122+
Additional pairs are provided to specify
123+
- Zarr version `mode=v2`<!--|v3-->
124124

125-
Additional pairs are provided to specify the storage medium: Amazon S3 vs File tree vs Zip file.
126-
- mode=file|zip|s3
125+
- Storage medium: S3, File or Zip `mode=file|zip|s3`
126+
127+
- Additional options like consolidate(d) metadata `mode=consolidated`
127128

128129
Note that when reading, an attempt will be made to infer the
129130
format and Zarr version and storage medium format by probing the
@@ -165,6 +166,12 @@ are also in the root group will have an attribute called
165166
*\_ARRAY\_DIMENSIONS* that stores those dimension names.
166167
The _noxarray_ mode tells the library to disable the XArray support.
167168

169+
### Consolidated Metadata
170+
171+
In the zarr specification, there is no mention to consolidated metadata. However the python implementation introduced 2 functions, `open_consolidated` and `consolidate` that given a dataset, read/write all the metadata from/to a single object (`/.zmetadata` for zarr 2). This was introduced mainly to improve the performance when accessing data remotely.
172+
173+
The current NetCDF's zarr implementation supports consolidated operations via url fragments containing `mode=zarr,consolidated` or via environment variable `NCZARR_CONSOLIDATED`
174+
168175
# NCZarr Map Implementation {#nczarr_mapimpl}
169176

170177
Internally, the nczarr implementation has a map abstraction that allows different storage formats to be used.
@@ -866,6 +873,9 @@ intended to be a detailed chronology. Rather, it provides highlights
866873
that will be of interest to NCZarr users. In order to see exact changes,
867874
It is necessary to use the 'git diff' command.
868875
876+
## 15/12/2025
877+
1. Include consolidated metadata.
878+
869879
## 03/31/2024
870880
1. Document the change to V2 to using attributes to hold NCZarr metadata.
871881

include/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ file(READ ncjson.h JSONH0)
6565
STRING(REPLACE "NCJSON_H" "NETCDF_JSON_H" JSONH1 "${JSONH0}")
6666
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/netcdf_json.h "${JSONH1}")
6767
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/netcdf_json.h "#ifdef NETCDF_JSON_H\n")
68-
file(READ ${CMAKE_SOURCE_DIR}/libdispatch/ncjson.c JSONC0)
68+
file(READ ${netCDF_SOURCE_DIR}/libdispatch/ncjson.c JSONC0)
6969
STRING(REGEX REPLACE "#include[ ]+\"ncjson.h\"" "" JSONC1 "${JSONC0}")
7070
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/netcdf_json.h "${JSONC1}")
7171
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/netcdf_json.h "#endif /*NETCDF_JSON_H*/\n")
@@ -75,7 +75,7 @@ file(READ ncproplist.h PLISTH0)
7575
STRING(REPLACE "NCPROPLIST_H" "NETCDF_PROPLIST_H" PLISTH1 "${PLISTH0}")
7676
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/netcdf_proplist.h "${PLISTH1}")
7777
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/netcdf_proplist.h "#ifdef NETCDF_PROPLIST_H\n")
78-
file(READ ${CMAKE_SOURCE_DIR}/libdispatch/ncproplist.c PLISTC0)
78+
file(READ ${netCDF_SOURCE_DIR}/libdispatch/ncproplist.c PLISTC0)
7979
STRING(REGEX REPLACE "#include[ ]+\"ncproplist.h\"" "" PLISTC1 "${PLISTC0}")
8080
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/netcdf_proplist.h "${PLISTC1}")
8181
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/netcdf_proplist.h "#endif /*NETCDF_PROPLIST_H*/\n")

include/ncconfigure.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ char* strdup(const char*);
6767
#endif
6868
#endif
6969

70+
#ifndef __cplusplus
71+
# ifndef HAVE_STRNDUP
72+
# ifndef strndup
73+
char *strndup(const char *s, size_t len);
74+
# endif
75+
# endif
76+
#endif
77+
7078
#ifndef HAVE_STRLCAT
7179
#ifndef strlcat
7280
#define strlcat nc_strlcat

include/ncuri.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ typedef struct NCURI {
5959
extern "C" {
6060
#endif
6161

62+
6263
EXTERNL int ncuriparse(const char* s, NCURI** ncuri);
6364
EXTERNL void ncurifree(NCURI* ncuri);
6465

include/netcdf.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,8 +531,10 @@ by the desired type. */
531531
#define NC_EOBJECT (-140) /**< Some object exists when it should not */
532532
#define NC_ENOOBJECT (-141) /**< Some object not found */
533533
#define NC_EPLUGIN (-142) /**< Unclassified failure in accessing a dynamically loaded plugin> */
534+
#define NC_ENOTZARR (-143) /**< Malformed (NC)Zarr file */
535+
#define NC_EZARRMETA (-144) /**< Invalid (NC)Zarr file consolidated metadata */
534536

535-
#define NC4_LAST_ERROR (-142) /**< @internal All netCDF errors > this. */
537+
#define NC4_LAST_ERROR (-144) /**< @internal All netCDF errors > this. */
536538

537539
/*
538540
* Don't forget to update docs/all-error-codes.md if adding new error codes here!
@@ -964,7 +966,7 @@ nc_inq_var_endian(int ncid, int varid, int *endianp);
964966

965967
/* Define a filter for a variable */
966968
EXTERNL int
967-
nc_def_var_filter(int ncid, int varid, unsigned int id, size_t nparams, const unsigned int* params);
969+
nc_def_var_filter(int ncid, int varid, unsigned int id, size_t nparams, const unsigned int* parms);
968970

969971
/* Learn about the first filter on a variable */
970972
EXTERNL int

libdispatch/dmissing.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,20 @@ strdup(const char* s)
4343
}
4444
#endif
4545

46+
#ifndef HAVE_STRNDUP
47+
char*
48+
strndup(const char* s, size_t len)
49+
{
50+
char* dup;
51+
if(s == NULL) return NULL;
52+
dup = (char*)malloc(len+1);
53+
if(dup == NULL) return NULL;
54+
memcpy((void*)dup,s,len);
55+
dup[len] = '\0';
56+
return dup;
57+
}
58+
#endif
59+
4660
#if !defined(_MSC_VER) && !defined(WIN32)
4761

4862
#ifndef HAVE_STRLCAT

libdispatch/ncuri.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -78,21 +78,6 @@ static const char* queryallow =
7878
static const char* userpwdallow =
7979
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!$&'()*+,-.;=_~?#/";
8080

81-
#ifndef HAVE_STRNDUP
82-
#define strndup ncstrndup
83-
/* Not all systems have strndup, so provide one*/
84-
char*
85-
ncstrndup(const char* s, size_t len)
86-
{
87-
char* dup;
88-
if(s == NULL) return NULL;
89-
dup = (char*)malloc(len+1);
90-
if(dup == NULL) return NULL;
91-
memcpy((void*)dup,s,len);
92-
dup[len] = '\0';
93-
return dup;
94-
}
95-
#endif
9681
/* Forward */
9782
static int collectprefixparams(char* text, char** nextp);
9883
static void freestringlist(NClist* list);

0 commit comments

Comments
 (0)