aux platform
This commit is contained in:
30
cmd/extract.go
Normal file
30
cmd/extract.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"starwiz.cn/sjy01/preprocessing/extract"
|
||||
)
|
||||
|
||||
var extractCmd = &cobra.Command{
|
||||
Use: "extract",
|
||||
Short: "Extract data from raw data files",
|
||||
Long: `Extract data from raw data files`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
params := extract.Params{
|
||||
InputData: "demo/4545.dat",
|
||||
OutputPath: "demo/output",
|
||||
TempPath: "demo/temp",
|
||||
DataId: "004545",
|
||||
}
|
||||
p := extract.NewExtractor(¶ms)
|
||||
p.ExtractAosData()
|
||||
dats, _ := p.ExtractOriginalImageData()
|
||||
for _, d := range dats {
|
||||
p.SeprateAuxAndImgData(d)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(extractCmd)
|
||||
}
|
||||
26
cmd/parse.go
Normal file
26
cmd/parse.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"starwiz.cn/sjy01/preprocessing/extract"
|
||||
)
|
||||
|
||||
var parseCmd = &cobra.Command{
|
||||
Use: "parse",
|
||||
Short: "Parse the data",
|
||||
Long: `Parse the data`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
params := extract.Params{
|
||||
InputData: "demo/4545.dat",
|
||||
OutputPath: "demo/output",
|
||||
TempPath: "demo/temp",
|
||||
DataId: "004545",
|
||||
}
|
||||
p := extract.NewExtractor(¶ms)
|
||||
p.ParseAuxPlatform("demo/temp/004545_S44_AUX1.dat")
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(parseCmd)
|
||||
}
|
||||
28
cmd/root.go
Normal file
28
cmd/root.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
paramsXML string
|
||||
)
|
||||
|
||||
var rootCmd = &cobra.Command{
|
||||
Use: "SJY01 Preprocessing",
|
||||
Short: "Preprocessing tools for SJY01 original raw data",
|
||||
Long: ``,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Println("preprocessing tools for SJY01 original raw data")
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.PersistentFlags().StringVarP(¶msXML, "params", "p", "params.xml", "parameters file path")
|
||||
}
|
||||
|
||||
func Execute() error {
|
||||
return rootCmd.Execute()
|
||||
}
|
||||
Reference in New Issue
Block a user