Comments (10)
@certik Nice examples. I think it could be easily combine with something like
real, allocatable :: a(:)
type(File) :: f
f = File('log.txt')
call f%read(a)
call f%close()
Float, double-precision,integer,... could be then supported.
from stdlib.
I think these are great functions to start with and figure out the workflow. Good to go ahead as far as I'm concerened.
What module would this belong to? stdlib_io
in io.f90
?
from stdlib.
I think we agreed to prefix modules with stdlib_
.
The io
module (stdlib_io.f90
) might be a good name for it. NumPy has this directly in the numpy
namespace, but I think we should have things in modules, not the global stdlib
namespace. Because we can always later expose some frequently used functionality in stdlib.f90
directly, but if we put it there now, it will be hard to remove later, as it would break people's code.
There is also scipy.io
, with loadmat that loads Matlab's file.
So stdlib_io.f90
works.
from stdlib.
@certik Correct, I just re-read #9. module stdlib_io
in stdlib_io.f90
is good.
from stdlib.
@jvdp1 Indeed, plain savetxt
and loadtxt
will be useful on their own, and the File
derived type (a higher level abstraction) can later figure out if and how to use these more basic building blocks.
from stdlib.
I sent a PR in #23.
from stdlib.
We can also get some inspiration from this csv read/write one of mine: https://github.com/jacobwilliams/fortran-csv-module
from stdlib.
@jacobwilliams good point, I created a standalone issue #24 for CSV. You are right that it is related, as in NumPy one can use genfromtxt to read CSV.
from stdlib.
Very nice start. What do you think of adding some optional functionalities like the following?
- Header handling (we might need to define a "comment" character that introduces the header):
- when reading simply detect it and store it somewhere;
- when writing add it and number the columns automatically (very useful for writing plotting scripts).
- column sorting or indexing using, for example, ODERPACK (if there is no licence clash).
I found very useful (actually necessary) both them but I don't know how much general interest there is.
from stdlib.
@epagone, yes, we can add the header
, footer
, comments
, newline
, delimiter
arguments for savetxt
that NumPy has. We can also do the fmt
argument and pass in Fortran formatting string.
All these arguments go after the fname
and X
arguments, so I think we can add them in subsequent PRs after #23 is merged.
Can you elaborate on the column sorting or indexing using
? I don't think NumPy does that. What prevents the user to sort the data before calling savetxt
?
from stdlib.
Related Issues (20)
- `string_intrinsic (Subprocess aborted)` failed HOT 7
- `bits()` in `bitset_type` returned a non-zero value even though no value is set. HOT 1
- Support for linear algebra HOT 6
- Hashtable write error on exit HOT 7
- use stdlib_math, only : gcd HOT 4
- The file src/stdlib_hashmap_chaining.f90 and two others are set as executable HOT 1
- Support for I/O of standard formats HOT 10
- Memory mapped features HOT 9
- Add `.gitignore` to `stdlib-fpm` deployment for generated test files HOT 1
- hash_functions test fails on i386: `Segmentation fault - invalid memory reference`
- Request to upgrade Intel-classic compiler in macOS CI
- Add `library` configuration to `stdlib-fpm`
- Massive slow down in docs generation HOT 4
- Unexpected performance of hash maps HOT 8
- python preprocessor HOT 11
- add topic tags `lapack`, `blas`, `linear-algebra` HOT 1
- Improve descriptions of rotm, rotmg, stdlib_srotm, stdlib_srotmg
- Don't repeat names of procedures in descriptions
- stdlib_io_npy, FPM and Rank > 4 HOT 5
- Missing documentation for `LAPACK`-related functions HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stdlib.