L1A -> L2
This commit is contained in:
@@ -90,6 +90,8 @@ func (r *Registrator) makeProductMeta(scene *Scene) *ProductMeta {
|
|||||||
MapProjection: "GEOGRAPHIC",
|
MapProjection: "GEOGRAPHIC",
|
||||||
EarthEllipsoid: "WGS_84",
|
EarthEllipsoid: "WGS_84",
|
||||||
ProductLevel: "L1A",
|
ProductLevel: "L1A",
|
||||||
|
UtmZone: -1,
|
||||||
|
GainLevel: 6,
|
||||||
}
|
}
|
||||||
|
|
||||||
switch scene.Type {
|
switch scene.Type {
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ func L1AtoL2(in, out, meta, rpb, demtif string) error {
|
|||||||
sensor = "PAN"
|
sensor = "PAN"
|
||||||
}
|
}
|
||||||
|
|
||||||
corners, err := computeBound(out)
|
corners, width, height, err := computeBound(out)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -60,6 +60,8 @@ func L1AtoL2(in, out, meta, rpb, demtif string) error {
|
|||||||
m.ProductID = id
|
m.ProductID = id
|
||||||
m.ProductLevel = "L2"
|
m.ProductLevel = "L2"
|
||||||
m.Corners = *corners
|
m.Corners = *corners
|
||||||
|
m.Width = width
|
||||||
|
m.Height = height
|
||||||
xmlfile := filepath.Join(dir, id+".meta.xml")
|
xmlfile := filepath.Join(dir, id+".meta.xml")
|
||||||
writeProductMeta(m, xmlfile)
|
writeProductMeta(m, xmlfile)
|
||||||
|
|
||||||
@@ -68,17 +70,17 @@ func L1AtoL2(in, out, meta, rpb, demtif string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func computeBound(tif string) (*Corners, error) {
|
func computeBound(tif string) (*Corners, int, int, error) {
|
||||||
ds, err := godal.Open(tif)
|
ds, err := godal.Open(tif)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Error opening TIFF file %s: %v", tif, err)
|
log.Printf("Error opening TIFF file %s: %v", tif, err)
|
||||||
return nil, err
|
return nil, -1, -1, err
|
||||||
}
|
}
|
||||||
defer ds.Close()
|
defer ds.Close()
|
||||||
|
|
||||||
geotransform, err := ds.GeoTransform()
|
geotransform, err := ds.GeoTransform()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, -1, -1, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Xp = padfTransform[0] + P*padfTransform[1] + L*padfTransform[2];
|
// Xp = padfTransform[0] + P*padfTransform[1] + L*padfTransform[2];
|
||||||
@@ -98,7 +100,7 @@ func computeBound(tif string) (*Corners, error) {
|
|||||||
data := make([]uint16, width*height)
|
data := make([]uint16, width*height)
|
||||||
err = band.Read(0, 0, data, width, height)
|
err = band.Read(0, 0, data, width, height)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, -1, -1, err
|
||||||
}
|
}
|
||||||
|
|
||||||
nodata, _ := band.NoData()
|
nodata, _ := band.NoData()
|
||||||
@@ -150,5 +152,5 @@ func computeBound(tif string) (*Corners, error) {
|
|||||||
corners.LowerRight.Longitude = xmin + float64(index2)*geotransform[1]
|
corners.LowerRight.Longitude = xmin + float64(index2)*geotransform[1]
|
||||||
corners.LowerRight.Latitude = ymin
|
corners.LowerRight.Latitude = ymin
|
||||||
|
|
||||||
return &corners, nil
|
return &corners, width, height, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user