Index of /examples/code/h5cf/hdf5

[ICO]NameLast modifiedSizeDescription

[DIR]Parent Directory  -
[DIR]c/02-Jun-2017 10:49 -
[DIR]fortran/02-Jun-2017 10:49 -
[DIR]h5py/02-Jun-2017 10:49 -

This directory and the subdirectories include C, Fortran and Python examples on how
to add CF attributes to an HDF5 file. These examples should only be treated as programming 
examples. Individual application may find better ways to handle this. 
For the demo purpose, a new HDF5 file that includes HDF5 datasets 
 and CF attributes are created.
The example datasets and the CF attribute values are fake. The users should be aware of this 
fact. 

                HDF5
    Uses HDF5 version 1.8.5(or later)

            C PROGRAMS

hdf5_general.c:
    Uses HDF5 to create a file with 3 datasets: lat, lon, temp. Lat represents
    latitude as a 1-D array of 180 floating-point numbers from -90 to 90. It contains
    the CF attributes: units, long_name, and standard_name. Lon is a dataset that
    represents longitude as a 1-D array of 360 floating-point numbers from -180 - 180.
    It contains the same CF attributes as the latitude dataset. Temp is a dataset 
    that represents temperature as a 2-D array of 180x360 floating-point numbers. It 
    contains the CF attributes: units, long_name, _FillValue, coordinates, valid_min, 
    valid_max, valid_range, scale_factor, add_offset. Outputs data to general.h5

hdf5_chunk_compress.c:
    Uses HDF5 to create a file with 3 datasets: lat, lon, temp. Lat represents latitude 
    as a 1-D array of 1800 floating-point numbers from -90 to 90. It contains the CF 
    attributes: units and long_name. Lon is a dataset that represents longitude as a 
    1-D array of 3600 floating-point numbers from -180 - 180. It contains the same 
    CF attributes as lat. Temp is a dataset that represents temperature as a 2-D array 
    of 1800x3600 floating-point numbers. It contains the CF attributes: units, long_name, 
    _FillValue, and coordinates. This example shows how to use chunking and compression. 
    The "temp" dataset is chunked and compressed. The chunk size is 900x1800. The deflate 
    compression is used with a compression level of 1. Data is written to chunk_compress.h5

hdf5_3D.c:
    Creates 4 datasets: radiation, latitude, longitude, pressure. Radiation is a 3-D 
    array of 180x360x20 floating-point numbers. It contains the CF attributes: 
    units, fillvalue, long_name, and coordinates. Latitude and longitude are similar 
    to hdf5_chunk_compress.c. Pressure is a 1-D array of 20 floating-point numbers. 
    It contains the CF attributes units and long_name. Data is written to 3D.h5

dim_scale.c:
    Uses the HDF5 dimension scale API to create a file with 3 datasets: lat, lon, temp. 
    Lat represents latitude as a 1-D array of 180 floating-point numbers from -90 to 90. 
    It contains the CF attributes: units, long_name, and standard_name. Lon is a dataset 
    that represents longitude as a 1-D array of 360 floating-point numbers from -180 - 
    180. It contains the same CF attributes as the latitude dataset. Temp is a dataset
    that represents temperature as a 2-D array of 180x360 floating-point numbers. It
    contains the CF attributes: units, long_name, _FillValue, coordinates, valid_min,
    valid_max, valid_range, scale_factor, add_offset. Data is stored in ds_ex1.h5. 


                FORTRAN PROGRAMS

hdf5_general.f90:
    Same as hdf5_general.c, but written in FORTRAN90

hdf5_chunk_compress.f90:
    Same as hdf5_chunk_compress.c, but written in FORTRAN90
    Note: Unlike the corresponding c program, the lat and lon datasets are not chunked 
    and compressed.

hdf5_3D.f90:
    Same as hdf5_3D.c, but written in FORTRAN90



                H5PY
    Uses h5py-1.3.0, numpy-1.2.1, python-2.6 .

cf_example.py:
    Create an hdf5 file with 3 datasets: lat, lon, temp. Lat represents
    latitude as a 1-D array of 180 floating-point numbers from -90 to 90.
    It contains the CF attributes: units, long_name, and standard_name.
    Lon is a dataset that represents longitude as a 1-D array of 360
    floating-point numbers from -180 - 180. It contains the same CF
    attributes as the latitude dataset. Temp is a dataset that represents
    temperature as a 2-D array of 180x360 floating-point numbers. The
    temperature dataset has the CF attributes: units, long_name, _FillValue,
    coordinates, valid_min, valid_max, valid_range, scale_factor, add_offset.
    Writes data to cf_example.h5


                EXECUTION INSTRUCTIONS
python cf_example.py


                COMPILING INSTRUCTIONS (C)

make general: compiles hdf5_general.c into the executable general

make chunk_compress: compiles hdf5_chunk_compress.c into the executable chunk_compress

make 3D: compiles hdf5_3D.c into the executable 3D

make dim_scale: compiles dim_scale.c into the executable dim_scale

make all: compiles hdf5_general.c, hdf5_chunk_compress.c, hdf5_3D.c, ds_ex1.c

make clean: removes general, chunk_compress, 3D, dim_scale


                COMPILING INSTRUCTIONS (FORTRAN)

make general: compiles hdf5_general.f90 into the executable general

make chunk_compress: compiles hdf5_chunk_compress.f90 into the executable chunk_compress

make 3D: compiles hdf5_3D.f90 into the executable 3D

make all: compiles hdf5_general.f90, hdf5_chunk_compress.f90, hdf5_3D.f90

make clean: removes general, chunk_compress, 3D