mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-12-27 08:49:16 +08:00
11fe00ea05
Filter support has three goals: 1. Use the existing HDF5 filter implementations, 2. Allow filter metadata to be stored in the NumCodecs metadata format used by Zarr, 3. Allow filters to be used even when HDF5 is disabled Detailed usage directions are define in docs/filters.md. For now, the existing filter API is left in place. So filters are defined using ''nc_def_var_filter'' using the HDF5 style where the id and parameters are unsigned integers. This is a big change since filters affect many parts of the code. In the following, the terms "compressor" and "filter" and "codec" are generally used synonomously. ### Filter-Related Changes: * In order to support dynamic loading of shared filter libraries, a new library was added in the libncpoco directory; it helps to isolate dynamic loading across multiple platforms. * Provide a json parsing library for use by plugins; this is created by merging libdispatch/ncjson.c with include/ncjson.h. * Add a new _Codecs attribute to allow clients to see what codecs are being used; let ncdump -s print it out. * Provide special headers to help support compilation of HDF5 filters when HDF5 is not enabled: netcdf_filter_hdf5_build.h and netcdf_filter_build.h. * Add a number of new test to test the new nczarr filters. * Let ncgen parse _Codecs attribute, although it is ignored. ### Plugin directory changes: * Add support for the Blosc compressor; this is essential because it is the most common compressor used in Zarr datasets. This also necessitated adding a CMake FindBlosc.cmake file * Add NCZarr support for the big-four filters provided by HDF5: shuffle, fletcher32, deflate (zlib), and szip * Add a Codec defaulter (see docs/filters.md) for the big four filters. * Make plugins work with windows by properly adding __declspec declaration. ### Misc. Non-Filter Changes * Replace most uses of USE_NETCDF4 (deprecated) with USE_HDF5. * Improve support for caching * More fixes for path conversion code * Fix misc. memory leaks * Add new utility -- ncdump/ncpathcvt -- that does more or less the same thing as cygpath. * Add a number of new test to test the non-filter fixes. * Update the parsers * Convert most instances of '#ifdef _MSC_VER' to '#ifdef _WIN32'
82 lines
3.8 KiB
C
82 lines
3.8 KiB
C
/*********************************************************************
|
|
* Copyright 2018, UCAR/Unidata
|
|
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
|
|
*********************************************************************/
|
|
|
|
/**
|
|
* Provide the zarr specific code to implement the netcdf-4 code.
|
|
*
|
|
* @author Dennis Heimbigner
|
|
*/
|
|
|
|
#ifndef ZARR_H
|
|
#define ZARR_H
|
|
|
|
struct ChunkKey;
|
|
|
|
/* zarr.c */
|
|
extern int ncz_create_dataset(NC_FILE_INFO_T*, NC_GRP_INFO_T*, const char** controls);
|
|
extern int ncz_open_dataset(NC_FILE_INFO_T*, const char** controls);
|
|
extern int ncz_del_attr(NC_FILE_INFO_T* file, NC_OBJ* container, const char* name);
|
|
|
|
/* HDF5 Mimics */
|
|
extern int NCZ_isnetcdf4(struct NC_FILE_INFO*);
|
|
extern int NCZ_get_libversion(unsigned long* majorp, unsigned long* minorp,unsigned long* releasep);
|
|
extern int NCZ_get_superblock(NC_FILE_INFO_T* file, int* superblockp);
|
|
|
|
extern int ncz_unload_jatts(NCZ_FILE_INFO_T*, NC_OBJ* container, NCjson* jattrs, NCjson* jtypes);
|
|
|
|
/* zclose.c */
|
|
extern int ncz_close_file(NC_FILE_INFO_T* file, int abort);
|
|
|
|
/* zcvt.c */
|
|
extern int NCZ_convert1(NCjson* jsrc, nc_type, unsigned char* memory0);
|
|
extern int NCZ_stringconvert1(nc_type typid, size_t len, char* src, NCjson* jvalue);
|
|
extern int NCZ_stringconvert(nc_type typid, size_t len, void* data0, NCjson** jdatap);
|
|
|
|
/* zsync.c */
|
|
extern int ncz_sync_file(NC_FILE_INFO_T* file, int isclose);
|
|
extern int ncz_sync_grp(NC_FILE_INFO_T* file, NC_GRP_INFO_T* grp, int isclose);
|
|
extern int ncz_sync_atts(NC_FILE_INFO_T*, NC_OBJ* container, NCindex* attlist, int isclose);
|
|
extern int ncz_read_grp(NC_FILE_INFO_T* file, NC_GRP_INFO_T* grp);
|
|
extern int ncz_read_atts(NC_FILE_INFO_T* file, NC_OBJ* container);
|
|
extern int ncz_read_vars(NC_FILE_INFO_T* file, NC_GRP_INFO_T* grp);
|
|
extern int ncz_read_file(NC_FILE_INFO_T* file);
|
|
extern int ncz_write_var(NC_VAR_INFO_T* var);
|
|
extern int ncz_read_superblock(NC_FILE_INFO_T* zinfo, char** nczarrvp, char** zarrfp);
|
|
|
|
/* zutil.c */
|
|
extern int NCZ_grpkey(const NC_GRP_INFO_T* grp, char** pathp);
|
|
extern int NCZ_varkey(const NC_VAR_INFO_T* var, char** pathp);
|
|
extern int NCZ_dimkey(const NC_DIM_INFO_T* dim, char** pathp);
|
|
extern int ncz_splitkey(const char* path, NClist* segments);
|
|
extern int NCZ_readdict(NCZMAP* zmap, const char* key, NCjson** jsonp);
|
|
extern int NCZ_readarray(NCZMAP* zmap, const char* key, NCjson** jsonp);
|
|
extern int ncz_zarr_type_name(nc_type nctype, int little, const char** znamep);
|
|
extern int ncz_nctype2typeinfo(const char* snctype, nc_type* nctypep);
|
|
extern int ncz_dtype2typeinfo(const char* dtype, nc_type* nctypep, int* endianness);
|
|
extern int ncz_fill_value_sort(nc_type nctype, int*);
|
|
extern int NCZ_createobject(NCZMAP* zmap, const char* key, size64_t size);
|
|
extern int NCZ_uploadjson(NCZMAP* zmap, const char* key, NCjson* json);
|
|
extern int NCZ_downloadjson(NCZMAP* zmap, const char* key, NCjson** jsonp);
|
|
extern int NCZ_isLittleEndian(void);
|
|
extern int NCZ_subobjects(NCZMAP* map, const char* prefix, const char* tag, char dimsep, NClist* objlist);
|
|
extern int NCZ_grpname_full(int gid, char** pathp);
|
|
extern int ncz_get_var_meta(NC_FILE_INFO_T* file, NC_VAR_INFO_T* var);
|
|
extern int NCZ_comma_parse(const char* s, NClist* list);
|
|
extern int NCZ_swapatomicdata(size_t datalen, void* data, int typesize);
|
|
extern char** NCZ_clonestringvec(size_t len, const char** vec);
|
|
extern void NCZ_freestringvec(size_t len, char** vec);
|
|
extern int NCZ_create_fill_chunk(size64_t chunksize, size_t typesize, const void* fill, void** fillchunkp);
|
|
extern int NCZ_s3clear(ZS3INFO* s3);
|
|
extern int NCZ_ischunkname(const char* name,char dimsep);
|
|
extern char* NCZ_chunkpath(struct ChunkKey key);
|
|
|
|
/* Export */
|
|
EXTERNL int NCZ_s3urlprocess(NCURI* url, ZS3INFO* s3);
|
|
|
|
/* zwalk.c */
|
|
EXTERNL int NCZ_read_chunk(int ncid, int varid, size64_t* zindices, void* chunkdata);
|
|
|
|
#endif /*ZARR_H*/
|