aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2010-12-12 15:30:16 -0800
committerThomas White <taw@physics.org>2012-02-22 15:27:09 +0100
commitf35fd8c3733e207bed0d049d5dab6d8d62327b20 (patch)
tree39fc20f2ea145aaa3f25901da568e25c28ddf38b
parent74dfd122a3179a719e48ef89a39cbef9ce9dada7 (diff)
Be consistent with HDF5 array specification
http://www.hdfgroup.org/HDF5/doc/UG/UG_frame12Dataspaces.html says: "Dataspace dimensions are numbered from 1 to rank. HDF5 uses C storage conventions, assuming that the last listed dimension is the fastest-changing dimension and the first-listed dimension is the slowest changing."
-rw-r--r--src/hdf5-file.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/hdf5-file.c b/src/hdf5-file.c
index 4bc39449..2a99939c 100644
--- a/src/hdf5-file.c
+++ b/src/hdf5-file.c
@@ -91,13 +91,13 @@ int hdfile_set_image(struct hdfile *f, const char *path)
int hdfile_get_width(struct hdfile *f)
{
- return f->nx;
+ return f->ny;
}
int hdfile_get_height(struct hdfile *f)
{
- return f->ny;
+ return f->nx;
}
@@ -242,10 +242,10 @@ int hdf5_write(const char *filename, const void *data,
return 1;
}
- size[0] = width;
- size[1] = height;
- max_size[0] = width;
- max_size[1] = height;
+ size[0] = height;
+ size[1] = width;
+ max_size[0] = height;
+ max_size[1] = width;
sh = H5Screate_simple(2, size, max_size);
dh = H5Dcreate(gh, "data", type, sh,
@@ -401,8 +401,8 @@ int hdf5_read(struct hdfile *f, struct image *image, int satcorr,
uint16_t *flags;
hid_t mask_dh;
- image->height = f->nx;
- image->width = f->ny;
+ image->width = hdfile_get_width(f);
+ image->height = hdfile_get_height(f);
buf = malloc(sizeof(float)*f->nx*f->ny);