Coder Social home page Coder Social logo

wangliang1989 / sacio_fortran Goto Github PK

View Code? Open in Web Editor NEW
7.0 7.0 2.0 36 KB

provides a Fortran 90 module named `sacio` for reading and writting evenly-spaced SAC binary format files

License: Apache License 2.0

Makefile 1.40% Fortran 98.60%
geophysics sac seismology

sacio_fortran's People

Contributors

wangliang1989 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

ogweno core-man

sacio_fortran's Issues

SAC files are not compatitble with "saclst" command or other C library

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!

撰写风格问题

  1. 字母大小写

Fortran 是大小写不敏感语言,一些老一辈的程序员对保留字习惯使用大写

  1. 锁进问题

Fortran 的习惯是子程序内、contains 语句后等都要锁进:

subroutine program
blabla
end subroutine

contains
blabla

以上习惯一般都是老一辈程序员的习惯,目前fortran官网依然保持,那么应该怎样更好呢?

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.