Commit Graph

23 Commits

Author SHA1 Message Date
Wirawan Purwanto
d7a65386a3 * Fortran binary file: Added bulk_read_array1 method for quick reading of
array of (uniform-type) Fortran records.
2014-08-19 11:06:08 -04:00
Wirawan Purwanto
723f1a4fc1 * Added __enter__/__exit__ method for use with python 2.5's "with" statement. 2014-08-02 21:32:34 -04:00
Wirawan Purwanto
f49d166a77 * wpylib.iofmt.fortbin: Added fortran_types class to manage and analyze
Fortran datatypes.

  First edition contains tool to estimate the size of datatypes,
  and size of file records (or sequence of records).
2013-06-26 16:24:19 -05:00
Wirawan Purwanto
d70bcf2149 * In text_output methods, do the required action iff self.out is not None. 2012-06-13 19:35:06 -04:00
Wirawan Purwanto
ad841e0b90 * text_input.read_items(): added option end_line_match' and last_line_match'
(mutually exclusive options) to allow the dataset reading to end upon
  encountering certain text pattern (or a more complicated match, if we
  specify a function for the option value).
  These options can be used to work with the `maxcount' option; the shortest
  of the two (maxcount records read first, or end/last_line_match finds a
  match) will end the reading of the dataset.
2012-04-17 11:03:29 -04:00
Wirawan Purwanto
606214eb66 * Changing all isinstance(STUFF, str)' to isinstance(STUFF, basestring)'
for future-proofing this code.
2012-04-13 17:10:32 -04:00
Wirawan Purwanto
6656d3d5e3 * In module text_input: Added head() and tail() to emulate the basic
behavior of UNIX commands with the same name.
  Output lines are already split into a list of strings.
2012-03-19 16:53:23 -04:00
Wirawan Purwanto
f8a101fbe9 * Added comment_char option for text_input object creation.
* Memory leak bugfix: Use instance method weakref.
2012-02-15 23:02:11 -05:00
Wirawan Purwanto
3698671bed * Added: fortran_bin_file.peek_next_rec_len() to fetch the next record length
while not advancing the read pointer to that record yet.
2012-01-30 16:04:17 -05:00
wirawan
81e2ada60c * Allow comment character to be changed from "#" using the
instance.comment_char attribute.
2011-09-16 21:21:23 +00:00
wirawan
c675077620 * Introducing self.lineno counter for line numbers (including the blanks
and comment lines).
2011-09-05 19:09:21 +00:00
wirawan
3f3c49df94 * Added file mode for file creation (default: "w"). 2011-09-02 15:07:47 +00:00
wirawan
3b522de2d6 * Added text_input.close() method. 2011-08-31 20:28:30 +00:00
wirawan
7d37c0b6ba * Internal upgrade to factor out reusable parts (for future upgrades). 2011-08-31 20:27:31 +00:00
wirawan
ad73b5af7f * Added set_next_proc() method to set which procedure should be called when
"next()" method dispatcher is called.

  This approach should get rid of the problem with circular reference which
  causes the text_input instance not be erasable because of strong reference
  to `self' in `self.next.im_self'.
2011-06-03 21:34:32 +00:00
wirawan
9e1c6f5868 * Commenting out the verbose printout. I think the module is robust now. 2011-05-12 14:51:02 +00:00
wirawan
90f1603499 * Added text_output as a converse facility to print out text stream to
a file.
  Useful for a shortened output statements in the code, and also for
  reroutable output (to stdout? to file? to both?) and flexible output
  kind.
2011-05-11 20:28:51 +00:00
wirawan
96d1f9afd7 * Upgrade to allow reading complex-valued data directly.
Please see the documentation of text_input.read_items for more detail.
2010-09-30 17:23:34 +00:00
wirawan
cae9cabdea * Simple text input reader. Imported from pyqmc.utils.text_input . 2010-09-27 19:54:05 +00:00
wirawan
c87ba9dbfa * Minor updates. 2010-05-28 18:43:14 +00:00
wirawan
69592e9a8f * Added writing facility. Still largely untested. 2010-02-19 18:39:17 +00:00
wirawan
15baf746f9 * Ignore all compiled python modules. 2010-02-11 02:29:51 +00:00
wirawan
21e85704aa * Initial version of Fortran binary file reader.
Later a writing facility can be added as well.
* Note that this module is intended only for reading/writing
  Fortran-generated files.
  It is not recommended for any other purpose because of its terrible feature:
  no metadata, no description whatsoever.
2010-02-08 21:49:54 +00:00