-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ZZHow1024/develop
ZSEGY1.0.0
- Loading branch information
Showing
9 changed files
with
1,937 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
HELP.md | ||
target/ | ||
!.mvn/wrapper/maven-wrapper.jar | ||
!**/src/main/**/target/ | ||
!**/src/test/**/target/ | ||
|
||
### STS ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
*.iml | ||
*.ipr | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
build/ | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
/out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 ZZHow(ZZHow1024) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,65 @@ | ||
# MagicSEGY | ||
MagicSEGY.Developing with Java. | ||
# [Java 项目]ZSEGY(中文说明) | ||
|
||
--- | ||
|
||
Website: | ||
|
||
[[Java 项目]ZSEGY | ZZHow](https://www.zzhow.com/ZSEGY) | ||
|
||
Source Code: | ||
|
||
https://github.com/ZZHow1024/ZSEGY | ||
|
||
Releases: | ||
|
||
https://github.com/ZZHow1024/ZSEGY/releases | ||
|
||
--- | ||
|
||
## 它是什么? | ||
|
||
ZSEGY 是一款跨平台的 SEG-Y 文件解析工具,支持命令模式和交互模式,可以解析并显示 SEG-Y 文件的文件头和数据体。 | ||
|
||
--- | ||
|
||
## 许可证 | ||
|
||
该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅 [LICENSE](https://github.com/ZZHow1024/ZSEGY/blob/main/LICENSE) 文件。 | ||
|
||
--- | ||
|
||
## 使用说明 | ||
|
||
下载地址:https://github.com/ZZHow1024/ZSEGY/releases | ||
|
||
- 下载 .jar 文件 | ||
- 命令模式: | ||
- 通过 `java -jar zsegy.jar [-command] <num> [filePath]` 命令使用软件。 | ||
- -head [filePath]:解析并输出文件头 | ||
- -body <num> [filePath]:解析并输出数据体中的第 num 个数据道 | ||
- -all <num> [filePath]:解析并输出文件头和数据体中的第 num 个数据道 | ||
-i [filePath]:解析并进入交互模式 | ||
- help:呼出本提示 | ||
- 交互模式: | ||
- 通过 `java -jar zsegy.jar` 命令使用软件。 | ||
1. 指定文件全路径 | ||
2. 展示文件头 | ||
3. 展示数据体 | ||
4. 退出程序 | ||
|
||
--- | ||
|
||
## 各版本功能介绍 | ||
|
||
- ZSEGY1.0.0 | ||
- 解析 SEG-Y文件 | ||
- 输出解析后的内容 | ||
- 支持命令模式与交互模式 | ||
|
||
--- | ||
|
||
## 各版本主界面 | ||
|
||
 | ||
|
||
ZSEGY1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Manifest-Version: 1.0 | ||
Main-Class: Main | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
import pojo.entity.SEGY; | ||
import util.SEGYUtils; | ||
|
||
import java.io.File; | ||
import java.util.Scanner; | ||
|
||
/** | ||
* @author ZZHow | ||
* @date 2024/11/25 | ||
*/ | ||
public class Main { | ||
public static void main(String[] args) { | ||
Scanner scanner = new Scanner(System.in); | ||
SEGY segy = new SEGY(); | ||
String filePath = ""; | ||
|
||
System.out.println("ZSEGY 1.0.0"); | ||
System.out.println("Author: ZZHow"); | ||
|
||
if (args.length != 0) { | ||
|
||
switch (args[0]) { | ||
case "-head", "head" -> { | ||
System.out.println("正在解析中..."); | ||
System.out.println(SEGYUtils.parseFileHeader(args[1])); | ||
System.exit(0); | ||
} | ||
case "-body", "body" -> { | ||
long num = 1; | ||
try { | ||
num = Long.parseLong(args[1]); | ||
} catch (NumberFormatException e) { | ||
System.out.println("格式错误,输入 -help 查看提示"); | ||
System.exit(0);; | ||
} | ||
segy = SEGYUtils.parseSEGY(args[2]); | ||
System.out.println("\n@@@第 " + num + " 个数据道@@@"); | ||
System.out.println(segy.getDataBodies().get(num)); | ||
System.exit(0); | ||
} | ||
case "-all", "all" -> { | ||
long num; | ||
try { | ||
num = Long.parseLong(args[1]); | ||
} catch (NumberFormatException e) { | ||
System.out.println("输入格式错误,输入 -help 查看提示"); | ||
break; | ||
} | ||
segy = SEGYUtils.parseSEGY(args[2]); | ||
System.out.println(segy.getFileHeader()); | ||
System.out.println("\n@@@第 " + num + " 个数据道@@@"); | ||
System.out.println(segy.getDataBodies().get(num)); | ||
System.exit(0); | ||
} | ||
case "-i", "i" -> { | ||
filePath = args[1]; | ||
} | ||
case "-help", "help" -> { | ||
System.out.println("--- ZSEGY 1.0.0 使用说明 ---"); | ||
System.out.println("java -jar zsegy.jar [-command] <num> [filePath]"); | ||
System.out.println("[-command]: "); | ||
System.out.println("-head [filePath]:解析并输出文件头"); | ||
System.out.println("-body <num> [filePath]:解析并输出数据体中的第 num 个数据道"); | ||
System.out.println("-all <num> [filePath]:解析并输出文件头和数据体中的第 num 个数据道"); | ||
System.out.println("-i [filePath]:解析并进入交互模式"); | ||
System.out.println(); | ||
System.out.println("-help:呼出本提示"); | ||
System.exit(0); | ||
} | ||
} | ||
} | ||
|
||
// 交互模式 | ||
// 程序主界面 | ||
System.out.println("0. 指定文件全路径\t\t"); | ||
System.out.println("1. 展示文件头"); | ||
System.out.println("2. 展示数据体"); | ||
System.out.println("3. 退出程序"); | ||
|
||
String op = "-1"; | ||
if (filePath == null || filePath.isEmpty()) { | ||
System.out.println("尚未指定文件"); | ||
op = "0"; | ||
} else { | ||
try { | ||
segy = SEGYUtils.parseSEGY(filePath); | ||
} catch (UnsupportedOperationException e) { | ||
System.out.println("数据采样格式编码错误,请检查"); | ||
} | ||
} | ||
|
||
while (true) { | ||
switch (op) { | ||
case "0" -> { | ||
System.out.println("请输入文件全路径:"); | ||
filePath = scanner.next(); | ||
if (!new File(filePath).exists()) { | ||
filePath = null; | ||
System.out.println("文件不存在!"); | ||
} else { | ||
try { | ||
segy = SEGYUtils.parseSEGY(filePath); | ||
} catch (UnsupportedOperationException e) { | ||
System.out.println("数据采样格式编码错误,请检查"); | ||
} | ||
} | ||
} | ||
case "1" -> { | ||
System.out.println(segy.getFileHeader()); | ||
} | ||
case "2" -> { | ||
System.out.print("数据道数:"); | ||
long num = scanner.nextLong(); | ||
System.out.println(segy.getDataBodies().get(num)); | ||
} | ||
case "3" -> { | ||
System.out.println("程序退出..."); | ||
System.exit(0); | ||
} | ||
case "-1" -> { | ||
} | ||
default -> { | ||
System.out.println("无效输入"); | ||
} | ||
} | ||
System.out.print("->"); | ||
op = scanner.next(); | ||
scanner.nextLine(); | ||
} | ||
} | ||
} |
Oops, something went wrong.