From d0318a7264be8311ed348d674de36fbc2190fa83 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 5 May 2023 11:56:58 +0200 Subject: indexamajig: Catch common error '-i input.h5' --- src/indexamajig.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/indexamajig.c') diff --git a/src/indexamajig.c b/src/indexamajig.c index bd89db32..358ba5a3 100644 --- a/src/indexamajig.c +++ b/src/indexamajig.c @@ -864,6 +864,7 @@ int main(int argc, char *argv[]) struct asdf_options *asdf_opts = NULL; double wl_from_dt; double clen_from_dt; + int err; /* Defaults for "top level" arguments */ args.filename = NULL; @@ -1167,6 +1168,20 @@ int main(int argc, char *argv[]) return 1; } + if ( is_hdf5_file(args.filename, &err) ) { + ERROR("Your input file appears to be an HDF5 file.\n"); + ERROR("The input file should be a list of data files, not the " + "data file itself.\n"); + ERROR("If you have only one input file, try the following:\n"); + ERROR(" echo %s > files.lst\n", args.filename); + ERROR(" indexamajig -i files.lst -o %s -g %s ...\n", + args.outfile, args.geom_filename); + return 1; + } else if ( err ) { + ERROR("Couldn't open '%s'\n", args.filename); + return 1; + } + /* Open input */ if ( args.filename != NULL ) { if ( strcmp(args.filename, "-") == 0 ) { -- cgit v1.2.3