Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-implement the nc_get/put_vars operations for netcdf-4 using the corresponding HDF5 operations. #1001

Merged
merged 4 commits into from
Jun 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This file contains a high-level description of this package's evolution. Release

## 4.7.0 - TBD

* [Enhancement] Improved the performance of the nc_get/put_vars operations by using the equivalent slab capabilities of hdf5. Result is a significant speedup of these operations. See [GitHub #1001](https://github.com/Unidata/netcdf-c/pull/1001) for more information.
* [Enhancement] Expanded the capabilities of `NC_INMEMORY` to support writing and accessing the final modified memory. See [GitHub #879](https://github.com/Unidata/netcdf-c/pull/879) for more information.
* [Enhancement] Made CDF5 support enabled by default. See [Github #931](https://github.com/Unidata/netcdf-c/issues/931) for more information.
* [Bug Fix] Corrected a number of memory issues identified in `ncgen`. See [GitHub #558 for more information](https://github.com/Unidata/netcdf-c/pull/558).
Expand Down
10 changes: 10 additions & 0 deletions include/nc4dispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,16 @@ NC4_get_vara(int ncid, int varid,
const size_t *start, const size_t *count,
void *value, nc_type);

extern int
NC4_put_vars(int ncid, int varid,
const size_t *start, const size_t *count, const ptrdiff_t* stride,
const void *value, nc_type);

extern int
NC4_get_vars(int ncid, int varid,
const size_t *start, const size_t *count, const ptrdiff_t* stride,
void *value, nc_type);

/* End _var */

/* netCDF4 API only */
Expand Down
15 changes: 11 additions & 4 deletions include/nc4internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ typedef enum {NCNAT, NCVAR, NCDIM, NCATT, NCTYP, NCFLD, NCGRP} NC_SORT;
#define HDF5_DIMSCALE_NAME_ATT_NAME "NAME"

/** This is the number of netCDF atomic types. */
#define NUM_ATOMIC_TYPES (NC_MAX_ATOMIC_TYPE + 1)
#define NUM_ATOMIC_TYPES (NC_MAX_ATOMIC_TYPE + 1)

/* Boolean type, to make the code easier to read */
typedef enum {NC_FALSE = 0, NC_TRUE = 1} nc_bool_t;
Expand Down Expand Up @@ -351,17 +351,24 @@ int nc4_get_typelen_mem(NC_HDF5_FILE_INFO_T *h5, nc_type xtype, size_t *len);
int nc4_convert_type(const void *src, void *dest,
const nc_type src_type, const nc_type dest_type,
const size_t len, int *range_error,
const void *fill_value, int strict_nc3);
const void *fill_value, int strict_nc3, int src_long,
int dest_long);

/* These functions do HDF5 things. */
int rec_detach_scales(NC_GRP_INFO_T *grp, int dimid, hid_t dimscaleid);
int rec_reattach_scales(NC_GRP_INFO_T *grp, int dimid, hid_t dimscaleid);
int delete_existing_dimscale_dataset(NC_GRP_INFO_T *grp, int dimid, NC_DIM_INFO_T *dim);
int nc4_open_var_grp2(NC_GRP_INFO_T *grp, int varid, hid_t *dataset);
int nc4_put_vara(NC *nc, int ncid, int varid, const size_t *startp,
const size_t *countp, nc_type xtype, void *op);
const size_t *countp, nc_type xtype, int is_long, void *op);
int nc4_get_vara(NC *nc, int ncid, int varid, const size_t *startp,
const size_t *countp, nc_type xtype, void *op);
const size_t *countp, nc_type xtype, int is_long, void *op);
int nc4_put_vars(NC *nc, int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t* stridep,
nc_type xtype, int is_long, void *op);
int nc4_get_vars(NC *nc, int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t* stridep,
nc_type xtype, int is_long, void *op);
int nc4_rec_match_dimscales(NC_GRP_INFO_T *grp);
int nc4_rec_detect_need_to_preserve_dimids(NC_GRP_INFO_T *grp, nc_bool_t *bad_coord_orderp);
int nc4_rec_write_metadata(NC_GRP_INFO_T *grp, nc_bool_t bad_coord_order);
Expand Down
2 changes: 1 addition & 1 deletion libhdf4/hdf4var.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ NC_HDF4_get_vara(int ncid, int varid, const size_t *startp,
if (var->type_info->hdr.id != memtype)
{
if ((retval = nc4_convert_type(data, ip, var->type_info->hdr.id, memtype, nelem,
&range_error, NULL, 0)))
&range_error, NULL, 0, 0, 0)))
return retval;
free(data);
if (range_error)
Expand Down
2 changes: 1 addition & 1 deletion libhdf5/hdf5attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ NC4_put_att(int ncid, int varid, const char *name, nc_type file_type,
/* Data types are like religions, in that one can convert. */
if ((retval = nc4_convert_type(data, att->data, mem_type, file_type,
len, &range_error, NULL,
(h5->cmode & NC_CLASSIC_MODEL))))
(h5->cmode & NC_CLASSIC_MODEL), 0, 0)))
BAIL(retval);
}
}
Expand Down
Loading