~ubuntu-branches/ubuntu/natty/pytables/natty-updates

« back to all changes in this revision

Viewing changes to doc/html/x6885.html

  • Committer: Bazaar Package Importer
  • Author(s): Alexandre Fayolle
  • Date: 2006-06-28 10:45:03 UTC
  • mfrom: (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 5.
  • Revision ID: james.westby@ubuntu.com-20060628104503-cc251q5o5j3e2k10
  * Fixed call to pyversions in debian/rules which failed on recent versions 
    of pyversions
  * Fixed clean rule in debian/rules which left the stamp files behind
  * Acknowledge NMU
  * Added Alexandre Fayolle to uploaders

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
 
2
<HTML
 
3
><HEAD
 
4
><TITLE
 
5
>ptrepack</TITLE
 
6
><META
 
7
NAME="GENERATOR"
 
8
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
 
9
REL="HOME"
 
10
TITLE="PyTables User's Guide"
 
11
HREF="index.html"><LINK
 
12
REL="UP"
 
13
TITLE="Utilities"
 
14
HREF="a6829.html"><LINK
 
15
REL="PREVIOUS"
 
16
TITLE="Utilities"
 
17
HREF="a6829.html"><LINK
 
18
REL="NEXT"
 
19
TITLE="nctoh5"
 
20
HREF="x6938.html"></HEAD
 
21
><BODY
 
22
CLASS="sect1"
 
23
BGCOLOR="#FFFFFF"
 
24
TEXT="#000000"
 
25
LINK="#0000FF"
 
26
VLINK="#840084"
 
27
ALINK="#0000FF"
 
28
><DIV
 
29
CLASS="NAVHEADER"
 
30
><TABLE
 
31
SUMMARY="Header navigation table"
 
32
WIDTH="100%"
 
33
BORDER="0"
 
34
CELLPADDING="0"
 
35
CELLSPACING="0"
 
36
><TR
 
37
><TH
 
38
COLSPAN="3"
 
39
ALIGN="center"
 
40
><SPAN
 
41
CLASS="markup"
 
42
>PyTables</SPAN
 
43
> User's Guide: Hierarchical datasets in Python - Release 1.3.2</TH
 
44
></TR
 
45
><TR
 
46
><TD
 
47
WIDTH="10%"
 
48
ALIGN="left"
 
49
VALIGN="bottom"
 
50
><A
 
51
HREF="a6829.html"
 
52
ACCESSKEY="P"
 
53
>Prev</A
 
54
></TD
 
55
><TD
 
56
WIDTH="80%"
 
57
ALIGN="center"
 
58
VALIGN="bottom"
 
59
>Appendix C. Utilities</TD
 
60
><TD
 
61
WIDTH="10%"
 
62
ALIGN="right"
 
63
VALIGN="bottom"
 
64
><A
 
65
HREF="x6938.html"
 
66
ACCESSKEY="N"
 
67
>Next</A
 
68
></TD
 
69
></TR
 
70
></TABLE
 
71
><HR
 
72
ALIGN="LEFT"
 
73
WIDTH="100%"></DIV
 
74
><DIV
 
75
CLASS="sect1"
 
76
><H1
 
77
CLASS="sect1"
 
78
><A
 
79
NAME="sectionC.2"
 
80
>C.2. ptrepack</A
 
81
></H1
 
82
><A
 
83
NAME="ptrepackDescr"
 
84
></A
 
85
><P
 
86
>This utility is a very powerful one and lets you copy any
 
87
            leaf, group or complete subtree into another file. During
 
88
            the copy process you are allowed to change the filter
 
89
            properties if you want so. Also, in the case of duplicated
 
90
            pathnames, you can decide if you want to overwrite already
 
91
            existing nodes on the destination file. Generally
 
92
            speaking, <SAMP
 
93
CLASS="computeroutput"
 
94
>ptrepack</SAMP
 
95
> can be useful in may
 
96
            situations, like replicating a subtree in another file,
 
97
            change the filters in objects and see how affect this to
 
98
            the compression degree or I/O performance, consolidating
 
99
            specific data in repositories or even <SPAN
 
100
CLASS="emphasis"
 
101
><I
 
102
CLASS="emphasis"
 
103
>importing</I
 
104
></SPAN
 
105
>
 
106
            generic <SAMP
 
107
CLASS="computeroutput"
 
108
>HDF5</SAMP
 
109
> files and create true
 
110
            <SAMP
 
111
CLASS="computeroutput"
 
112
>PyTables</SAMP
 
113
> counterparts.
 
114
          </P
 
115
><DIV
 
116
CLASS="sect2"
 
117
><H2
 
118
CLASS="sect2"
 
119
><A
 
120
NAME="subsectionC.2.1"
 
121
>C.2.1. Usage</A
 
122
></H2
 
123
><P
 
124
>For instructions on how to use it, just pass the
 
125
              <SAMP
 
126
CLASS="computeroutput"
 
127
>-h</SAMP
 
128
> flag to the command:
 
129
 
 
130
              <PRE
 
131
CLASS="screen"
 
132
>&#13;$ ptrepack -h
 
133
              </PRE
 
134
>
 
135
 
 
136
              to see the message usage:
 
137
 
 
138
              <PRE
 
139
CLASS="screen"
 
140
>&#13;usage: ptrepack [-h] [-v] [-o] [-R start,stop,step] [--non-recursive]
 
141
  [--dest-title=title] [--dont-copyuser-attrs] [--overwrite-nodes]
 
142
  [--complevel=(0-9)] [--complib=lib] [--shuffle=(0|1)]
 
143
  [--fletcher32=(0|1)] [--keep-source-filters] 
 
144
  sourcefile:sourcegroup destfile:destgroup
 
145
 -h -- Print usage message.
 
146
 -v -- Show more information.
 
147
 -o -- Overwite destination file.
 
148
 -R RANGE -- Select a RANGE of rows (in the form "start,stop,step")
 
149
     during the copy of *all* the leaves.
 
150
 --non-recursive -- Do not do a recursive copy. Default is to do it.
 
151
 --dest-title=title -- Title for the new file (if not specified,
 
152
     the source is copied).
 
153
 --dont-copy-userattrs -- Do not copy the user attrs (default is to do it)
 
154
 --overwrite-nodes -- Overwrite destination nodes if they exist. Default is
 
155
     to not overwrite them.
 
156
 --complevel=(0-9) -- Set a compression level (0 for no compression, which
 
157
     is the default).
 
158
 --complib=lib -- Set the compression library to be used during the copy.
 
159
     lib can be set to "zlib", "lzo", "ucl" or "bzip2". Defaults to "zlib".
 
160
 --shuffle=(0|1) -- Activate or not the shuffling filter (default is active
 
161
     if complevel&#62;0).
 
162
 --fletcher32=(0|1) -- Whether to activate or not the fletcher32 filter (not
 
163
     active by default).
 
164
 --keep-source-filters -- Use the original filters in source files. The
 
165
     default is not doing that if any of --complevel, --complib, --shuffle
 
166
     or --fletcher32 option is specified.
 
167
              </PRE
 
168
>
 
169
            </P
 
170
></DIV
 
171
><DIV
 
172
CLASS="sect2"
 
173
><H2
 
174
CLASS="sect2"
 
175
><A
 
176
NAME="subsectionC.2.2"
 
177
>C.2.2. A small tutorial on <SPAN
 
178
CLASS="markup"
 
179
>ptrepack</SPAN
 
180
></A
 
181
></H2
 
182
><P
 
183
>Imagine that we have ended the tutorial 1 (see the
 
184
              output of <SAMP
 
185
CLASS="computeroutput"
 
186
>examples/tutorial1-1.py</SAMP
 
187
>), and we
 
188
              want to copy our reduced data (i.e. those datasets that
 
189
              hangs from the <SAMP
 
190
CLASS="computeroutput"
 
191
>/column</SAMP
 
192
> group) to another
 
193
              file. First, let's remember the content of the
 
194
              <SAMP
 
195
CLASS="computeroutput"
 
196
>examples/tutorial1.h5</SAMP
 
197
>:
 
198
 
 
199
              <PRE
 
200
CLASS="screen"
 
201
>&#13;$ ptdump tutorial1.h5
 
202
Filename: 'tutorial1.h5' Title: 'Test file' , Last modif.: 'Fri Feb  6
 
203
  19:33:28 2004' , rootUEP='/', filters=Filters(), Format version: 1.2
 
204
/ (Group) 'Test file'
 
205
/columns (Group) 'Pressure and Name'
 
206
/columns/name (Array(3,)) 'Name column selection'
 
207
/columns/pressure (Array(3,)) 'Pressure column selection'
 
208
/detector (Group) 'Detector information'
 
209
/detector/readout (Table(10L,)) 'Readout example'
 
210
              </PRE
 
211
>
 
212
 
 
213
              Now, copy the <SAMP
 
214
CLASS="computeroutput"
 
215
>/columns</SAMP
 
216
> to other
 
217
              non-existing file. That's easy:
 
218
 
 
219
              <PRE
 
220
CLASS="screen"
 
221
>&#13;$ ptrepack tutorial1.h5:/columns reduced.h5
 
222
              </PRE
 
223
>
 
224
              That's all. Let's see the contents of the newly created
 
225
              <SAMP
 
226
CLASS="computeroutput"
 
227
>reduced.h5</SAMP
 
228
> file:
 
229
 
 
230
              <PRE
 
231
CLASS="screen"
 
232
>&#13;$ ptdump reduced.h5
 
233
Filename: 'reduced.h5' Title: '' , Last modif.: 'Fri Feb 20 15:26:47 2004' ,
 
234
 rootUEP='/', filters=Filters(), Format version: 1.2
 
235
/ (Group) ''
 
236
/name (Array(3,)) 'Name column selection'
 
237
/pressure (Array(3,)) 'Pressure column selection'
 
238
              </PRE
 
239
>
 
240
              so, you have copied the children of
 
241
              <SAMP
 
242
CLASS="computeroutput"
 
243
>/columns</SAMP
 
244
> group into the <SPAN
 
245
CLASS="emphasis"
 
246
><I
 
247
CLASS="emphasis"
 
248
>root</I
 
249
></SPAN
 
250
> of
 
251
              the <SAMP
 
252
CLASS="computeroutput"
 
253
>reduced.h5</SAMP
 
254
> file.
 
255
            </P
 
256
><P
 
257
>Now, you suddenly realized that what you intended to do
 
258
              was to copy all the hierarchy, the group
 
259
              <SAMP
 
260
CLASS="computeroutput"
 
261
>/columns</SAMP
 
262
> itself included. You can do that
 
263
              by just specifying the destination group:
 
264
 
 
265
              <PRE
 
266
CLASS="screen"
 
267
>&#13;$ ptrepack tutorial1.h5:/columns reduced.h5:/columns
 
268
ptdump reduced.h5
 
269
Filename: 'reduced.h5' Title: '' , Last modif.: 'Fri Feb 20 15:39:15 2004' ,
 
270
 rootUEP='/', filters=Filters(), Format version: 1.2
 
271
/ (Group) ''
 
272
/name (Array(3,)) 'Name column selection'
 
273
/pressure (Array(3,)) 'Pressure column selection'
 
274
/columns (Group) ''
 
275
/columns/name (Array(3,)) 'Name column selection'
 
276
/columns/pressure (Array(3,)) 'Pressure column selection'
 
277
              </PRE
 
278
>
 
279
              OK. Much better. But you want to get rid of the existing
 
280
              nodes on the new file. You can achieve this by adding
 
281
              the -o flag:
 
282
 
 
283
              <PRE
 
284
CLASS="screen"
 
285
>&#13;$ ptrepack -o tutorial1.h5:/columns reduced.h5:/columns
 
286
$ ptdump reduced.h5
 
287
Filename: 'reduced.h5' Title: '' , Last modif.: 'Fri Feb 20 15:41:57 2004' ,
 
288
 rootUEP='/', filters=Filters(), Format version: 1.2
 
289
/ (Group) ''
 
290
/columns (Group) ''
 
291
/columns/name (Array(3,)) 'Name column selection'
 
292
/columns/pressure (Array(3,)) 'Pressure column selection'
 
293
              </PRE
 
294
>
 
295
              where you can see how the old contents of the
 
296
              <SAMP
 
297
CLASS="computeroutput"
 
298
>reduced.h5</SAMP
 
299
> file has been overwritten.
 
300
            </P
 
301
><P
 
302
>You can copy just one single node in the repacking
 
303
              operation and change its name in destination:
 
304
 
 
305
              <PRE
 
306
CLASS="screen"
 
307
>&#13;$ ptrepack tutorial1.h5:/detector/readout reduced.h5:/rawdata
 
308
$ ptdump reduced.h5
 
309
Filename: 'reduced.h5' Title: '' , Last modif.: 'Fri Feb 20 15:52:22 2004',
 
310
 rootUEP='/', filters=Filters(), Format version: 1.2
 
311
/ (Group) ''
 
312
/rawdata (Table(10L,)) 'Readout example'
 
313
/columns (Group) ''
 
314
/columns/name (Array(3,)) 'Name column selection'
 
315
/columns/pressure (Array(3,)) 'Pressure column selection'
 
316
              </PRE
 
317
>
 
318
              where the <SAMP
 
319
CLASS="computeroutput"
 
320
>/detector/readout</SAMP
 
321
> has been copied
 
322
              to <SAMP
 
323
CLASS="computeroutput"
 
324
>/rawdata</SAMP
 
325
> in destination.
 
326
            </P
 
327
><P
 
328
>We can change the filter properties as well:
 
329
              <PRE
 
330
CLASS="screen"
 
331
>&#13;$ ptrepack --complevel=1 tutorial1.h5:/detector/readout reduced.h5:/rawdata
 
332
Problems doing the copy from 'tutorial1.h5:/detector/readout' to
 
333
'reduced.h5:/rawdata'
 
334
The error was --&#62; exceptions.ValueError: The destination
 
335
 (/rawdata (Table(10L,)) 'Readout example') already exists.
 
336
 Assert the overwrite parameter if you really want to overwrite it.
 
337
The destination file looks like:
 
338
Filename: 'reduced.h5' Title: ''; Last modif.: 'Fri Feb 20 15:52:22 2004';
 
339
 rootUEP='/'; filters=Filters(), Format version: 1.2
 
340
/ (Group) ''
 
341
/rawdata (Table(10L,)) 'Readout example'
 
342
/columns (Group) ''
 
343
/columns/name (Array(3,)) 'Name column selection'
 
344
/columns/pressure (Array(3,)) 'Pressure column selection'
 
345
 
 
346
Traceback (most recent call last):
 
347
  File "../utils/ptrepack", line 358, in ?
 
348
    start=start, stop=stop, step=step)
 
349
  File "../utils/ptrepack", line 111, in copyLeaf
 
350
    raise RuntimeError, "Please, check that the node names are not
 
351
  duplicated in destination, and if so, add the --overwrite-nodes flag
 
352
  if desired."
 
353
RuntimeError: Please, check that the node names are not duplicated in
 
354
 destination, and if so, add the --overwrite-nodes flag if desired.
 
355
            </PRE
 
356
>
 
357
              ooops!. We ran into problems: we forgot that
 
358
              <SAMP
 
359
CLASS="computeroutput"
 
360
>/rawdata</SAMP
 
361
> pathname already existed
 
362
              in destination file. Let's add the
 
363
              <SAMP
 
364
CLASS="computeroutput"
 
365
>--overwrite-nodes</SAMP
 
366
>, as the verbose
 
367
              error suggested:
 
368
              <PRE
 
369
CLASS="screen"
 
370
>&#13;$ ptrepack --overwrite-nodes --complevel=1 tutorial1.h5:/detector/readout 
 
371
reduced.h5:/rawdata
 
372
$ ptdump reduced.h5
 
373
Filename: 'reduced.h5' Title: ''; Last modif.: 'Fri Feb 20 16:02:20 2004';
 
374
 rootUEP='/'; filters=Filters(), Format version: 1.2
 
375
/ (Group) ''
 
376
/rawdata (Table(10L,), shuffle, zlib(1)) 'Readout example'
 
377
/columns (Group) ''
 
378
/columns/name (Array(3,)) 'Name column selection'
 
379
/columns/pressure (Array(3,)) 'Pressure column selection'
 
380
              </PRE
 
381
>
 
382
              you can check how the filter properties has been changed
 
383
              for the <SAMP
 
384
CLASS="computeroutput"
 
385
>/rawdata</SAMP
 
386
> table. Check as the other
 
387
              nodes still exists.
 
388
            </P
 
389
><P
 
390
>Finally, let's copy a <SPAN
 
391
CLASS="emphasis"
 
392
><I
 
393
CLASS="emphasis"
 
394
>slice</I
 
395
></SPAN
 
396
> of the
 
397
              <SAMP
 
398
CLASS="computeroutput"
 
399
>readout</SAMP
 
400
> table in origin to destination,
 
401
              under a new group called <SAMP
 
402
CLASS="computeroutput"
 
403
>/slices</SAMP
 
404
> and with
 
405
              the name, for example, <SAMP
 
406
CLASS="computeroutput"
 
407
>aslice</SAMP
 
408
>:
 
409
              <PRE
 
410
CLASS="screen"
 
411
>&#13;$ ptrepack -R1,8,3 tutorial1.h5:/detector/readout reduced.h5:/slices/aslice
 
412
$ ptdump reduced.h5
 
413
Filename: 'reduced.h5' Title: ''; Last modif.: 'Fri Feb 20 16:17:13 2004';
 
414
 rootUEP='/'; filters=Filters(); Format version: 1.2
 
415
/ (Group) ''
 
416
/rawdata (Table(10L,), shuffle, zlib(1)) 'Readout example'
 
417
/columns (Group) ''
 
418
/columns/name (Array(3,)) 'Name column selection'
 
419
/columns/pressure (Array(3,)) 'Pressure column selection'
 
420
/slices (Group) ''
 
421
/slices/aslice (Table(3L,)) 'Readout example'
 
422
              </PRE
 
423
>
 
424
              note how only 3 rows of the original
 
425
              <SAMP
 
426
CLASS="computeroutput"
 
427
>readout</SAMP
 
428
> table has been copied to the new
 
429
              <SAMP
 
430
CLASS="computeroutput"
 
431
>aslice</SAMP
 
432
> destination. Note as well how the
 
433
              previously inexistent <SAMP
 
434
CLASS="computeroutput"
 
435
>slices</SAMP
 
436
> group has been
 
437
              created in the same operation.
 
438
            </P
 
439
></DIV
 
440
></DIV
 
441
><DIV
 
442
CLASS="NAVFOOTER"
 
443
><HR
 
444
ALIGN="LEFT"
 
445
WIDTH="100%"><TABLE
 
446
SUMMARY="Footer navigation table"
 
447
WIDTH="100%"
 
448
BORDER="0"
 
449
CELLPADDING="0"
 
450
CELLSPACING="0"
 
451
><TR
 
452
><TD
 
453
WIDTH="33%"
 
454
ALIGN="left"
 
455
VALIGN="top"
 
456
><A
 
457
HREF="a6829.html"
 
458
ACCESSKEY="P"
 
459
>Prev</A
 
460
></TD
 
461
><TD
 
462
WIDTH="34%"
 
463
ALIGN="center"
 
464
VALIGN="top"
 
465
><A
 
466
HREF="index.html"
 
467
ACCESSKEY="H"
 
468
>Home</A
 
469
></TD
 
470
><TD
 
471
WIDTH="33%"
 
472
ALIGN="right"
 
473
VALIGN="top"
 
474
><A
 
475
HREF="x6938.html"
 
476
ACCESSKEY="N"
 
477
>Next</A
 
478
></TD
 
479
></TR
 
480
><TR
 
481
><TD
 
482
WIDTH="33%"
 
483
ALIGN="left"
 
484
VALIGN="top"
 
485
>Utilities</TD
 
486
><TD
 
487
WIDTH="34%"
 
488
ALIGN="center"
 
489
VALIGN="top"
 
490
><A
 
491
HREF="a6829.html"
 
492
ACCESSKEY="U"
 
493
>Up</A
 
494
></TD
 
495
><TD
 
496
WIDTH="33%"
 
497
ALIGN="right"
 
498
VALIGN="top"
 
499
>nctoh5</TD
 
500
></TR
 
501
></TABLE
 
502
></DIV
 
503
></BODY
 
504
></HTML
 
505
>
 
 
b'\\ No newline at end of file'