function goes_load_pos, trange = trange, probe = probe, coord_sys = coord_sys
compile_opt idl2
if undefined(coord_sys) then coord_sys = 'geij2000'
if (keyword_set(trange) && n_elements(trange) eq 2) $
then tr = timerange(trange) $
else tr = timerange()
sc = strcompress('goes'+string(probe), /rem)
catch, errstats
if errstats ne 0 then begin
dprint, dlevel=1, 'Error: ', !ERROR_STATE.MSG
catch, /cancel
return, 0
endif
ssc_goes_locations = spdfgetlocations(sc, trange, coordinateSystem=coord_sys)
if (size(ssc_goes_locations, /type) ne 11 || obj_valid(ssc_goes_locations) eq 0) then begin
dprint, dlevel = 0, 'Error loading GOES position data'
return, 0
endif
goes_jultime_values = ssc_goes_locations->gettime()
goes_time_values = dblarr(n_elements(goes_jultime_values))
if goes_jultime_values[0] lt -1095 || goes_jultime_values[n_elements(goes_jultime_values)-1] gt 1827933925 then begin
dprint, dlevel=0, 'Error, invalid Julian times from spdfgetlocations'
return, 0
endif
for jultime_idx = 0, n_elements(goes_jultime_values)-1 do begin
caldat, goes_jultime_values[jultime_idx], month, day, year, hour, minute, second
timestr_concat = strcompress(string(year) + '-' + string(month) + '-' + $
string(day) + '/' + string(hour) + ':' + string(minute) + ':' + string(second), /rem)
goes_time_values[jultime_idx] = time_double(timestr_concat)
endfor
goes_pos_values = dblarr(n_elements(ssc_goes_locations->getX()), 3)
goes_pos_values[*,0] = ssc_goes_locations->getX()
goes_pos_values[*,1] = ssc_goes_locations->getY()
goes_pos_values[*,2] = ssc_goes_locations->getZ()
goes_pos_struct = {pos_values: goes_pos_values, coord_sys: ssc_goes_locations->getcoordinatesystem(), $
time: goes_time_values}
return, goes_pos_struct
end