function iris_addwave, iris_hcr, waves=waves, max_frames=max_frames, testing=testing, hcr=hcr, $
   debug=debug, quiet=quiet,hcr_ingest=hcr_ingest, method=method, aia_scale=aia_scale, ok=ok, im_patch=impatch
;+
;
; IDL 8.5.2 (linux x86_64 m64)
; Journal File for freeland@senja
; Date: Wed Jan 25 21:58:20 2023
;  
;   Input Parameters:
;      iris_obsid_or_hcr - per name, input either Full IRIS OBSID -or- IRIS HCR record
;
;   Output:
;      Function returns modified SSW cutout service query = original AIA query + adjusted tags WAVES, etc.
;
;   Keyword Parameters:
;      waves - comma separated list of new WAVES to add - default=HMI-blos & HMI-cont
;      MAX_FRAMES - usual per SSW cutout Service;- set this to low number for test/sanity check
;
set_logenv,'ssw_nomore','1'   ; inhibit more-like behavior - just print everything without waiting for [space] bar 
OK=0 ; 
if n_params() lt 1 then begin
   box_message,'Expect either IRIS Full Obsid -or- IRIS HCR record - got neither, so bailing with no action'
;   return,-1  ; <<<< EARLY EXIT on no IRIS obsid or hcr 
end
help,iris_hcr,/str,out=out 
prstr,out,/nomore

ssw_sdo_jobid=iris_hcr.SDO_SSW_JOBID  ; the ssw_service JOBID ssw_service_yyyymmdd_hhmm_<pid>
help,ssw_sdo_jobid,/str,out=out 
prstr,out,/nomore
pr_status,/idlcomment
; --------------------------------------------------
;| PWD = /mars/ssw/site/idl/http/ssw_service_config |
; --------------------------------------------------
sdo_query_file=ssw_service_jobid2query(ssw_sdo_jobid[0],found=found,query_struct=query_struct)
; -----------------------------
;| Found sswjobid (query file) |
; -----------------------------
help,found,query_struct
if ~found then begin
   box_message, 'Could not find original SDO/AIA Query in any of the known Qs.'
   return,-1  ; <<< EARLY EXIT if cannot find original SSW cutout service querry'
endif
; compile beta version of ssw_make_query (mods to support 'add_wave', and aia->suvi etc.
;recompile,'$SSW_ONTOLOGY/idl_mods/ssw_make_query2.pro'  
recompile,'/mars/ssw/site/idl/http/ssw_service_config/iris_hmi/ssw_make_query2'

if n_elements(waves) eq '' then waves='blos,cont'    ; 1st use case: Add HMI blos&cont -> goal HMI analogs of IRIS L2 AIA

iris_addwaves_query=ssw_make_query(in_query=sdo_query_file, $
   waves=waves,/blosok,max_frames=max_frames ,$   ; keyword inherited mods/additions 
   query_source=query_struct.query_source + time2file(reltime(/now)) + '; +HMI blos,cont')

OK=1
help,url_decode(iris_addwaves_query),/str
return,iris_addwaves_query
end
