[1022] | 1 | /*! \file |
---|
| 2 | Functions for inquiring about variables. |
---|
| 3 | |
---|
| 4 | Copyright 2010 University Corporation for Atmospheric |
---|
| 5 | Research/Unidata. See COPYRIGHT file for more info. |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include "ncdispatch.h" |
---|
| 9 | |
---|
| 10 | /** \name Learning about Variables |
---|
| 11 | |
---|
| 12 | Functions to learn about the variables in a file. */ |
---|
| 13 | /*! \{ */ /* All these functions are part of this named group... */ |
---|
| 14 | |
---|
| 15 | /** |
---|
| 16 | \ingroup variables |
---|
| 17 | Find the ID of a variable, from the name. |
---|
| 18 | |
---|
| 19 | The function nc_inq_varid returns the ID of a netCDF variable, given |
---|
| 20 | its name. |
---|
| 21 | |
---|
| 22 | \param ncid NetCDF or group ID, from a previous call to nc_open(), |
---|
| 23 | nc_create(), nc_def_grp(), or associated inquiry functions such as |
---|
| 24 | nc_inq_ncid(). |
---|
| 25 | |
---|
| 26 | \param name Name of the variable. |
---|
| 27 | |
---|
| 28 | \param varidp Pointer to location for returned variable ID. \ref |
---|
| 29 | ignored_if_null. |
---|
| 30 | |
---|
| 31 | \returns ::NC_NOERR No error. |
---|
| 32 | \returns ::NC_EBADID Bad ncid. |
---|
| 33 | |
---|
| 34 | \section Example |
---|
| 35 | |
---|
| 36 | Here is an example using nc_inq_varid to find out the ID of a variable |
---|
| 37 | named rh in an existing netCDF dataset named foo.nc: |
---|
| 38 | |
---|
| 39 | \code |
---|
| 40 | #include <netcdf.h> |
---|
| 41 | ... |
---|
| 42 | int status, ncid, rh_id; |
---|
| 43 | ... |
---|
| 44 | status = nc_open("foo.nc", NC_NOWRITE, &ncid); |
---|
| 45 | if (status != NC_NOERR) handle_error(status); |
---|
| 46 | ... |
---|
| 47 | status = nc_inq_varid (ncid, "rh", &rh_id); |
---|
| 48 | if (status != NC_NOERR) handle_error(status); |
---|
| 49 | \endcode |
---|
| 50 | */ |
---|
| 51 | int |
---|
| 52 | nc_inq_varid(int ncid, const char *name, int *varidp) |
---|
| 53 | { |
---|
| 54 | NC* ncp; |
---|
| 55 | int stat = NC_check_id(ncid, &ncp); |
---|
| 56 | if(stat != NC_NOERR) return stat; |
---|
| 57 | return ncp->dispatch->inq_varid(ncid, name, varidp); |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | /** |
---|
| 61 | \ingroup variables |
---|
| 62 | Learn about a variable. |
---|
| 63 | |
---|
| 64 | \param ncid NetCDF or group ID, from a previous call to nc_open(), |
---|
| 65 | nc_create(), nc_def_grp(), or associated inquiry functions such as |
---|
| 66 | nc_inq_ncid(). |
---|
| 67 | |
---|
| 68 | \param varid Variable ID |
---|
| 69 | |
---|
| 70 | \param name Returned \ref object_name of variable. \ref |
---|
| 71 | ignored_if_null. |
---|
| 72 | |
---|
| 73 | \param xtypep Pointer where typeid will be stored. \ref ignored_if_null. |
---|
| 74 | |
---|
| 75 | \param ndimsp Pointer where number of dimensions will be |
---|
| 76 | stored. \ref ignored_if_null. |
---|
| 77 | |
---|
| 78 | \param dimidsp Pointer where array of dimension IDs will be |
---|
| 79 | stored. \ref ignored_if_null. |
---|
| 80 | |
---|
| 81 | \param nattsp Pointer where number of attributes will be |
---|
| 82 | stored. \ref ignored_if_null. |
---|
| 83 | |
---|
| 84 | \returns ::NC_NOERR No error. |
---|
| 85 | \returns ::NC_EBADID Bad ncid. |
---|
| 86 | \returns ::NC_ENOTVAR Invalid variable ID. |
---|
| 87 | |
---|
| 88 | \section Example |
---|
| 89 | |
---|
| 90 | Here is an example using nc_inq_var() to find out about a variable named |
---|
| 91 | rh in an existing netCDF dataset named foo.nc: |
---|
| 92 | |
---|
| 93 | \code |
---|
| 94 | #include <netcdf.h> |
---|
| 95 | ... |
---|
| 96 | int status |
---|
| 97 | int ncid; |
---|
| 98 | int rh_id; |
---|
| 99 | nc_type rh_type; |
---|
| 100 | int rh_ndims; |
---|
| 101 | int rh_dimids[NC_MAX_VAR_DIMS]; |
---|
| 102 | int rh_natts |
---|
| 103 | ... |
---|
| 104 | status = nc_open ("foo.nc", NC_NOWRITE, &ncid); |
---|
| 105 | if (status != NC_NOERR) handle_error(status); |
---|
| 106 | ... |
---|
| 107 | status = nc_inq_varid (ncid, "rh", &rh_id); |
---|
| 108 | if (status != NC_NOERR) handle_error(status); |
---|
| 109 | status = nc_inq_var (ncid, rh_id, 0, &rh_type, &rh_ndims, rh_dimids, |
---|
| 110 | &rh_natts); |
---|
| 111 | if (status != NC_NOERR) handle_error(status); |
---|
| 112 | \endcode |
---|
| 113 | |
---|
| 114 | */ |
---|
| 115 | int |
---|
| 116 | nc_inq_var(int ncid, int varid, char *name, nc_type *xtypep, |
---|
| 117 | int *ndimsp, int *dimidsp, int *nattsp) |
---|
| 118 | { |
---|
| 119 | NC* ncp; |
---|
| 120 | int stat = NC_check_id(ncid, &ncp); |
---|
| 121 | if(stat != NC_NOERR) return stat; |
---|
| 122 | return ncp->dispatch->inq_var_all(ncid, varid, name, xtypep, ndimsp, |
---|
| 123 | dimidsp, nattsp, NULL, NULL, NULL, |
---|
| 124 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
---|
| 125 | } |
---|
| 126 | |
---|
| 127 | /** |
---|
| 128 | \ingroup variables |
---|
| 129 | Learn the name of a variable. |
---|
| 130 | |
---|
| 131 | \param ncid NetCDF or group ID, from a previous call to nc_open(), |
---|
| 132 | nc_create(), nc_def_grp(), or associated inquiry functions such as |
---|
| 133 | nc_inq_ncid(). |
---|
| 134 | |
---|
| 135 | \param varid Variable ID |
---|
| 136 | |
---|
| 137 | \param name Returned variable name. The caller must allocate space for |
---|
| 138 | the returned name. The maximum length is ::NC_MAX_NAME. Ignored if |
---|
| 139 | NULL. |
---|
| 140 | |
---|
| 141 | \returns ::NC_NOERR No error. |
---|
| 142 | \returns ::NC_EBADID Bad ncid. |
---|
| 143 | \returns ::NC_ENOTVAR Invalid variable ID. |
---|
| 144 | */ |
---|
| 145 | int |
---|
| 146 | nc_inq_varname(int ncid, int varid, char *name) |
---|
| 147 | { |
---|
| 148 | return nc_inq_var(ncid, varid, name, NULL, NULL, |
---|
| 149 | NULL, NULL); |
---|
| 150 | } |
---|
| 151 | |
---|
| 152 | /** Learn the type of a variable. |
---|
| 153 | \ingroup variables |
---|
| 154 | |
---|
| 155 | \param ncid NetCDF or group ID, from a previous call to nc_open(), |
---|
| 156 | nc_create(), nc_def_grp(), or associated inquiry functions such as |
---|
| 157 | nc_inq_ncid(). |
---|
| 158 | |
---|
| 159 | \param varid Variable ID |
---|
| 160 | |
---|
| 161 | \param typep Pointer where typeid will be stored. \ref ignored_if_null. |
---|
| 162 | |
---|
| 163 | \returns ::NC_NOERR No error. |
---|
| 164 | \returns ::NC_EBADID Bad ncid. |
---|
| 165 | \returns ::NC_ENOTVAR Invalid variable ID. |
---|
| 166 | */ |
---|
| 167 | int |
---|
| 168 | nc_inq_vartype(int ncid, int varid, nc_type *typep) |
---|
| 169 | { |
---|
| 170 | return nc_inq_var(ncid, varid, NULL, typep, NULL, |
---|
| 171 | NULL, NULL); |
---|
| 172 | } |
---|
| 173 | |
---|
| 174 | /** Learn how many dimensions are associated with a variable. |
---|
| 175 | \ingroup variables |
---|
| 176 | |
---|
| 177 | \param ncid NetCDF or group ID, from a previous call to nc_open(), |
---|
| 178 | nc_create(), nc_def_grp(), or associated inquiry functions such as |
---|
| 179 | nc_inq_ncid(). |
---|
| 180 | |
---|
| 181 | \param varid Variable ID |
---|
| 182 | |
---|
| 183 | \param ndimsp Pointer where number of dimensions will be |
---|
| 184 | stored. \ref ignored_if_null. |
---|
| 185 | |
---|
| 186 | \returns ::NC_NOERR No error. |
---|
| 187 | \returns ::NC_EBADID Bad ncid. |
---|
| 188 | \returns ::NC_ENOTVAR Invalid variable ID. |
---|
| 189 | */ |
---|
| 190 | int |
---|
| 191 | nc_inq_varndims(int ncid, int varid, int *ndimsp) |
---|
| 192 | { |
---|
| 193 | return nc_inq_var(ncid, varid, NULL, NULL, ndimsp, NULL, NULL); |
---|
| 194 | } |
---|
| 195 | |
---|
| 196 | /** Learn the dimension IDs associated with a variable. |
---|
| 197 | \ingroup variables |
---|
| 198 | |
---|
| 199 | \param ncid NetCDF or group ID, from a previous call to nc_open(), |
---|
| 200 | nc_create(), nc_def_grp(), or associated inquiry functions such as |
---|
| 201 | nc_inq_ncid(). |
---|
| 202 | |
---|
| 203 | \param varid Variable ID |
---|
| 204 | |
---|
| 205 | \param dimidsp Pointer where array of dimension IDs will be |
---|
| 206 | stored. \ref ignored_if_null. |
---|
| 207 | |
---|
| 208 | \returns ::NC_NOERR No error. |
---|
| 209 | \returns ::NC_EBADID Bad ncid. |
---|
| 210 | \returns ::NC_ENOTVAR Invalid variable ID. |
---|
| 211 | */ |
---|
| 212 | int |
---|
| 213 | nc_inq_vardimid(int ncid, int varid, int *dimidsp) |
---|
| 214 | { |
---|
| 215 | return nc_inq_var(ncid, varid, NULL, NULL, NULL, |
---|
| 216 | dimidsp, NULL); |
---|
| 217 | } |
---|
| 218 | |
---|
| 219 | /** Learn how many attributes are associated with a variable. |
---|
| 220 | \ingroup variables |
---|
| 221 | |
---|
| 222 | \param ncid NetCDF or group ID, from a previous call to nc_open(), |
---|
| 223 | nc_create(), nc_def_grp(), or associated inquiry functions such as |
---|
| 224 | nc_inq_ncid(). |
---|
| 225 | |
---|
| 226 | \param varid Variable ID |
---|
| 227 | |
---|
| 228 | \param nattsp Pointer where number of attributes will be |
---|
| 229 | stored. \ref ignored_if_null. |
---|
| 230 | |
---|
| 231 | \returns ::NC_NOERR No error. |
---|
| 232 | \returns ::NC_EBADID Bad ncid. |
---|
| 233 | \returns ::NC_ENOTVAR Invalid variable ID. |
---|
| 234 | */ |
---|
| 235 | int |
---|
| 236 | nc_inq_varnatts(int ncid, int varid, int *nattsp) |
---|
| 237 | { |
---|
| 238 | if (varid == NC_GLOBAL) |
---|
| 239 | return nc_inq_natts(ncid,nattsp); |
---|
| 240 | /*else*/ |
---|
| 241 | return nc_inq_var(ncid, varid, NULL, NULL, NULL, NULL, |
---|
| 242 | nattsp); |
---|
| 243 | } |
---|
| 244 | |
---|
| 245 | #ifdef USE_NETCDF4 |
---|
| 246 | /** \ingroup variables |
---|
| 247 | Learn the storage and deflate settings for a variable. |
---|
| 248 | |
---|
| 249 | This is a wrapper for nc_inq_var_all(). |
---|
| 250 | |
---|
| 251 | \param ncid NetCDF or group ID, from a previous call to nc_open(), |
---|
| 252 | nc_create(), nc_def_grp(), or associated inquiry functions such as |
---|
| 253 | nc_inq_ncid(). |
---|
| 254 | |
---|
| 255 | \param varid Variable ID |
---|
| 256 | |
---|
| 257 | \param shufflep A 1 will be written here if the shuffle filter is |
---|
| 258 | turned on for this variable, and a 0 otherwise. \ref ignored_if_null. |
---|
| 259 | |
---|
| 260 | \param deflatep If this pointer is non-NULL, the nc_inq_var_deflate |
---|
| 261 | function will write a 1 if the deflate filter is turned on for this |
---|
| 262 | variable, and a 0 otherwise. \ref ignored_if_null. |
---|
| 263 | |
---|
| 264 | \param deflate_levelp If the deflate filter is in use for this |
---|
| 265 | variable, the deflate_level will be writen here. \ref ignored_if_null. |
---|
| 266 | |
---|
| 267 | \returns ::NC_NOERR No error. |
---|
| 268 | \returns ::NC_ENOTNC4 Not a netCDF-4 file. |
---|
| 269 | \returns ::NC_EBADID Bad ncid. |
---|
| 270 | \returns ::NC_ENOTVAR Invalid variable ID. |
---|
| 271 | */ |
---|
| 272 | int |
---|
| 273 | nc_inq_var_deflate(int ncid, int varid, int *shufflep, int *deflatep, |
---|
| 274 | int *deflate_levelp) |
---|
| 275 | { |
---|
| 276 | NC* ncp; |
---|
| 277 | int stat = NC_check_id(ncid,&ncp); |
---|
| 278 | if(stat != NC_NOERR) return stat; |
---|
| 279 | return ncp->dispatch->inq_var_all( |
---|
| 280 | ncid, varid, |
---|
| 281 | NULL, /*name*/ |
---|
| 282 | NULL, /*xtypep*/ |
---|
| 283 | NULL, /*ndimsp*/ |
---|
| 284 | NULL, /*dimidsp*/ |
---|
| 285 | NULL, /*nattsp*/ |
---|
| 286 | shufflep, /*shufflep*/ |
---|
| 287 | deflatep, /*deflatep*/ |
---|
| 288 | deflate_levelp, /*deflatelevelp*/ |
---|
| 289 | NULL, /*fletcher32p*/ |
---|
| 290 | NULL, /*contiguousp*/ |
---|
| 291 | NULL, /*chunksizep*/ |
---|
| 292 | NULL, /*nofillp*/ |
---|
| 293 | NULL, /*fillvaluep*/ |
---|
| 294 | NULL, /*endianp*/ |
---|
| 295 | NULL, /*optionsmaskp*/ |
---|
| 296 | NULL /*pixelsp*/ |
---|
| 297 | ); |
---|
| 298 | } |
---|
| 299 | |
---|
| 300 | /** \ingroup variables |
---|
| 301 | Learn the szip settings of a variable. |
---|
| 302 | |
---|
| 303 | This function returns the szip settings for a variable. NetCDF does |
---|
| 304 | not allow variables to be created with szip (due to license problems |
---|
| 305 | with the szip library), but we do enable read-only access of HDF5 |
---|
| 306 | files with szip compression. |
---|
| 307 | |
---|
| 308 | This is a wrapper for nc_inq_var_all(). |
---|
| 309 | |
---|
| 310 | \param ncid NetCDF or group ID, from a previous call to nc_open(), |
---|
| 311 | nc_create(), nc_def_grp(), or associated inquiry functions such as |
---|
| 312 | nc_inq_ncid(). |
---|
| 313 | |
---|
| 314 | \param varid Variable ID |
---|
| 315 | |
---|
| 316 | \param options_maskp The szip options mask will be copied to this |
---|
| 317 | pointer. \ref ignored_if_null. |
---|
| 318 | |
---|
| 319 | \param pixels_per_blockp The szip pixels per block will be copied |
---|
| 320 | here. \ref ignored_if_null. |
---|
| 321 | |
---|
| 322 | \returns ::NC_NOERR No error. |
---|
| 323 | \returns ::NC_EBADID Bad ncid. |
---|
| 324 | \returns ::NC_ENOTNC4 Not a netCDF-4 file. |
---|
| 325 | \returns ::NC_ENOTVAR Invalid variable ID. |
---|
| 326 | */ |
---|
| 327 | int |
---|
| 328 | nc_inq_var_szip(int ncid, int varid, int *options_maskp, int *pixels_per_blockp) |
---|
| 329 | { |
---|
| 330 | NC* ncp; |
---|
| 331 | int stat = NC_check_id(ncid,&ncp); |
---|
| 332 | if(stat != NC_NOERR) return stat; |
---|
| 333 | return ncp->dispatch->inq_var_all( |
---|
| 334 | ncid, varid, |
---|
| 335 | NULL, /*name*/ |
---|
| 336 | NULL, /*xtypep*/ |
---|
| 337 | NULL, /*ndimsp*/ |
---|
| 338 | NULL, /*dimidsp*/ |
---|
| 339 | NULL, /*nattsp*/ |
---|
| 340 | NULL, /*shufflep*/ |
---|
| 341 | NULL, /*deflatep*/ |
---|
| 342 | NULL, /*deflatelevelp*/ |
---|
| 343 | NULL, /*fletcher32p*/ |
---|
| 344 | NULL, /*contiguousp*/ |
---|
| 345 | NULL, /*chunksizep*/ |
---|
| 346 | NULL, /*nofillp*/ |
---|
| 347 | NULL, /*fillvaluep*/ |
---|
| 348 | NULL, /*endianp*/ |
---|
| 349 | options_maskp, /*optionsmaskp*/ |
---|
| 350 | pixels_per_blockp /*pixelsp*/ |
---|
| 351 | ); |
---|
| 352 | } |
---|
| 353 | |
---|
| 354 | /** \ingroup variables |
---|
| 355 | Learn the checksum settings for a variable. |
---|
| 356 | |
---|
| 357 | This is a wrapper for nc_inq_var_all(). |
---|
| 358 | |
---|
| 359 | \param ncid NetCDF or group ID, from a previous call to nc_open(), |
---|
| 360 | nc_create(), nc_def_grp(), or associated inquiry functions such as |
---|
| 361 | nc_inq_ncid(). |
---|
| 362 | |
---|
| 363 | \param varid Variable ID |
---|
| 364 | |
---|
| 365 | \param fletcher32p Will be set to ::NC_FLETCHER32 if the fletcher32 |
---|
| 366 | checksum filter is turned on for this variable, and ::NC_NOCHECKSUM if |
---|
| 367 | it is not. \ref ignored_if_null. |
---|
| 368 | |
---|
| 369 | \returns ::NC_NOERR No error. |
---|
| 370 | \returns ::NC_EBADID Bad ncid. |
---|
| 371 | \returns ::NC_ENOTNC4 Not a netCDF-4 file. |
---|
| 372 | \returns ::NC_ENOTVAR Invalid variable ID. |
---|
| 373 | */ |
---|
| 374 | int |
---|
| 375 | nc_inq_var_fletcher32(int ncid, int varid, int *fletcher32p) |
---|
| 376 | { |
---|
| 377 | NC* ncp; |
---|
| 378 | int stat = NC_check_id(ncid,&ncp); |
---|
| 379 | if(stat != NC_NOERR) return stat; |
---|
| 380 | return ncp->dispatch->inq_var_all( |
---|
| 381 | ncid, varid, |
---|
| 382 | NULL, /*name*/ |
---|
| 383 | NULL, /*xtypep*/ |
---|
| 384 | NULL, /*ndimsp*/ |
---|
| 385 | NULL, /*dimidsp*/ |
---|
| 386 | NULL, /*nattsp*/ |
---|
| 387 | NULL, /*shufflep*/ |
---|
| 388 | NULL, /*deflatep*/ |
---|
| 389 | NULL, /*deflatelevelp*/ |
---|
| 390 | fletcher32p, /*fletcher32p*/ |
---|
| 391 | NULL, /*contiguousp*/ |
---|
| 392 | NULL, /*chunksizep*/ |
---|
| 393 | NULL, /*nofillp*/ |
---|
| 394 | NULL, /*fillvaluep*/ |
---|
| 395 | NULL, /*endianp*/ |
---|
| 396 | NULL, /*optionsmaskp*/ |
---|
| 397 | NULL /*pixelsp*/ |
---|
| 398 | ); |
---|
| 399 | } |
---|
| 400 | |
---|
| 401 | /** \ingroup variables |
---|
| 402 | |
---|
| 403 | This is a wrapper for nc_inq_var_all(). |
---|
| 404 | |
---|
| 405 | \param ncid NetCDF or group ID, from a previous call to nc_open(), |
---|
| 406 | nc_create(), nc_def_grp(), or associated inquiry functions such as |
---|
| 407 | nc_inq_ncid(). |
---|
| 408 | |
---|
| 409 | \param varid Variable ID |
---|
| 410 | |
---|
| 411 | \param storagep Address of returned storage property, returned as |
---|
| 412 | ::NC_CONTIGUOUS if this variable uses contiguous storage, or |
---|
| 413 | ::NC_CHUNKED if it uses chunked storage. \ref ignored_if_null. |
---|
| 414 | |
---|
| 415 | \param chunksizesp The chunksizes will be copied here. \ref |
---|
| 416 | ignored_if_null. |
---|
| 417 | |
---|
| 418 | \returns ::NC_NOERR No error. |
---|
| 419 | \returns ::NC_EBADID Bad ncid. |
---|
| 420 | \returns ::NC_ENOTNC4 Not a netCDF-4 file. |
---|
| 421 | \returns ::NC_ENOTVAR Invalid variable ID. |
---|
| 422 | */ |
---|
| 423 | int |
---|
| 424 | nc_inq_var_chunking(int ncid, int varid, int *storagep, size_t *chunksizesp) |
---|
| 425 | { |
---|
| 426 | NC *ncp; |
---|
| 427 | int stat = NC_check_id(ncid, &ncp); |
---|
| 428 | if(stat != NC_NOERR) return stat; |
---|
| 429 | return ncp->dispatch->inq_var_all(ncid, varid, NULL, NULL, NULL, NULL, |
---|
| 430 | NULL, NULL, NULL, NULL, NULL, storagep, |
---|
| 431 | chunksizesp, NULL, NULL, NULL, NULL, NULL); |
---|
| 432 | } |
---|
| 433 | |
---|
| 434 | /** \ingroup variables |
---|
| 435 | Learn the fill mode of a variable. |
---|
| 436 | |
---|
| 437 | The fill mode of a variable is set by nc_def_var_fill(). |
---|
| 438 | |
---|
| 439 | This is a wrapper for nc_inq_var_all(). |
---|
| 440 | |
---|
| 441 | \param ncid NetCDF or group ID, from a previous call to nc_open(), |
---|
| 442 | nc_create(), nc_def_grp(), or associated inquiry functions such as |
---|
| 443 | nc_inq_ncid(). |
---|
| 444 | |
---|
| 445 | \param varid Variable ID |
---|
| 446 | |
---|
| 447 | \param no_fill Pointer to an integer which will get a 1 if no_fill |
---|
| 448 | mode is set for this variable. \ref ignored_if_null. |
---|
| 449 | |
---|
| 450 | \param fill_valuep A pointer which will get the fill value for this |
---|
| 451 | variable. \ref ignored_if_null. |
---|
| 452 | |
---|
| 453 | \returns ::NC_NOERR No error. |
---|
| 454 | \returns ::NC_EBADID Bad ncid. |
---|
| 455 | \returns ::NC_ENOTVAR Invalid variable ID. |
---|
| 456 | */ |
---|
| 457 | int |
---|
| 458 | nc_inq_var_fill(int ncid, int varid, int *no_fill, void *fill_valuep) |
---|
| 459 | { |
---|
| 460 | NC* ncp; |
---|
| 461 | int stat = NC_check_id(ncid,&ncp); |
---|
| 462 | if(stat != NC_NOERR) return stat; |
---|
| 463 | return ncp->dispatch->inq_var_all( |
---|
| 464 | ncid, varid, |
---|
| 465 | NULL, /*name*/ |
---|
| 466 | NULL, /*xtypep*/ |
---|
| 467 | NULL, /*ndimsp*/ |
---|
| 468 | NULL, /*dimidsp*/ |
---|
| 469 | NULL, /*nattsp*/ |
---|
| 470 | NULL, /*shufflep*/ |
---|
| 471 | NULL, /*deflatep*/ |
---|
| 472 | NULL, /*deflatelevelp*/ |
---|
| 473 | NULL, /*fletcher32p*/ |
---|
| 474 | NULL, /*contiguousp*/ |
---|
| 475 | NULL, /*chunksizep*/ |
---|
| 476 | no_fill, /*nofillp*/ |
---|
| 477 | fill_valuep, /*fillvaluep*/ |
---|
| 478 | NULL, /*endianp*/ |
---|
| 479 | NULL, /*optionsmaskp*/ |
---|
| 480 | NULL /*pixelsp*/ |
---|
| 481 | ); |
---|
| 482 | } |
---|
| 483 | |
---|
| 484 | /** \ingroup variables |
---|
| 485 | Find the endianness of a variable. |
---|
| 486 | |
---|
| 487 | This is a wrapper for nc_inq_var_all(). |
---|
| 488 | |
---|
| 489 | \param ncid NetCDF or group ID, from a previous call to nc_open(), |
---|
| 490 | nc_create(), nc_def_grp(), or associated inquiry functions such as |
---|
| 491 | nc_inq_ncid(). |
---|
| 492 | |
---|
| 493 | \param varid Variable ID |
---|
| 494 | |
---|
| 495 | \param endianp Storage which will get ::NC_ENDIAN_LITTLE if this |
---|
| 496 | variable is stored in little-endian format, ::NC_ENDIAN_BIG if it is |
---|
| 497 | stored in big-endian format, and ::NC_ENDIAN_NATIVE if the endianness |
---|
| 498 | is not set, and the variable is not created yet. |
---|
| 499 | |
---|
| 500 | \returns ::NC_NOERR No error. |
---|
| 501 | \returns ::NC_ENOTNC4 Not a netCDF-4 file. |
---|
| 502 | \returns ::NC_EBADID Bad ncid. |
---|
| 503 | \returns ::NC_ENOTVAR Invalid variable ID. |
---|
| 504 | */ |
---|
| 505 | int |
---|
| 506 | nc_inq_var_endian(int ncid, int varid, int *endianp) |
---|
| 507 | { |
---|
| 508 | NC* ncp; |
---|
| 509 | int stat = NC_check_id(ncid,&ncp); |
---|
| 510 | if(stat != NC_NOERR) return stat; |
---|
| 511 | return ncp->dispatch->inq_var_all( |
---|
| 512 | ncid, varid, |
---|
| 513 | NULL, /*name*/ |
---|
| 514 | NULL, /*xtypep*/ |
---|
| 515 | NULL, /*ndimsp*/ |
---|
| 516 | NULL, /*dimidsp*/ |
---|
| 517 | NULL, /*nattsp*/ |
---|
| 518 | NULL, /*shufflep*/ |
---|
| 519 | NULL, /*deflatep*/ |
---|
| 520 | NULL, /*deflatelevelp*/ |
---|
| 521 | NULL, /*fletcher32p*/ |
---|
| 522 | NULL, /*contiguousp*/ |
---|
| 523 | NULL, /*chunksizep*/ |
---|
| 524 | NULL, /*nofillp*/ |
---|
| 525 | NULL, /*fillvaluep*/ |
---|
| 526 | endianp, /*endianp*/ |
---|
| 527 | NULL, /*optionsmaskp*/ |
---|
| 528 | NULL /*pixelsp*/ |
---|
| 529 | ); |
---|
| 530 | } |
---|
| 531 | |
---|
| 532 | /** Return number and list of unlimited dimensions. |
---|
| 533 | |
---|
| 534 | In netCDF-4 files, it's possible to have multiple unlimited |
---|
| 535 | dimensions. This function returns a list of the unlimited dimension |
---|
| 536 | ids visible in a group. |
---|
| 537 | |
---|
| 538 | Dimensions are visible in a group if they have been defined in that |
---|
| 539 | group, or any ancestor group. |
---|
| 540 | |
---|
| 541 | ncid |
---|
| 542 | NetCDF group ID, from a previous call to nc_open, nc_create, nc_def_grp, etc. |
---|
| 543 | nunlimdimsp |
---|
| 544 | A pointer to an int which will get the number of visible unlimited dimensions. Ignored if NULL. |
---|
| 545 | unlimdimidsp |
---|
| 546 | A pointer to an already allocated array of int which will get the ids of all visible unlimited dimensions. Ignored if NULL. To allocate the correct length for this array, call nc_inq_unlimdims with a NULL for this parameter and use the nunlimdimsp parameter to get the number of visible unlimited dimensions. |
---|
| 547 | |
---|
| 548 | Errors |
---|
| 549 | |
---|
| 550 | NC_NOERR |
---|
| 551 | No error. |
---|
| 552 | NC_EBADID |
---|
| 553 | Bad group id. |
---|
| 554 | NC_ENOTNC4 |
---|
| 555 | Attempting a netCDF-4 operation on a netCDF-3 file. NetCDF-4 operations can only be performed on files defined with a create mode which includes flag HDF5. (see nc_open). |
---|
| 556 | NC_ESTRICTNC3 |
---|
| 557 | This file was created with the strict netcdf-3 flag, therefore netcdf-4 operations are not allowed. (see nc_open). |
---|
| 558 | NC_EHDFERR |
---|
| 559 | An error was reported by the HDF5 layer. |
---|
| 560 | |
---|
| 561 | */ |
---|
| 562 | int |
---|
| 563 | nc_inq_unlimdims(int ncid, int *nunlimdimsp, int *unlimdimidsp) |
---|
| 564 | { |
---|
| 565 | NC* ncp; |
---|
| 566 | int stat = NC_check_id(ncid,&ncp); |
---|
| 567 | if(stat != NC_NOERR) return stat; |
---|
| 568 | return ncp->dispatch->inq_unlimdims(ncid, nunlimdimsp, |
---|
| 569 | unlimdimidsp); |
---|
| 570 | } |
---|
| 571 | |
---|
| 572 | #endif /* USE_NETCDF4 */ |
---|
| 573 | /*! \} */ /* End of named group ...*/ |
---|