Giter Site home page Giter Site logo

fortranformat's Introduction

FORTRAN format interpreter for Python
-------------------------------------    

Generates text from a Python list of variables or will read a line of text into Python variables according  to the FORTRAN format statement passed.

Licensed under the MIT license

The library is extensively unit-tested (but not yet extensively user-tested, please report bugs at https://bitbucket.org/brendanarnold/py-fortranformat/issues) against the Intel FORTRAN compiler on a Linux platform. Differences between platforms/compilers are generally minor.

The following is a quistart, full docs are found at the project page wiki  at https://bitbucket.org/brendanarnold/py-fortranformat/wiki/Home

To read Fortran records,

>>> import fortranformat as ff
>>> header_line = FortranRecordReader('(A15, A15, A15)')
>>> header_line.read('              x              y              z')
['              x', '              y', '              z']
>>> line = FortranRecordReader('(3F15.3)')
>>> line.read('          1.000          0.000          0.500')
[1.0, 0.0, 0.5]
>>> line.read('          1.100          0.100          0.600')
[1.1, 0.1, 0.6]
>>>

To write Fortran records,

>>> import fortranformat as ff
>>> header_line = FortranRecordWriter('(A15, A15, A15)')
>>> header_line.write(['x', 'y', 'z'])
'              x              y              z'
>>> line = FortranRecordWriter('(3F15.3)')
>>> line.write([1.0, 0.0, 0.5])
'          1.000          0.000          0.500'
>>> line.write([1.1, 0.1, 0.6])
'          1.100          0.100          0.600'


More details on usage, in particlar the configuration options are
found at,

https://bitbucket.org/brendanarnold/py-fortranformat/wiki/Home


Notes
-----

 * At present the library mimics the IO of the Intel FORTRAN compiler
   v.9.1 run on a Linux system. Differences to other FORTRAN compilers
   and platforms are generally minor.
 * The library should run on Python versions from at least 2.3 up to
   3 and above.


Bugs
----

Although the library has a large body of automatically generated test
code behind it, it has not been extensively user tested. Bug reports are
welcome!

Please report bugs to,

https://bitbucket.org/brendanarnold/py-fortranformat/issues

Changelog
---------

Version 0.2.3
 * Fixed issue 10 - Edit descriptor reversion now starts a new record

fortranformat's People

Contributors

keweiyao avatar

Stargazers

 avatar  avatar Flaw avatar

Watchers

Yury Rogovsky avatar  avatar

Forkers

kayya886

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.