wangliang1989 / sacio_fortran Goto Github PK
View Code? Open in Web Editor NEWprovides a Fortran 90 module named `sacio` for reading and writting evenly-spaced SAC binary format files
License: Apache License 2.0
provides a Fortran 90 module named `sacio` for reading and writting evenly-spaced SAC binary format files
License: Apache License 2.0
Hi Liang,
I've created a SAC file by using your code. But when I use saclst
to check some parameters, it raises an error:
sacio: Actual file size 19832 != expected file size: 39032 [npts: 4800]
I think the reason is that Fortran's character
is not fully compatible with C's char *
. In C, there should be an '\0'
at the end of each char arrays to indicate its end.
To solve this problem, I think one way is to add a subroutine in the source file:
subroutine create_c_char(mychar)
use iso_c_binding,only : c_null_char
implicit none
character(len=*),intent(inout) :: mychar
mychar = trim(mychar) // c_null_char
end subroutine
Before calling sacio_writesac/write_header, you could call this subroutine to convert all character arrays in sachead to C's char*. In addition, the length of each character array, like kstnm should have length 9 instead of 8.
Thanks!
Fortran 是大小写不敏感语言,一些老一辈的程序员对保留字习惯使用大写
Fortran 的习惯是子程序内、contains 语句后等都要锁进:
subroutine program
blabla
end subroutine
contains
blabla
以上习惯一般都是老一辈程序员的习惯,目前fortran官网依然保持,那么应该怎样更好呢?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.