Page tree

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

 

JAVA

FORTRAN

C++

C

 

Link

H5LT_DTYPE_TO_TEXT

Creates a text description of an HDF5 datatype.

Procedure:

H5LT_DTYPE_TO_TEXT(datatype, str, lang_type, len)

Signature:

herr_t H5LTdtype_to_text(hid_t datatype, char* str, H5LT_lang_t lang_type, size_t* len)

Parameters:
hid_t datatypeIN: Identifier of the datatype to be converted.
char* strOUT: Buffer for the text description of the datatype.
H5LT_lang_t lang_type    IN: The language used to describe the datatype. The currently supported language is H5LT_DDL.
size_t* lenOUT: the size of buffer needed to store the text description.

Description:

Given an HDF5 datatype identifier, this function creates a description of this datatype in lang_type language format.

A preliminary H5LTdtype_to_text call can be made to determine the size of the buffer needed with a NULL passed in for str. This value is returned as len. That value can then be assigned to len for a second H5Ttype_to_text call, which will retrieve the actual text description for the datatype.

If len is not big enough for the description, the text description will be truncated to fit in the buffer.

Currently only DDL (H5LT_DDL) is supported for lang_type. The complete DDL definition of HDF5 data types can be found in the last chapter of the HDF5 User’s Guide. An example of DDL definition of enum type is shown as follows.

“H5T_ENUM { H5T_NATIVE_INT; 
            “Bob”        0;
            “Elena”      1;
            “Quincey”    2;      
            “Frank”      3;      }”

Returns:

Returns non-negative if successful; otherwise returns a negative value.

Example:

examples / h5_subset.c [32:42]
 1.10/master  HDFFV/hdf5  Copy
int
main (void)
{
    hsize_t     dims[2], dimsm[2];   
    int         data[DIM0][DIM1];           /* data to write */
    int         sdata[DIM0_SUB][DIM1_SUB];  /* subset to write */
    int         rdata[DIM0][DIM1];          /* buffer for read */
 
    hid_t       file_id, dataset_id;        /* handles */
    hid_t       dataspace_id, memspace_id; 

fortran / examples / compound.f90 [25:35]
 1.10/master  HDFFV/hdf5  Copy
     PROGRAM COMPOUNDEXAMPLE

     USE HDF5 ! This module contains all necessary modules

     IMPLICIT NONE

     CHARACTER(LEN=11), PARAMETER :: filename = "compound.h5" ! File name
     CHARACTER(LEN=8), PARAMETER :: dsetname = "Compound"     ! Dataset name
     INTEGER, PARAMETER :: dimsize = 6 ! Size of the dataset

     INTEGER(HID_T) :: file_id       ! File identifier

c++ / examples / create.cpp [33:43]
 1.10/master  HDFFV/hdf5  Copy
int main (void)
{
   /*
    * Data initialization.
    */
   int i, j;
   int data[NX][NY];          // buffer for data to write
   for (j = 0; j < NX; j++)
   {
      for (i = 0; i < NY; i++)

public class H5Ex_D_Chunk {
    private static String FILENAME = "H5Ex_D_Chunk.h5";
    private static String DATASETNAME = "DS1";
    private static final int DIM_X = 6;
    private static final int DIM_Y = 8;
    private static final int CHUNK_X = 4;
    private static final int CHUNK_Y = 4;
    private static final int RANK = 2;
    private static final int NDIMS = 2;

--- Last Modified: November 15, 2017 | 01:49 PM