; docformat = 'rst'
;
; NAME:
; GENOIDE_XMLADD
; PURPOSE:
; Add one or several entries to a Genoid VOTable (already opened with GENOID_XMLOPEN)
;
;+
; :Description:
; Add one or several entries to a Genoid VOTable (already opened with GENOID_XMLOPEN)
;
; The suite of small routines GENOIDE_XML... allow to open, complete, close, read
; an XML file in the Genoid standards.
;
; :Categories:
; Disk I/O, Genoide
;
; :Params:
; UNIT: in, required, type=long
; The file unit to be completed
; ADD: 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
; .refSys:
; .xObs: X Position - Observed
; .yObs: Y Position - Observed
; .xErr: X Position - Uncertainty
; .yErr: Y Position - Uncertainty
; .xCal: X Position - Computed by Genoide
; .yCal: Y Position - Computed by Genoide
; .xOMC: X Position - Observed minus Computed
; .yOMC: Y Position - Observed minus Computed
; .timeScale: Time scale (TT, UTC...)
; .centerFrame: Reference frame center
; .typeFrame: Type of reference frame
; .coordType: Type of coordinates
; .refFrame:
; .obsIAU: IAU code of the observatory
; .bib: Bibliographic note
;
; :Author:
; B.Carry (IMCCE)
;
; :History:
; Change History::
; Written in July 2013, B. Carry (IMCCE)
; 2013 Sep. - B.Carry (IMCCE) - Cleaned
;-
pro genoide_xmlAdd, UNIT, ADD
;--I-- Check Inputs
if N_params() LT 2 then begin
message, /IOERROR, 'Syntax - genoide_XMLadd, unit, add'
return
endif
;--II-- Number of Entries
nbAdd = n_elements(add)
;--III-- XML Balises
openTD = ' '
shutTD = ''
;--IV-- Loop over Entries
for kAdd=0, nbAdd-1 do begin
;--IV.1-- Block Opening
printf, unit, ' '
;--IV.2-- Time Variables
printf, unit, openTD+strtrim(string(add(kAdd).JD,format='(D16.8)'),2)+shutTD
printf, unit, openTD+strtrim(add(kAdd).iso,2)+shutTD
;--IV.3-- Reference Name and System
printf, unit, openTD+strtrim(add(kAdd).refName,2)+shutTD
printf, unit, openTD+strtrim(add(kAdd).refSys,2)+shutTD
;--IV.4-- Astrometry
printf, unit, openTD+strtrim(string(add(kAdd).xobs,format='(F16.4)'),2)+shutTD
printf, unit, openTD+strtrim(string(add(kAdd).yobs,format='(F16.4)'),2)+shutTD
printf, unit, openTD+strtrim(string(add(kAdd).xerr,format='(F16.4)'),2)+shutTD
printf, unit, openTD+strtrim(string(add(kAdd).yerr,format='(F16.4)'),2)+shutTD
printf, unit, openTD+strtrim(string(add(kAdd).xcal,format='(F16.4)'),2)+shutTD
printf, unit, openTD+strtrim(string(add(kAdd).ycal,format='(F16.4)'),2)+shutTD
printf, unit, openTD+strtrim(string(add(kAdd).xomc,format='(F16.4)'),2)+shutTD
printf, unit, openTD+strtrim(string(add(kAdd).yomc,format='(F16.4)'),2)+shutTD
;--IV.5-- Reference Frame, Timescale
printf, unit, openTD+strtrim(add(kAdd).timeScale,2)+shutTD
printf, unit, openTD+strtrim(string(add(kAdd).centerFrame,format='(I)'),2)+shutTD
printf, unit, openTD+strtrim(string(add(kAdd).typeFrame,format='(I)'),2)+shutTD
printf, unit, openTD+strtrim(string(add(kAdd).CoordType,format='(I)'),2)+shutTD
printf, unit, openTD+strtrim(string(add(kAdd).refFrame,format='(I)'),2)+shutTD
;--IV.6-- Observer IAU Code
printf, unit, openTD+strtrim(add(kAdd).obsIAU,2)+shutTD
;--IV.7-- Bibliographic note
printf, unit, openTD+strtrim(add(kAdd).bib,2)+shutTD
;--IV.8-- Block Ending
printf, unit, ' '
endfor
end