adjust log directory
This commit is contained in:
@@ -48,8 +48,6 @@ func init() {
|
|||||||
ForceColors: false,
|
ForceColors: false,
|
||||||
DisableColors: true,
|
DisableColors: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
configureLogger(logrus.StandardLogger(), "log/SJY01-imgproc.log", logrus.DebugLevel)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewLogger(logfile string) *logrus.Logger {
|
func NewLogger(logfile string) *logrus.Logger {
|
||||||
@@ -65,7 +63,7 @@ func configureLogger(logger *logrus.Logger, logfile string, level logrus.Level)
|
|||||||
writer, _ := rotatelogs.New(
|
writer, _ := rotatelogs.New(
|
||||||
logfile+".%Y%m%d",
|
logfile+".%Y%m%d",
|
||||||
rotatelogs.WithLinkName(logfile),
|
rotatelogs.WithLinkName(logfile),
|
||||||
rotatelogs.WithMaxAge(time.Duration(30*24)*time.Hour),
|
rotatelogs.WithMaxAge(time.Duration(7*24)*time.Hour),
|
||||||
rotatelogs.WithRotationTime(time.Duration(24)*time.Hour),
|
rotatelogs.WithRotationTime(time.Duration(24)*time.Hour),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,12 @@ var procCmd = &cobra.Command{
|
|||||||
Long: `process images`,
|
Long: `process images`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
config.GViper = config.InitViper(configFile)
|
config.GViper = config.InitViper(configFile)
|
||||||
logrus.SetLevel(config.GCONFIG.LogLevel)
|
os.MkdirAll(config.GCONFIG.Log.LogDir, 0755)
|
||||||
|
configureLogger(logrus.StandardLogger(),
|
||||||
|
filepath.Join(config.GCONFIG.Log.LogDir, "imgproc.log"),
|
||||||
|
config.GCONFIG.Log.LogLevel)
|
||||||
|
|
||||||
|
logrus.SetLevel(config.GCONFIG.Log.LogLevel)
|
||||||
|
|
||||||
reg := producer.NewRegistrator(producer.DownSampled)
|
reg := producer.NewRegistrator(producer.DownSampled)
|
||||||
reg.Params = initParams()
|
reg.Params = initParams()
|
||||||
@@ -35,7 +40,7 @@ var procCmd = &cobra.Command{
|
|||||||
if err := reg.LoadAuxData(); err != nil {
|
if err := reg.LoadAuxData(); err != nil {
|
||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
reg.AuxPrint()
|
// reg.AuxPrint()
|
||||||
|
|
||||||
if err := reg.LoadMssRaw(); err != nil {
|
if err := reg.LoadMssRaw(); err != nil {
|
||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
|
|||||||
@@ -9,7 +9,12 @@ type Config struct {
|
|||||||
CoRegistration CoRegistrationConfig `yaml:"coregistration" mapstructure:"coregistration"`
|
CoRegistration CoRegistrationConfig `yaml:"coregistration" mapstructure:"coregistration"`
|
||||||
Radiation RadiationConfig `yaml:"radiation" mapstructure:"radiation"`
|
Radiation RadiationConfig `yaml:"radiation" mapstructure:"radiation"`
|
||||||
BrowserImg BrowserImgConfig `yaml:"browser_img" mapstructure:"browser_img"`
|
BrowserImg BrowserImgConfig `yaml:"browser_img" mapstructure:"browser_img"`
|
||||||
LogLevel logrus.Level `yaml:"log_level" mapstructure:"log_level"`
|
Log LogConfig `yaml:"log" mapstructure:"log"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type LogConfig struct {
|
||||||
|
LogLevel logrus.Level `yaml:"log_level" mapstructure:"log_level"`
|
||||||
|
LogDir string `yaml:"log_dir" mapstructure:"log_dir"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CoRegistrationConfig struct {
|
type CoRegistrationConfig struct {
|
||||||
@@ -44,7 +49,10 @@ var GCONFIG Config
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
GCONFIG = Config{
|
GCONFIG = Config{
|
||||||
LogLevel: logrus.DebugLevel,
|
Log: LogConfig{
|
||||||
|
LogLevel: logrus.DebugLevel,
|
||||||
|
LogDir: "log/SJY01ImageProc",
|
||||||
|
},
|
||||||
CoRegistration: CoRegistrationConfig{
|
CoRegistration: CoRegistrationConfig{
|
||||||
MssBands: 4,
|
MssBands: 4,
|
||||||
PixelBytes: 2,
|
PixelBytes: 2,
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
@@ -17,6 +18,7 @@ import (
|
|||||||
"github.com/paulmach/orb/planar"
|
"github.com/paulmach/orb/planar"
|
||||||
"starwiz.cn/sjy01/image-proc/pkg/auxilary"
|
"starwiz.cn/sjy01/image-proc/pkg/auxilary"
|
||||||
"starwiz.cn/sjy01/image-proc/pkg/calculator"
|
"starwiz.cn/sjy01/image-proc/pkg/calculator"
|
||||||
|
"starwiz.cn/sjy01/image-proc/pkg/config"
|
||||||
"starwiz.cn/sjy01/image-proc/pkg/payload"
|
"starwiz.cn/sjy01/image-proc/pkg/payload"
|
||||||
"starwiz.cn/sjy01/image-proc/pkg/utils"
|
"starwiz.cn/sjy01/image-proc/pkg/utils"
|
||||||
)
|
)
|
||||||
@@ -66,7 +68,7 @@ func (r *Registrator) AuxPrint() {
|
|||||||
fcPos84.Features = append(fcPos84.Features, geojson.NewFeature(point))
|
fcPos84.Features = append(fcPos84.Features, geojson.NewFeature(point))
|
||||||
}
|
}
|
||||||
data, _ := json.Marshal(fcPos84)
|
data, _ := json.Marshal(fcPos84)
|
||||||
f, _ := os.Create(fmt.Sprintf("log/%s_aux_pos_84.geojson", r.Params.DataId))
|
f, _ := os.Create(filepath.Join(config.GCONFIG.Log.LogDir, fmt.Sprintf("%s_aux_pos_84.geojson", r.Params.DataId)))
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
f.Write(data)
|
f.Write(data)
|
||||||
|
|
||||||
@@ -82,7 +84,7 @@ func (r *Registrator) AuxPrint() {
|
|||||||
fcPos84Interp.Features = append(fcPos84Interp.Features, geojson.NewFeature(point))
|
fcPos84Interp.Features = append(fcPos84Interp.Features, geojson.NewFeature(point))
|
||||||
}
|
}
|
||||||
data, _ = json.Marshal(fcPos84Interp)
|
data, _ = json.Marshal(fcPos84Interp)
|
||||||
f, _ = os.Create(fmt.Sprintf("log/%s_aux_pos_84_interp.geojson", r.Params.DataId))
|
f, _ = os.Create(filepath.Join(config.GCONFIG.Log.LogDir, fmt.Sprintf("%s_aux_pos_84_interp.geojson", r.Params.DataId)))
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
f.Write(data)
|
f.Write(data)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,10 @@ const (
|
|||||||
UpSampled ResampleMethod = "up_sample_mss"
|
UpSampled ResampleMethod = "up_sample_mss"
|
||||||
PanResolution = 1.3 // mm/pixel
|
PanResolution = 1.3 // mm/pixel
|
||||||
MssResolution = 5.2
|
MssResolution = 5.2
|
||||||
|
ReferenceShiftYB1 = 100.0
|
||||||
|
ReferenceShiftYB2 = 200.0
|
||||||
|
ReferenceShiftYB3 = 300.0
|
||||||
|
ReferenceShiftYB4 = 400.0
|
||||||
)
|
)
|
||||||
|
|
||||||
type ResampleMethod string
|
type ResampleMethod string
|
||||||
|
|||||||
Reference in New Issue
Block a user