netcdf-c/libhdf4/hdf4func.c

68 lines
1.5 KiB
C
Raw Normal View History

2018-02-08 21:20:58 +08:00
/* Copyright 2018, UCAR/Unidata See netcdf/COPYRIGHT file for copying
* and redistribution conditions.*/
/**
2018-04-05 04:11:44 +08:00
* @file @internal HDF4 functions.
2018-02-08 21:20:58 +08:00
*
* @author Ed Hartnett
*/
2018-04-05 04:11:44 +08:00
#include "config.h"
#include "nc4internal.h"
#include "hdf4dispatch.h"
#include <mfhdf.h>
2018-02-08 21:20:58 +08:00
/**
* @internal Get the format (i.e. NC_FORMAT_NC_HDF4) of an open HDF4
* file.
*
* @param ncid File ID (ignored).
* @param formatp Pointer that gets the constant indicating format.
* @return ::NC_NOERR No error.
* @return ::NC_EBADID Bad ncid.
* @author Ed Hartnett
*/
int
2018-04-05 04:11:44 +08:00
NC_HDF4_inq_format(int ncid, int *formatp)
2018-02-08 21:20:58 +08:00
{
/* HDF4 is the format. */
if (formatp)
*formatp = NC_FORMATX_NC_HDF4;
2018-02-08 21:20:58 +08:00
return NC_NOERR;
2018-02-08 21:20:58 +08:00
}
/**
* @internal Return the extended format (i.e. the dispatch model),
* plus the mode associated with an open file.
*
2018-04-05 04:11:44 +08:00
* @param ncid File ID.
* @param formatp a pointer that gets the extended format. HDF4 files
2018-02-08 21:20:58 +08:00
* will always get NC_FORMATX_NC_HDF4.
* @param modep a pointer that gets the open/create mode associated with
* this file. Ignored if NULL.
* @return ::NC_NOERR No error.
* @return ::NC_EBADID Bad ncid.
* @author Ed Hartnett
*/
int
2018-04-05 04:11:44 +08:00
NC_HDF4_inq_format_extended(int ncid, int *formatp, int *modep)
2018-02-08 21:20:58 +08:00
{
NC *nc;
int retval;
2018-02-08 21:20:58 +08:00
LOG((2, "%s: ncid 0x%x", __func__, ncid));
2018-02-08 21:20:58 +08:00
if ((retval = nc4_find_nc_grp_h5(ncid, &nc, NULL, NULL)))
return NC_EBADID;
2018-02-08 21:20:58 +08:00
if (modep)
*modep = nc->mode|NC_NETCDF4;
2018-02-08 21:20:58 +08:00
if (formatp)
*formatp = NC_FORMATX_NC_HDF4;
return NC_NOERR;
2018-02-08 21:20:58 +08:00
}