report fus
This commit is contained in:
15
cmd/fus.go
15
cmd/fus.go
@@ -4,6 +4,7 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/airbusgeo/godal"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/spf13/cobra"
|
||||
producer "starwiz.cn/sjy01/image-proc/pkg/producer"
|
||||
@@ -13,6 +14,7 @@ var (
|
||||
panImage string
|
||||
mssImage string
|
||||
outputDir string
|
||||
fusReport string
|
||||
)
|
||||
|
||||
var fusCmd = &cobra.Command{
|
||||
@@ -24,18 +26,26 @@ var fusCmd = &cobra.Command{
|
||||
fusedTiff := filepath.Base(mssImage)
|
||||
fusedTiff = strings.Replace(fusedTiff, "MSS", "FUS", -1)
|
||||
id := strings.TrimSuffix(fusedTiff, filepath.Ext(fusedTiff))
|
||||
if fusReport == "" {
|
||||
fusReport = filepath.Join(outputDir, id+"_report.xml")
|
||||
}
|
||||
|
||||
err := producer.GDALPansharpen(panImage, mssImage, filepath.Join(outputDir, fusedTiff))
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
godal.RegisterAll()
|
||||
producer.GTiffToJPG(filepath.Join(outputDir, fusedTiff), filepath.Join(outputDir, id+".jpg"), true)
|
||||
|
||||
var report producer.Report
|
||||
report.Satellite = "SJY01"
|
||||
report.Sensor = "FUS"
|
||||
report.Scenes = append(report.Scenes, producer.ReportScene{
|
||||
TiffData: fusedTiff,
|
||||
TiffData: filepath.Join(outputDir, fusedTiff),
|
||||
BrowserData: filepath.Join(outputDir, id+".jpg"),
|
||||
})
|
||||
producer.WriteReport(&report, filepath.Join(outputDir, id+"_report.xml"))
|
||||
producer.WriteReport(&report, fusReport)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -61,4 +71,5 @@ func initFUSParams() {
|
||||
panImage = task.InputFileList.PanTiff
|
||||
mssImage = task.InputFileList.MssTiff
|
||||
outputDir = task.Params.OutputPath
|
||||
fusReport = task.Params.ReportFile
|
||||
}
|
||||
|
||||
@@ -18,16 +18,16 @@ type Report struct {
|
||||
type ReportScene struct {
|
||||
Name string `xml:"name,attr"`
|
||||
TiffData string `xml:"tiffData"`
|
||||
TfwData string `xml:"tfwData"`
|
||||
RpbData string `xml:"rpbData"`
|
||||
BrowserData string `xml:"browserData"`
|
||||
BrowserRpbData string `xml:"browserRpbData"`
|
||||
ThumbData string `xml:"thumbData"`
|
||||
ShpData string `xml:"shpData"`
|
||||
ShxData string `xml:"shxData"`
|
||||
DbfData string `xml:"dbfData"`
|
||||
TfwData string `xml:"tfwData,omitempty"`
|
||||
RpbData string `xml:"rpbData,omitempty"`
|
||||
BrowserData string `xml:"browserData,omitempty"`
|
||||
BrowserRpbData string `xml:"browserRpbData,omitempty"`
|
||||
ThumbData string `xml:"thumbData,omitempty"`
|
||||
ShpData string `xml:"shpData,omitempty"`
|
||||
ShxData string `xml:"shxData,omitempty"`
|
||||
DbfData string `xml:"dbfData,omitempty"`
|
||||
MetaData string `xml:"metaData"`
|
||||
QualityData string `xml:"qualityData"`
|
||||
QualityData string `xml:"qualityData,omitempty"`
|
||||
}
|
||||
|
||||
func WriteReport(report *Report, filename string) error {
|
||||
|
||||
@@ -120,11 +120,13 @@ func (r *Registrator) SaveScenesToTiff(panScenes []*Scene, mssScenes []*Scene) e
|
||||
scene.Meta.DataSize = sizeOfFile(scene.Tiff)
|
||||
metaFile := strings.Replace(scene.Tiff, ".tiff", ".meta.xml", 1)
|
||||
r.writeProductMeta(scene.Meta, metaFile)
|
||||
GTiffToJPG(scene.Tiff, strings.Replace(scene.Tiff, ".tiff", ".jpg", 1), false)
|
||||
jpg := strings.Replace(scene.Tiff, ".tiff", ".jpg", 1)
|
||||
GTiffToJPG(scene.Tiff, jpg, false)
|
||||
r.report.Scenes = append(r.report.Scenes, ReportScene{
|
||||
Name: scene.SceneId,
|
||||
TiffData: scene.Tiff,
|
||||
MetaData: metaFile,
|
||||
Name: scene.SceneId,
|
||||
TiffData: scene.Tiff,
|
||||
MetaData: metaFile,
|
||||
BrowserData: jpg,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -153,11 +155,13 @@ func (r *Registrator) SaveScenesToTiff(panScenes []*Scene, mssScenes []*Scene) e
|
||||
scene.Meta.DataSize = sizeOfFile(scene.Tiff)
|
||||
metaFile := strings.Replace(scene.Tiff, ".tiff", ".meta.xml", 1)
|
||||
r.writeProductMeta(scene.Meta, metaFile)
|
||||
GTiffToJPG(scene.Tiff, strings.Replace(scene.Tiff, ".tiff", ".jpg", 1), false)
|
||||
jpg := strings.Replace(scene.Tiff, ".tiff", ".jpg", 1)
|
||||
GTiffToJPG(scene.Tiff, jpg, false)
|
||||
r.report.Scenes = append(r.report.Scenes, ReportScene{
|
||||
Name: scene.SceneId,
|
||||
TiffData: scene.Tiff,
|
||||
MetaData: metaFile,
|
||||
Name: scene.SceneId,
|
||||
TiffData: scene.Tiff,
|
||||
MetaData: metaFile,
|
||||
BrowserData: jpg,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user