Skip to content

Commit

Permalink
added documentation for start/count/stride mandating same size arrays…
Browse files Browse the repository at this point in the history
… as data variable
  • Loading branch information
edwardhartnett committed Aug 16, 2024
1 parent d73521c commit bf18f34
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 33 deletions.
9 changes: 6 additions & 3 deletions libdispatch/dvar.c
Original file line number Diff line number Diff line change
Expand Up @@ -1227,15 +1227,18 @@ NC_getshape(int ncid, int varid, int ndims, size_t* shape)
@param ncid The file ID.
@param varid The variable ID.
@param start Pointer to start array. If NULL ::NC_EINVALCOORDS will
be returned for non-scalar variable.
be returned for non-scalar variable. This array must be same size
as variable's number of dimensions.
@param count Pointer to pointer to count array. If *count is NULL,
an array of the correct size will be allocated, and filled with
counts that represent the full extent of the variable. In this
case, the memory must be freed by the caller.
case, the memory must be freed by the caller. If provided, this
array must be same size as variable's number of dimensions.
@param stride Pointer to pointer to stride array. If NULL, stide is
ignored. If *stride is NULL an array of the correct size will be
allocated, and filled with ones. In this case, the memory must be
freed by the caller.
freed by the caller. If provided, this
array must be same size as variable's number of dimensions.
@return ::NC_NOERR No error.
@return ::NC_EBADID Bad ncid.
Expand Down
35 changes: 23 additions & 12 deletions libdispatch/dvarget.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,11 +545,14 @@ Called by externally visible nc_get_vars_xxx routines.
\param varid Variable ID
\param start start indices. Required for non-scalar vars.
\param start start indices. Required for non-scalar vars. This array
must be same size as variable's number of dimensions.
\param edges count indices.
\param edges count indices. This array must be same size as variable's
number of dimensions.
\param stride data strides.
\param stride data strides. This array must be same size as variable's
number of dimensions.
\param value Pointer where the data will be copied. Memory must be
allocated by the user before this function is called.
Expand Down Expand Up @@ -605,7 +608,7 @@ code.
\param varid Variable ID
\param start start indices.
\param start start indices.
\param edges count indices.
Expand Down Expand Up @@ -688,10 +691,12 @@ nc_inq_ncid().
\param varid Variable ID
\param startp Start vector with one element for each dimension to \ref
specify_hyperslab.
specify_hyperslab. This array must be same size as variable's number
of dimensions.
\param countp Count vector with one element for each dimension to \ref
specify_hyperslab.
specify_hyperslab. This array must be same size as variable's number
of dimensions.
\param ip Pointer where the data will be copied. Memory must be
allocated by the user before this function is called.
Expand Down Expand Up @@ -1141,13 +1146,16 @@ nc_inq_ncid().
\param varid Variable ID
\param startp Start vector with one element for each dimension to \ref
specify_hyperslab.
specify_hyperslab. This array must be same size as variable's number
of dimensions.
\param countp Count vector with one element for each dimension to \ref
specify_hyperslab.
specify_hyperslab. This array must be same size as variable's number
of dimensions.
\param stridep Stride vector with one element for each dimension to
\ref specify_hyperslab.
\ref specify_hyperslab. This array must be same size as variable's
number of dimensions.
\param ip Pointer where the data will be copied. Memory must be
allocated by the user before this function is called.
Expand Down Expand Up @@ -1332,13 +1340,16 @@ nc_inq_ncid().
\param varid Variable ID
\param startp Start vector with one element for each dimension to \ref
specify_hyperslab.
specify_hyperslab. This array must be same size as variable's number
of dimensions.
\param countp Count vector with one element for each dimension to \ref
specify_hyperslab.
specify_hyperslab. This array must be same size as variable's number
of dimensions.
\param stridep Stride vector with one element for each dimension to
\ref specify_hyperslab.
\ref specify_hyperslab. This array must be same size as variable's
number of dimensions.
\param imapp Mapping vector with one element for each dimension to
\ref specify_hyperslab.
Expand Down
24 changes: 16 additions & 8 deletions libdispatch/dvarput.c
Original file line number Diff line number Diff line change
Expand Up @@ -609,10 +609,12 @@ nc_inq_ncid().
\param varid Variable ID
\param startp Start vector with one element for each dimension to \ref
specify_hyperslab.
specify_hyperslab. This array must be same size as variable's number
of dimensions.
\param countp Count vector with one element for each dimension to \ref
specify_hyperslab.
specify_hyperslab. This array must be same size as variable's number
of dimensions.
\param op Pointer where the data will be copied. Memory must be
allocated by the user before this function is called.
Expand Down Expand Up @@ -1018,13 +1020,16 @@ nc_inq_ncid().
\param varid Variable ID
\param startp Start vector with one element for each dimension to \ref
specify_hyperslab.
specify_hyperslab. This array must be same size as variable's number
of dimensions.
\param countp Count vector with one element for each dimension to \ref
specify_hyperslab.
specify_hyperslab. This array must be same size as variable's number
of dimensions.
\param stridep Stride vector with one element for each dimension to
\ref specify_hyperslab.
\ref specify_hyperslab. This array must be same size as variable's
number of dimensions.
\param op Pointer where the data will be copied. Memory must be
allocated by the user before this function is called.
Expand Down Expand Up @@ -1207,13 +1212,16 @@ nc_inq_ncid().
\param varid Variable ID
\param startp Start vector with one element for each dimension to \ref
specify_hyperslab.
specify_hyperslab. This array must be same size as variable's number
of dimensions.
\param countp Count vector with one element for each dimension to \ref
specify_hyperslab.
specify_hyperslab. This array must be same size as variable's number
of dimensions.
\param stridep Stride vector with one element for each dimension to
\ref specify_hyperslab.
\ref specify_hyperslab. This array must be same size as variable's
number of dimensions.
\param imapp Mapping vector with one element for each dimension to
\ref specify_hyperslab.
Expand Down
27 changes: 17 additions & 10 deletions libhdf5/hdf5var.c
Original file line number Diff line number Diff line change
Expand Up @@ -1365,8 +1365,10 @@ NC4_rename_var(int ncid, int varid, const char *name)
*
* @param ncid File ID.
* @param varid Variable ID.
* @param startp Array of start indices.
* @param countp Array of counts.
* @param startp Array of start indices. This array must be same size
* as variable's number of dimensions.
* @param countp Array of counts. This array must be same size as
* variable's number of dimensions.
* @param op pointer that gets the data.
* @param memtype The type of these data in memory.
*
Expand All @@ -1387,11 +1389,12 @@ NC4_put_vara(int ncid, int varid, const size_t *startp,
*
* @param ncid File ID.
* @param varid Variable ID.
* @param startp Array of start indices.
* @param startp Array of start indices. This array must be same size
* as variable's number of dimensions.
* @param countp Array of counts.
* @param ip pointer that gets the data.
* @param memtype The type of these data after it is read into memory.
*
* @returns ::NC_NOERR for success
* @author Ed Hartnett, Dennis Heimbigner
*/
Expand Down Expand Up @@ -1512,11 +1515,13 @@ set_par_access(NC_FILE_INFO_T *h5, NC_VAR_INFO_T *var, hid_t xfer_plistid)
* @param ncid File ID.
* @param varid Variable ID.
* @param startp Array of start indices. Must always be provided by
* caller for non-scalar vars.
* caller for non-scalar vars. This array must be same size
* as variable's number of dimensions.
* @param countp Array of counts. Will default to counts of full
* dimension size if NULL.
* dimension size if NULL. This array must be same size
* as variable's number of dimensions.
* @param stridep Array of strides. Will default to strides of 1 if
* NULL.
* NULL. This array must be same size as variable's number of dimensions.
* @param data The data to be written.
* @param mem_nc_type The type of the data in memory.
*
Expand Down Expand Up @@ -1848,11 +1853,13 @@ NC4_put_vars(int ncid, int varid, const size_t *startp, const size_t *countp,
* @param ncid File ID.
* @param varid Variable ID.
* @param startp Array of start indices. Must be provided for
* non-scalar vars.
* non-scalar vars. This array must be same size as variable's number
* of dimensions.
* @param countp Array of counts. Will default to counts of extent of
* dimension if NULL.
* dimension if NULL. This array must be same size as variable's
* number of dimensions.
* @param stridep Array of strides. Will default to strides of 1 if
* NULL.
* NULL. This array must be same size as variable's number of dimensions.
* @param data The data to be written.
* @param mem_nc_type The type of the data in memory. (Convert to this
* type from file type.)
Expand Down

0 comments on commit bf18f34

Please sign in to comment.