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