@@ -92,11 +92,28 @@ void read_array_single(hid_t h_grp, const struct io_props props, size_t N,
9292 const size_t copySize = typeSize * props .dimension ;
9393 const size_t num_elements = N * props .dimension ;
9494
95+ const char * dataset_name = props .name ;
96+
9597 /* Check whether the dataspace exists or not */
96- const htri_t exist = H5Lexists (h_grp , props . name , 0 );
98+ htri_t exist = H5Lexists (h_grp , dataset_name , 0 );
9799 if (exist < 0 ) {
98- error ("Error while checking the existence of data set '%s'." , props .name );
99- } else if (exist == 0 ) {
100+ error ("Error while checking the existence of data set '%s'." , dataset_name );
101+ }
102+
103+ if (exist == 0 ) {
104+ const char * alias = io_get_input_field_alias (props .name );
105+ if (alias != NULL ) {
106+ const htri_t alias_exist = H5Lexists (h_grp , alias , 0 );
107+ if (alias_exist < 0 ) {
108+ error ("Error while checking the existence of data set '%s'." , alias );
109+ } else if (alias_exist > 0 ) {
110+ dataset_name = alias ;
111+ exist = alias_exist ;
112+ }
113+ }
114+ }
115+
116+ if (exist == 0 ) {
100117 if (props .importance == COMPULSORY ) {
101118 error ("Compulsory data set '%s' not present in the file." , props .name );
102119 } else {
@@ -119,8 +136,8 @@ void read_array_single(hid_t h_grp, const struct io_props props, size_t N,
119136 /* props.name); */
120137
121138 /* Open data space */
122- const hid_t h_data = H5Dopen (h_grp , props . name , H5P_DEFAULT );
123- if (h_data < 0 ) error ("Error while opening data space '%s'." , props . name );
139+ const hid_t h_data = H5Dopen (h_grp , dataset_name , H5P_DEFAULT );
140+ if (h_data < 0 ) error ("Error while opening data space '%s'." , dataset_name );
124141
125142 /* Allocate temporary buffer */
126143 void * temp = malloc (num_elements * typeSize );
@@ -131,7 +148,7 @@ void read_array_single(hid_t h_grp, const struct io_props props, size_t N,
131148 /* Using HDF5 dataspaces would be better */
132149 const hid_t h_err = H5Dread (h_data , io_hdf5_type (props .type ), H5S_ALL ,
133150 H5S_ALL , H5P_DEFAULT , temp );
134- if (h_err < 0 ) error ("Error while reading data array '%s'." , props . name );
151+ if (h_err < 0 ) error ("Error while reading data array '%s'." , dataset_name );
135152
136153 /* Unit conversion if necessary */
137154 const double unit_factor =
0 commit comments