-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathh5convert_fromshell.i
52 lines (44 loc) · 1.23 KB
/
h5convert_fromshell.i
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// to be called by the shell script h5convert
// usefull for mass conversion and easy access from
// the shell
require,"util_fr.i";
require,"hdf5.i";
func h5convert_help(void)
{
write,"h5convert [-v# -f -p -h] file1 file2 ...";
write," -v#: verbose level (0,1,2)";
write," -p: in place (output name = input name)";
write," -f: force processing file, even though it should not";
write," -h: this help";
write,"files can use widlcards";
quit;
}
// progress args
a = get_argv();
w = (a == "h5convert_fromshell.i");
if (where(w)(1)==numberof(a)) h5convert_help;
// keep only flags and files
a = a (where(w)(1)+1:);
// find flags
w = strglob("-*",a);
if (anyof(w)) {
flags = a(where(w));
if (anyof(flags=="-v0")) verbose=0;
if (anyof(flags=="-v1")) verbose=1;
if (anyof(flags=="-v2")) verbose=2;
if (anyof(flags=="-f")) force=1;
if (anyof(flags=="-p")) inplace=1;
if (anyof(flags=="-h")) h5convert_help;
}
// files to process (can have wildcards)
w = where(w==0);
if (numberof(w)==0) h5convert_help;
files = a(w);
filesv = [];
// build string vector with all files
for (i=1;i<=numberof(files);i++) {
grow,filesv,findfiles(files(i));
}
// do it
h5old2new,filesv,inplace=inplace,verbose=verbose,force=force;
quit