From 357b62422ec3be825c692b2dd4dd80ad47856a7d Mon Sep 17 00:00:00 2001 From: nuknal Date: Wed, 22 May 2024 18:15:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89stdout=20=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E9=A2=9C=E8=89=B2,=E4=BB=A5=E4=BE=BFexecutor=E5=8F=AA=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=88=B0=E6=97=A5=E5=BF=97=E6=AD=A3=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/extract.go | 24 ++++++++++++++++++++---- extract/aux.go | 1 + extract/params.go | 4 ++-- xlog/log.go | 4 ++-- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/cmd/extract.go b/cmd/extract.go index bc12546..a4d5094 100644 --- a/cmd/extract.go +++ b/cmd/extract.go @@ -3,7 +3,7 @@ package cmd import ( "fmt" - "github.com/k0kubun/pp/v3" + log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "starwiz.cn/sjy01/preprocessing/extract" ) @@ -26,11 +26,27 @@ var extractCmd = &cobra.Command{ panic(err) } - pp.Println(params) + log.Println("input data:", params.InputData) + log.Println("output path:", params.OutputPath) + log.Println("temp path:", params.TempPath) + log.Println("data id:", params.DataId) + log.Println("satellite:", params.Satellite) e := extract.NewExtractor(params) - aos, _ := e.ExtractAosData() - dats, _ := e.ExtractOriginalImageData(aos) + aos, err := e.ExtractAosData() + if err != nil { + panic(err) + } + + dats, err := e.ExtractOriginalImageData(aos) + if err != nil { + panic(err) + } + + if len(dats) == 0 { + panic(fmt.Errorf("no segment data found")) + } + for i, d := range dats { e.SeprateAuxAndImgData(d, i) } diff --git a/extract/aux.go b/extract/aux.go index 90734e1..985f0ef 100644 --- a/extract/aux.go +++ b/extract/aux.go @@ -13,6 +13,7 @@ var ( ) func (e *Extractor) ExtractAux(auxfile, xlsxfile string) ([]*AuxFrameHead, []*AuxFocalBox, []*AuxPlatform, error) { + log.Println("extract aux data from", auxfile, "to", xlsxfile) os.Remove(xlsxfile) if err := createAuxXlsx(xlsxfile); err != nil { return nil, nil, nil, err diff --git a/extract/params.go b/extract/params.go index ed0d552..7f9aebb 100644 --- a/extract/params.go +++ b/extract/params.go @@ -57,14 +57,14 @@ const L0TPL = ` {{.InputData}} - + {{.OutputPath}} {{.TempPath}} {{.ReportFile}} {{.ResultFile}} - WN + QH PMS {{.DataId}} SJY01 diff --git a/xlog/log.go b/xlog/log.go index 232ef2a..cf30ded 100644 --- a/xlog/log.go +++ b/xlog/log.go @@ -38,8 +38,8 @@ func init() { FullTimestamp: true, TimestampFormat: "2006-01-02.15:04:05", ForceFormatting: true, - ForceColors: true, - DisableColors: false, + ForceColors: false, + DisableColors: true, } fileFormatter = &prefixed.TextFormatter{ FullTimestamp: true,