MoonBit SEG-Y file exchange and trace inspection
moon check --target all
moon test --target js
moon test --target wasm-gc
moon build --target js --release
node tools/segy.mjs create examples/create.json demo.sgy
node tools/segy.mjs validate demo.sgy
node tools/segy.mjs stats demo.sgy examples/stats.json
node tools/segy.mjs groups demo.sgy examples/groups.json
node tools/segy.mjs select demo.sgy examples/select.json selected.sgy
node tools/segy.mjs window demo.sgy examples/window.json window.sgy
node tools/segy.mjs csv demo.sgy examples/select.json samples.csv
node tools/segy.mjs svg demo.sgy examples/trace.json trace.svg
node tools/segy.mjs qc demo.sgy examples/quality.json
moon run examples/quality_check --target js| 命令 | 选项/行为 |
|---|---|
| inspect / validate | 结构信息 / 另外遍历样本拒绝非有限 IEEE 值 |
| trace | trace,可选 first、count(每次最多100000);含时间和头字段 |
| stats | trace,可选 dead_threshold、clip_threshold、weighted |
| groups / find | field / 再加 minimum、maximum,原始有符号字段闭区间 |
| coordinate | trace、field;可选 degrees:true 将显式角度单位转十进制度 |
| copy / select / filter | 精确复制 / traces / field、minimum、maximum |
| window / convert | first、count / sample_code |
| csv / svg | traces 数组 / trace |
| qc / qc-csv | 可选 traces、group_by、dead_threshold、clip_threshold、weighted、max_details、max_groups;见 QC指南 |
let dataset = @segy.decode(bytes)
let selected = dataset.select(dataset.find_traces("ensemble", 10, 20))
let windowed = selected.window(2, 100)
let output = windowed.encode()moon fmt --check
moon info
node tools/check-cli.mjs
python -m pip install -r tools/requirements.txt
python tools/verify-reference.py
python tools/verify-quality.pymoon check --target all --deny-warn
moon test --target js --deny-warn
moon test --target wasm-gc --deny-warn
moon build --target js --release --deny-warn
moon packagepub struct AmplitudeStatistics {
samples : Int
minimum : Double
maximum : Double
mean : Double
rms : Double
standard_deviation : Double
} derive(ToJson)fn Dataset::quality_check(self : Dataset, traces? : Array[Int], group_by? : String, dead_threshold? : Double, clip_threshold? : Double, weighted? : Bool, max_details? : Int, max_groups? : Int) -> QualityReport raisepub struct FileHeader {
endian : Endian
revision : Int
raw_revision_word : Int
assumed_legacy_revision_one : Bool
sample_code : Int
samples : Int
interval_us : Double
fixed_length : Bool
extended_count : Int
declared_traces : UInt64
first_trace : Int
text_encoding : String
raw : Bytes
}pub struct QualityReport {
status : String
format_assumptions : Array[String]
source_trace_count : Int
weighted : Bool
dead_threshold : Double
clip_threshold : Double
clipping_checked : Bool
group_by : String?
summary : QualitySummary
groups : Array[QualityGroup]
details : Array[TraceQuality]
max_details : Int
details_truncated : Bool
}impl ToJson for QualityReportpub struct QualitySummary {
traces : Int
samples : Int
analyzed_traces : Int
analyzed_samples : Int
problem_traces : Int
nonfinite_samples : Int
integer_range_samples : Int
negative_weighting_traces : Int
weighting_range_samples : Int
dead_traces : Int
header_dead_traces : Int
clipped_traces : Int
clipped_samples : Int
minimum_samples : Int
maximum_samples : Int
minimum_interval_us : Double
maximum_interval_us : Double
statistics : AmplitudeStatistics?
}impl ToJson for QualitySummarypub(all) enum Sample {
Signed(Int64)
Real(Double)
}pub struct Trace {
// private fields
}fn Trace::statistics(self : Trace, dead_threshold? : Double, clip_threshold? : Double, weighted? : Bool) -> TraceStatistics raisepub(all) struct TraceIndex {
header_offset : Int
sample_offset : Int
samples : Int
interval_us : Double
} derive(ToJson)pub struct TraceQuality {
trace : Int
header_offset : Int
sample_offset : Int
sequence_line : Int
sequence_file : Int
field_record : Int
ensemble : Int
identification : Int
samples : Int
interval_us : Double
weighting : Int
flags : Array[String]
nonfinite_samples : Int
first_nonfinite_sample : Int?
integer_range_samples : Int
first_integer_range_sample : Int?
weighting_range_samples : Int
first_weighting_range_sample : Int?
statistics : TraceStatistics?
}impl ToJson for TraceQualitypub(all) struct TraceStatistics {
samples : Int
minimum : Double
maximum : Double
mean : Double
rms : Double
standard_deviation : Double
dead : Bool
clipped_samples : Int
clipping_checked : Bool
} derive(ToJson)fn create(header : FileHeader, traces : Array[Trace], extended_headers? : Array[Bytes]) -> Dataset raisefn decode_text(data : Bytes, encoding : String) -> String raisefn encode_text(text : String, encoding : String) -> Bytes raisefn make_header(samples : Int, interval_us : Double, sample_code : Int, endian? : Endian, revision? : Int, fixed_length? : Bool, text? : String, text_encoding? : String, extended_count? : Int) -> FileHeader raisefn make_trace(header : FileHeader, samples : Array[Sample], interval_us? : Double, fields? : Map[String, Int]) -> Trace raisefn parse_header(data : Bytes, endian? : Endian, text_encoding? : String, legacy_revision_one? : Bool) -> FileHeader raisefn sample_width(code : Int) -> Int raiseInstall
Download zipMoonBit SEG-Y file exchange and trace inspection