;+
; Name: ssw_getcme_list
;
; Purpose: return LASCO CME data for input time range & optional search params
;
; Input Parameters:
; time0 - optional time or start time of range (mission list if none)
; time1 - stop time if range
;
; Output:
; function returns list as structure, including ssw compliant times
;
; Keyword Parameters:
; cdaw - if set, use list at cdaw.gsfc.nasa.gov/CME_list/ (default..)
; By: Gopalswamy, N., Yashrio, S., Michalek, G. and Numes, S.
; count - number of elements (cme matches/structures) returned
; tcount - number of elements within intput time range
; search_array - optional search strings (see struct_where.pro)
; (valid tags include {cpa, width, lspeed, accel,remarks})
; sswdb - use sswdb index (new default); socket -> gsfc
; cactus - if set, apply times&search to CACTUS list
; nosswdb - if set, do NOT use the sswdb catalog; instead, re-parse original
; WWW at either CDAW (defalt) or CACTUS (or future lists..)
; (used by SSWDB generators - much SLOWER...)
; save_sswdb - (restricted) - generate the SSWDB cdaw&cactus catalogs
force_save - if /save_sswdb, force overwrite even if no changes
;
; Calling Examples:
; cmes=ssw_getcme_list('15-mar-2001','15-jul-2001') ; all within range
; halos=ssw_getcme_list(search=['width=360']) ; mission Halos
; partial=ssw_getcme_list('1-jan-2005','1-feb-2005', $
; search=['width=180~360','lspeed>1000',''accel>10'])
;
; Note: values of ACCEL etc set to -9999 are undefined
; For example, high speed halos w/high linear speed and negative ACCEL
; which only include valid ACCEL values....
; IDL> fhalo=ssw_getcme_list( search= $
; ['width=360','lspeed>500','accel=-1000~0'])
;
; Context Example: - show times of all CDAW Halo events in list via utplot
; Then get&plot CACTUS Halos for same time range
; IDL> halos=ssw_getcme_list(search=['width=360']) ; mission search
; IDL> utplot,halos, halos.lspeed,psym=2
; IDL> time_window,halos,t0,t1 ; cdaw halo time range -> T0&t1;
; Method:
; 1st call - socket access list -> convert to "ssw" structure
; subsequent, use common (/REFRESH to force recopy->structs)
;
; Restrictions:
; more of a comment - 1st call in session will take a minute or two
; subsequent calls Much faster - /NOSSWDB generally only used by
; meta generator but feel free... - that goes back to the original
; site and reparses the entire site->ssw structures
; Note that CDAW & CACTUS lists (and output structures) contain different
; info so not search parameters work for both - but times and a subset of
; tags ARE equivilent, including {LSPEED,CPA,WIDTH}
;
; History:
; 8-sep-2005 - S.L.Freeland - Written
; 14-Sep-2005 - S.L.Freeland - change 2nd order field names; def vals
; 21-sep-2005 - S.L.Freeland - Added 'event_name' tag "for later"
; make sswdb default
; 27-sep-2005 - S.L.Freeland - def values-> (-9999) + documentation
; 28-sep-2005 - S.L.Freeland - add TCOUNT output keyword&function
; 23-FEB-2006 - S.L.Freeland - broke cdaw www parse -> ssw_getcme_cdaw.pro
; and enabled /CACTUS (now a wrapper for these and future cme lists)
; 7-mar-2006 - S.L.Freeland - (restricted) - if /SAVE_SSWDB set, only
; overwrite existing if anything changed $SSDB:remove
; (use /FORCE_SAVE to override default)
; IDL> cact_halos=ssw_getcme_list(t0,t1,/cactus,search=['width=360'])
; IDL> utplot,cact_halos,cact_halos.lspeed, psym=4