This commit is contained in:
nuknal
2024-05-20 11:08:24 +08:00
parent f609b2b023
commit efd824cc8a
14 changed files with 332 additions and 69 deletions

View File

@@ -5,13 +5,15 @@ import (
"io"
"os"
"path/filepath"
"strings"
"github.com/sirupsen/logrus"
)
const (
EB_AUX = "EB.AUX"
PLAT_AUX = "PLAT.AUX"
AUX = ".AUX"
EB_AUX = ".EB.AUX"
PLAT_AUX = ".PLAT.AUX"
PAN_RAW = "PAN.RAW"
MSS_RAW = "MSS.RAW"
PAN_HDR = "PAN.HDR"
@@ -32,8 +34,8 @@ type L0Writer struct {
func newL0Writer(outputDir, name string) *L0Writer {
var err error
suffix := []string{EB_AUX, PLAT_AUX, PAN_RAW, MSS_RAW, PAN_HDR, MSS_HDR}
suffix := []string{AUX, PAN_RAW, MSS_RAW, PAN_HDR, MSS_HDR}
nameEles := strings.Split(name, "_")
lw := &L0Writer{
ws: make(map[string]*l0w),
mssStoredType: MSS_ALL_IN_ONE,
@@ -41,7 +43,14 @@ func newL0Writer(outputDir, name string) *L0Writer {
for _, s := range suffix {
w := &l0w{}
w.name = filepath.Join(outputDir, name+"_"+s)
fname := name + s
if s == MSS_HDR || s == MSS_RAW || s == PAN_HDR || s == PAN_RAW {
eles := strings.Split(s, ".")
nameEles[1] = eles[0]
fname = strings.Join(nameEles, "_") + "." + eles[1]
}
w.name = filepath.Join(outputDir, fname)
w.f, err = os.OpenFile(w.name, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0777)
if err != nil {
logrus.Panic("create file failed: ", w.name, err)