{"id":27302706,"url":"https://github.com/savage13/sacio","last_synced_at":"2025-04-12T02:48:20.769Z","repository":{"id":45965947,"uuid":"199166045","full_name":"savage13/sacio","owner":"savage13","description":"sacio library","archived":false,"fork":false,"pushed_at":"2024-05-30T15:54:47.000Z","size":842,"stargazers_count":8,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T11:54:27.026Z","etag":null,"topics":["c","iris","sac","sacio-library","seismic"],"latest_commit_sha":null,"homepage":"https://savage13.github.io/sacio/","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/savage13.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"License","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-07-27T13:06:19.000Z","updated_at":"2024-12-27T11:46:48.000Z","dependencies_parsed_at":"2025-04-11T11:18:39.394Z","dependency_job_id":"c39724a7-eff5-4472-9b1b-70a83fa89900","html_url":"https://github.com/savage13/sacio","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/savage13%2Fsacio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/savage13%2Fsacio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/savage13%2Fsacio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/savage13%2Fsacio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/savage13","download_url":"https://codeload.github.com/savage13/sacio/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248497809,"owners_count":21113984,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","iris","sac","sacio-library","seismic"],"created_at":"2025-04-12T02:48:20.084Z","updated_at":"2025-04-12T02:48:20.763Z","avatar_url":"https://github.com/savage13.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"libsacio Documentation\n======================\n\n[![Build Status](https://travis-ci.com/savage13/sacio.svg?branch=master)](https://travis-ci.com/savage13/sacio)\n\nOverview\n--------\n\nThe sacio library, libsacio, provides an interface to read and write sac files and manipulate their contents.\n\nSAC Files\n---------\nSAC (Seismic Analysis Code) files are binary or alphanumeric data files for storing time series data, primarily ground motion recorded by seismometers. Format of the SAC file consists of a metadata header followed by the ground motion stored as equally or unequally spaced in time. The data section may also be the Fourier Transform of an input ground motion or a 2D data set.\n\n\nDocumentation\n-------------\n\n[libsacio Documention](https://savage13.github.io/sacio/)\n\nIRIS-SAC Relationship\n---------------------\n\nThe code and library here was originally written and licensed under the [2-Clause BSD License](https://choosealicense.com/licenses/bsd-2-clause/) and subsequently included for the [IRIS-SAC distribution](http://ds.iris.edu/ds/nodes/dmc/forms/sac/). This distribution also includes other, essentially, public domain knowledge on the sac format.  The code found here is the same included within the IRIS-SAC distribution, but does **not** included the licensed code from LLNL/IRIS; this is primarily the processing, filtering, and data operations. If you require the SAC program and this functionality, make that request to [IRIS](http://ds.iris.edu/ds/nodes/dmc/forms/sac/)\n\n\nExamples\n--------\n\nExamples of using the library can be found within the [documenation](https://savage13.github.io/sacio/). Of particular note are:\n\n   - [sac_read()](https://savage13.github.io/sacio/html/group__sac.html#gab2623928ccd5cac1a4cc94be5dd89273)\n   - [sac_write()](https://savage13.github.io/sacio/html/group__sac.html#gafe8cd1cadc546ea9d67a5ca14fd3886d)\n   - [sac_get_string()](https://savage13.github.io/sacio/html/group__sac.html#ga58de657b18177e79b5fa001b21c55e32) / [sac_set_string()](https://savage13.github.io/sacio/html/group__sac.html#ga9acd9d129945c8fdf5a21434ce1d3359)\n   - [sac_get_int()](https://savage13.github.io/sacio/html/group__sac.html#ga65ddb9d01a8d1ea66bc7ad1024b30534) / [sac_set_int()](https://savage13.github.io/sacio/html/group__sac.html#ga65ddb9d01a8d1ea66bc7ad1024b30534)\n   - [sac_get_float()](https://savage13.github.io/sacio/html/group__sac.html#ga94ddfd21929cd9cb6faa508d8b6d1460) / [sac_set_float()](https://savage13.github.io/sacio/html/group__sac.html#gaa5cd583512409156b09d6a4b0ec4b683)\n\nDocumentation for each function includes a selection of example usage (these also function as tests).\n\nWithin the test directory `t` are a set of example programs that use the library.  The best programs to get started are:\n\n   - [t/iotest.c](t/iotest.c) - Reading of all data files and accessing header and data values\n   - [t/cut.c](t/cut.c)    - Reading data files with a imposed time window (cut)\n   - [t/cutim.c](cutim.c)  - Windowing data within memory (cut)\n   - [t/compat.c](t/compat.c) - Usage of the library with original sacio library function names\n   - [t/ver.c](t/ver.c)    - Examples of behavior differences between v6 and v7 SAC header files\n\n### Read, Change and Write a sac file\n\nCompile and run the example below using (assuming you have compiled the library):\n\n    gcc -I. -o example example.c libsacio_bsd.a\n    ./example t/imp.sac\n\nThe file `t/imp.sac` is an impulse function and distributed with `sacio`.\n\nIf you have not compiled the library yet, see the [Compiling](#compiling) section below. \nThe library does not need to be installed to compile/run the example code, it only needs \nto know where the header file `sacio.h` is.\n\nIf you have compiled and installed the library, the example below can be compiled using:\n\n    gcc -I/usr/local/include/sacio -o example  example.c -L/usr/local/lib -lsacio_bsd\n    ./example t/imp.sac\n\n```c\n\n#include \u003cstdio.h\u003e\n#include \u003csacio.h\u003e\n\nint\nmain(int argc, char *argv[]) {\n    // Variable Declaration\n    int i;\n    int nerr = 0;\n    char org[128] = {0};\n    char id[64] = {0};\n    double delta;\n    sac *s = NULL;\n\n    if(argc \u003c 2) {\n        printf(\"Usage: example file.sac\\n\");\n        return -1;\n    }\n\n    // Read a SAc file, could be evenly or unevenly spaced\n    s = sac_read(argv[1], \u0026nerr);\n    if(nerr != 0) {\n        printf(\"Error: %d reading file\\n\", nerr);\n        return -1;\n    }\n\n    // Get a floating point value: delta\n    sac_get_float(s, SAC_DELTA, \u0026delta);\n\n    // Print out some header values\n    printf(\"delta: %f\\n\", delta);\n    printf(\"npts:  %d\\n\", s-\u003eh-\u003enpts);\n    printf(\"comps: %d\\n\", sac_comps(s));\n\n    // Print out the first 5 data values\n    for(i = 0; i \u003c 5; i++) {\n        printf(\"y[%4d]  %f\\n\", i, s-\u003ey[i]);\n    }\n\n    // Set some header character string values\n    sac_set_string(s, SAC_NET, \"IU\");\n    sac_set_string(s, SAC_STA, \"BORG\");\n    sac_set_string(s, SAC_LOC, \"00\");\n    sac_set_string(s, SAC_CHA, \"BHZ\");\n\n    // Set the origin time to 1994/160 00:33:16.123\n    sac_set_time(s, timespec64_from_yjhmsf(1994, 160, 0, 33, 16, 123));\n\n    // Format the origin time in absolute time\n    sac_fmt(org, sizeof(org), \"%TO\", s);\n    printf(\"Origin Time: %s [Absolute]\\n\", org);\n\n    // Output the Station id: NET.STA.LOC.CHA\n    sac_fmt(id, sizeof(id), \"%Z\", s);\n    printf(\"Station ID: %s\\n\", id);\n\n    // Write out the modified sac file\n    sac_write(s, \"output.sac\", \u0026nerr);\n\n    return 0;\n}\n```\n\n\nDownloading and installing\n--------------------------\n\n### Downloading \n\nThis library can be downloaded directly by either going to **Code-\u003eDownload Zip** or by using git as:\n\n    git clone https://github.com/savage13/sacio.git\n\nThis library is self contained and does not require any additional dependencies. \n \n### Compiling\n\nOnce downloaded, the library can be compiled from within the `sacio` or `sacio-master` directory using:\n  \n    ./configure\n    make \n    \n### Installation\n\nInstallation to the default location `/usr/local` can be completed using:\n\n    make install\n\nThis will install `libsacio_bsd.a` into `/usr/local/lib/libsacio_bsd.a` and \n`sacio.h` and `timespec.h` into the `/usr/local/inclucde/sacio` directory.  Creating \na symbolic link to this library will assist in existing programs that require\nthe sacio library, e.g.:\n\n    ln -s /usr/local/lib/libsacio_bsd.a /usr/local/lib/libsacio.a\n\nPassing the `--prefix` option to the configure command allows a different installation location.  \n\n### Testing\n\nTests for the library can be run if desired using\n\n    make test\n  \nCommunity Guidelines\n--------------------\n\n### Issues / Bugs\n\nPlease report issues, possible bugs, inconsistencies, and improvements to the project in the Issue Tracker or using a Pull Request.\n\n### Contributions\n\nIf you would like to contribute to the project please file Pull Requests and/or create issues for discussion at the libsacio project.\n\n### Support\n\nThe best place to find support for this library and the IRIS version of SAC (and where you can find me), \nis on the [sac-help mailing list](http://ds.iris.edu/message-center/topic/sac-help/).\n\nIncluded Libraries\n------------------\n\n- 64-bit time https://github.com/evalEmpire/y2038 (MIT License)\n- GeographicLib https://geographiclib.sourceforge.io/ version 1.49 (MIT/X11 License)\n\nLicense\n-------\n\nThe code here is licensed under the 2-Clause BSD License, except where specified.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsavage13%2Fsacio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsavage13%2Fsacio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsavage13%2Fsacio/lists"}