Skip to content

Commit 1242009

Browse files
Merge pull request #232 from observerly/feature/fits/AddObserverEntry
2 parents dea3687 + 6dae297 commit 1242009

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

pkg/fits/fits.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ type FITSObservation struct {
5454
Observer string `json:"observer"` // Who acquired the data
5555
}
5656

57+
type FITSObserver struct {
58+
Latitude float32 `json:"latitude"` // Latitude of the observer
59+
Longitude float32 `json:"longitude"` // Longitude of the observer
60+
Elevetion float32 `json:"elevation"` // Elevation of the observer
61+
}
62+
5763
// Creates a new instance of FITS image initialized with empty header
5864
func NewFITSImage(naxis int32, naxis1 int32, naxis2 int32, adu int32) *FITSImage {
5965
h := NewFITSHeader(naxis, naxis1, naxis2)
@@ -289,6 +295,34 @@ func (f *FITSImage) AddObservationEntry(observation *FITSObservation) *FITSImage
289295
return f
290296
}
291297

298+
func (f *FITSImage) AddObserverEntry(observer *FITSObserver) *FITSImage {
299+
f.Header.Floats["LATITUDE"] = struct {
300+
Value float32
301+
Comment string
302+
}{
303+
Value: observer.Latitude,
304+
Comment: "Latitude of the observer (in degrees)",
305+
}
306+
307+
f.Header.Floats["LONGITUD"] = struct {
308+
Value float32
309+
Comment string
310+
}{
311+
Value: observer.Longitude,
312+
Comment: "Longitude of the observer (in degrees)",
313+
}
314+
315+
f.Header.Floats["ELEVATIO"] = struct {
316+
Value float32
317+
Comment string
318+
}{
319+
Value: observer.Elevetion,
320+
Comment: "Elevation of the observer (in meters)",
321+
}
322+
323+
return f
324+
}
325+
292326
func (f *FITSImage) ExtractHFR(radius float32, sigma float32, starInOut float32) float32 {
293327
se := photometry.NewStarsExtractor(f.Data, int(f.Naxisn[0]), int(f.Naxisn[1]), radius, f.ADU)
294328

0 commit comments

Comments
 (0)