mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-12-27 08:49:16 +08:00
74b40fd788
Re: https://github.com/zarr-developers/zarr-python/pull/716 The Zarr version 2 spec has been extended to include the ability to choose the dimension separator in chunk name keys. The legal separators has been extended from {'.'} to {'.' '/'}. So now it is possible to use a key like "0/1/2/0" for chunk names. This PR implements this for NCZarr. The V2 spec now says that this separator can be set on a per-variable basis. For now, I have chosen to allow this be set only globally by adding a key named "ZARR.DIMENSION_SEPARATOR=<char>" in the .daprc/.dodsrc/ncrc file. Currently, the only legal separator characters are '.' (the default) and '/'. On writing, this key will only be written if its value is different than the default. This change caused problems because supporting a separator of '/' is difficult to parse when keys/paths use '/' as the path separator. A test case was added for this. Additionally, make nczarr be enabled default by default. This required some additional changes so that if zip and/or AWS S3 sdk are unavailable, then they are disabled for NCZarr. In addition the following unrelated changes were made. 1. Tested that pure-zarr mode could read an nczarr formatted store. 1. The .rc file handling now merges all known .rc files (.ncrc,.daprc, and .dodsrc) in that order and using those in HOME first, then in current directory. For duplicate entries, the later ones override the earlier ones. This change is to remove some of the conflicts inherent in the current .rc file load process. A set of test cases was also added. 1. Re-order tests in configure.ac and CMakeLists.txt so that if libcurl is not found then the other options that depend upon it properly are disabled. 1. I decided that xarray support should be enabled by default for pure zarr. In order to allow disabling, I added a new mode flag "noxarray". 1. Certain test in nczarr_test depend on use of .dodsrc. In order for these to work when testing in parallel, some inter-test dependencies needed to be added. 1. Improved authorization testing to use changes in thredds.ucar.edu
80 lines
3.6 KiB
C
80 lines
3.6 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);
|
|
|
|
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, char* memory0);
|
|
extern int NCZ_stringconvert1(nc_type typid, char* src, char** strp);
|
|
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);
|
|
extern int ncz_sync_atts(NC_FILE_INFO_T*, NC_OBJ* container, NCindex* attlist);
|
|
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_create_superblock(NCZ_FILE_INFO_T* zinfo);
|
|
|
|
/* 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_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, 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,char dimsep);
|
|
|
|
/* 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*/
|