; docformat = 'rst'
;
; NAME:
; genoidAddObs
; PURPOSE:
; Add one or several entries to a Genoid VOTable (already opened with genoidOpenObs)
;
;+
; :Description:
; Add one or several entries to a Genoid VOTable (already opened with genoidOpenObs)
;
; :Categories:
; Disk I/O, Genoid
;
; :Params:
; unit: in, required, type=long
; The file unit to be completed
; sat: in, required, type=structure
; A structure containing the entries to be placed in the
; VOTable. Field are::
; .JD: Date in Julian Days
; .ISO: Date in ISO format
; .refName: Name of the system
; .X: .Obs: X Position - Observed
; .Err: X Position - Uncertainty
; .Cal: X Position - Computed by Genoide
; .OMC: X Position - Observed minus Computed
; .Y: similar to X structure
; .timeScale: Time scale (TT, UTC...)
; .centerFrame: Reference frame center
; .typeFrame: Type of reference frame
; .coordType: Type of coordinates
; .refFrame: Reference plane (1:equator, 2:ecliptic)
; .IAU: IAU code of the observatory
; .method: Photometric method used to obtain x,y measurements
; .Mag: Difference in magnitude between primary and satellite
; .dMag: Standard deviation on mag
; .QC: Quality note of the measure (A|A+|B|C|D)
; .telescope: Telescope used to acquire the measure
; .camera: Camera used to acquire the measure
; .filter: Filter used to acquire the measure
; .author: Name of the person who measured the image
; .when: Epoch at which the image was measured the last time (ISO format)
; .bib: Bibliographic reference
;
; :Author:
; B.Carry (OCA)
;
; :History:
; Change History::
; Written in July 2013, B. Carry (IMCCE)
; 2013 Sep. - B.Carry (IMCCE) - Cleaned
; 2017 Apr. - B.Carry (OCA) - Updated to new Genoid XML format
; 2018 Nov - B. Carry (OCA) - VOTable structure changed
;-
pro genoidAddObs, unit, sat
COMPILE_OPT hidden, idl2
;-----------------------------------------------------------------------------------------------;
;-----------------------------------------------------------------------------------------------;
;--- TAG --- I -- Initialization And Input Verification -----------------------;
;-----------------------------------------------------------------------------------------------;
;-----------------------------------------------------------------------------------------------;
;--I.1-- Syntax Validation -------------------------------------------------------------------;
if N_params() LT 2 then begin
message, /ioError, 'Syntax - genoidAddObs, unit, add'
return
endif
;--I.2-- Number of Epochs to Add -------------------------------------------------------------;
nbEp = n_elements(sat)
;--I.3-- Definition of XML VOTable Balises ---------------------------------------------------;
emptyTD= ' '
openTD = ' '
shutTD = ''
openTR = ' '
shutTR = ' '
;-----------------------------------------------------------------------------------------------;
;-----------------------------------------------------------------------------------------------;
;--- TAG --- II -- Add Epochs to Genoid Observation File -----------------------;
;-----------------------------------------------------------------------------------------------;
;-----------------------------------------------------------------------------------------------;
for kEp=0, nbEp-1 do begin
;--II.1-- Open a New Block for Current Epoch -----------------------------------------------;
printf, unit, openTR
;--II.2-- Time Variables -------------------------------------------------------------------;
printf, unit, openTD+strTrim(string(sat[kEp].JD,format='(D18.10)'),2)+shutTD
printf, unit, openTD+strTrim(sat[kEp].iso,2)+shutTD
;--II.3-- Name and Reference of the Dynamical System ---------------------------------------;
printf, unit, openTD+strTrim(sat[kEp].refName,2)+shutTD
; printf, unit, openTD+strTrim(sat[kEp].refSys,2)+shutTD
;--II.4-- Satellite Coordinates ------------------------------------------------------------;
printf, unit, openTD+strTrim(string(sat[kEp].x.obs,format='(F16.7)'),2)+shutTD
printf, unit, openTD+strTrim(string(sat[kEp].y.obs,format='(F16.7)'),2)+shutTD
printf, unit, openTD+strTrim(string(sat[kEp].x.err,format='(F16.7)'),2)+shutTD
printf, unit, openTD+strTrim(string(sat[kEp].y.err,format='(F16.7)'),2)+shutTD
printf, unit, openTD+strTrim(string(sat[kEp].x.cal,format='(F16.7)'),2)+shutTD
printf, unit, openTD+strTrim(string(sat[kEp].y.cal,format='(F16.7)'),2)+shutTD
printf, unit, openTD+strTrim(string(sat[kEp].x.omc,format='(F16.7)'),2)+shutTD
printf, unit, openTD+strTrim(string(sat[kEp].y.omc,format='(F16.7)'),2)+shutTD
;--II.5-- Reference Frames -----------------------------------------------------------------;
printf, unit, openTD+strTrim(sat[kEp].timeScale,2)+shutTD
printf, unit, openTD+strTrim(string(sat[kEp].centerFrame,format='(I)'),2)+shutTD
printf, unit, openTD+strTrim(string(sat[kEp].typeFrame,format='(I)'),2)+shutTD
printf, unit, openTD+strTrim(string(sat[kEp].CoordType,format='(I)'),2)+shutTD
printf, unit, openTD+strTrim(string(sat[kEp].refFrame,format='(I)'),2)+shutTD
;--II.6-- IAU Code of the Observatory ------------------------------------------------------;
printf, unit, openTD+strTrim(sat[kEp].iau,2)+shutTD
;--II.7-- Photometry of the Satellite ------------------------------------------------------;
printf, unit, openTD+strTrim(sat[kEp].method,2)+shutTD
printf, unit, openTD+strTrim(string(sat[kEp].mag, format='(F14.6)'),2)+shutTD
printf, unit, openTD+strTrim(string(sat[kEp].dMag,format='(F14.6)'),2)+shutTD
printf, unit, openTD+strTrim(sat[kEp].QC,2)+shutTD
;--II.8-- Telescope, Instrument, Filter ----------------------------------------------------;
printf, unit, openTD+strTrim(sat[kEp].telescope,2)+shutTD
printf, unit, openTD+strTrim(sat[kEp].camera,2)+shutTD
printf, unit, openTD+strTrim(sat[kEp].filter,2)+shutTD
;--II.9-- Who, When, Bibliography ----------------------------------------------------------;
printf, unit, openTD+strTrim(sat[kEp].author,2)+shutTD
printf, unit, openTD+strTrim(sat[kEp].when,2)+shutTD
printf, unit, openTD+strTrim(sat[kEp].bib,2)+shutTD
; if not strCmp(sat[kEp].bib,'') then printf, unit, openTD+strTrim(sat[kEp].bib,2)+shutTD $
; else printf, unit, emptyTD
;--II.10-- End of Block --------------------------------------------------------------------;
printf, unit, shutTR
endfor
end