PRO for_widget_model_event,ev1 ;+ ; Name: FOR_WIDGET_MODEL_EVENT ; ; This program controls the buttons and input fields the model widget ; ; INPUTS ; ; EV1 - This structure contains the values that are input into the ; for_widget_model. ; ; External Calls: FOR_WIDGET_BUILD, FOR_MODELDEFAULTS, FOR_VIEWFROMDATA, FOR_WIDGET_MODEL ; FOR_WIDGET_PLOT ; ; Written by Sarah Gibson, Blake Forland 2013-2014 ; Version 2.0 July 2014 ; June 2019 -- used slash for PC compatibility ; Sept 2019 -- made widget update with change in hydro choice ; Sept 2021 -- adjusted widget change with hydro to deal with models without temperature explicit ; passed through azequi ; Dec 2021 -- passed through distobs ; Feb 2022 -- updated resets for HYDRO in CROISSANT and SIMPLE in TOMO model ; May 2022 -- got rid of redundant widgets ; Nov 2022 -- added nreinit=0 for hydro for_modeldefaults ; June 2023 -- added SYNCOM hooks ; July 2023 -- added working_dir to call for_modeldefaults ; Sept 2023 -- added AWSOM hooks ; common forward,flag,variables,settings,plotops,losops,gridops,widgets,obsops,modops,strings,outops slash=path_sep() ; ; if strupcase(tag_names(ev1,/structure_name)) eq 'WIDGET_KILL_REQUEST' then begin d=DIALOG(/WARNING,'Widgets should be closed using top widget Quit button') endif else begin ; ; don't do anything if just clicking in box or adding negative sign ; dostuff=0 if tag_exist(ev1,'type') then begin if ev1.type eq 2 then dostuff=1 endif if tag_exist(ev1,'LENGTH') eq 0 then dostuff=1 if tag_exist(ev1,'VALUE') eq 0 then begin widget_control,ev1.id,get_uvalue=uvalue,get_value=value endif else begin result = strsplit(ev.value,'.',/EXTRACT) uvalue=result[0] value=result[1] endelse if value eq '-' or value eq '-.' or value eq '.' or value eq '' then dostuff = 0 if strupcase(uvalue) eq 'HELP' then begin filename=file_dirname(GET_ENVIRON('FORWARD'))+slash+file_basename(GET_ENVIRON('FORWARD'))+slash+'MODELS'+slash+strupcase(modops.model)+slash+strupcase(modops.model+'HELP.TXT') xdisplayfile,filename endif if dostuff eq 1 then begin for_widget_build,variables,changevalue=ev1 ; ; special cases of PFSSFILE and TOMOFILE and RTOP or TOPOLOGY ; and STRIA and SYNCOM ; if strupcase(modops.model) eq 'PFSSMOD' or strupcase(modops.model) eq 'TOMO' or strupcase(modops.model) eq 'STRIA' or strupcase(modops.model) eq 'SYNCOM' then begin if strupcase(uvalue) eq 'RTOPVAL' then variables.pfssfile='' if strupcase(uvalue) eq 'TOPOLOGYVAL' then variables.pfssfile='' if strupcase(uvalue) eq 'SIMPLEVAL' or strupcase(uvalue) eq 'TOPOLOGYVAL' or strupcase(uvalue) eq 'RTOPVAL' then begin z=execute("for_modeldefaults,'"+modops.model+"'"+modops.modelstring+",date=usedate,working_dir='"+settings.working_dir+"',ModelInputs=variables") for_widget_model endif if strupcase(uvalue) eq 'PFSSFILEVAL' or strupcase(uvalue) eq 'TOMOFILEVAL' or strupcase(uvalue) eq 'STRIAFILEVAL' or strupcase(uvalue) eq 'SYNCOMFILEVAL' then begin usedate=settings.date z=execute("for_modeldefaults,'"+modops.model+"'"+modops.modelstring+",date=usedate,working_dir='"+settings.working_dir+"',ModelInputs=variables") if settings.date ne usedate then settings.date=usedate z=execute("for_viewfromdata,instrument='"+obsops.instrument+"',date='"+settings.date+"',cmer=cmer,bang=bang") if exist(bang) then begin losops.bang=bang losops.cmer=cmer endif for_widget_plot for_widget_model ; for_widget_display endif endif ; ; special cases of NUMCUBE/ADAPTCUBE (or PSIMAS or AWSOM), variable CUBENAME ; if strupcase(modops.model) eq 'NUMCUBE' or strupcase(modops.model) eq 'ADAPTCUBE' or strupcase(modops.model) eq 'PSIMAS' or strupcase(modops.model) eq 'AWSOM' then begin if strupcase(uvalue) eq 'CUBENAMEVAL' then begin nreinit=1 if strupcase(modops.model) eq 'NUMCUBE' or strupcase(modops.model) eq 'ADAPTCUBE' then usedate=settings.date else usedate='' z=execute("for_modeldefaults,'"+modops.model+"'"+modops.modelstring+",date=usedate,working_dir='"+settings.working_dir+"',nreinit=nreinit,ModelInputs=variables") c = execute("for_obsdefaults,variables.magmod,modops.model,azequi=gridops.azequi,distobs=gridops.distobs,gridtype=gridops.gridtype,working_dir=settings.working_dir,obsinputs=obsops"+strings.obsstring) if settings.date ne usedate then settings.date=usedate settings.nreinit=nreinit z=execute("for_viewfromdata,instrument='"+obsops.instrument+"',date='"+settings.date+"',cmer=cmer,bang=bang") if exist(bang) then begin losops.bang=bang losops.cmer=cmer endif else begin losops.bang=0. losops.cmer=-90. endelse ; ; get rid of old widgets ; disbsave=widgets.disb widget_control,widgets.top,/DESTROY loadsave=widgets.load widgets={top:'',modb:'',plotb:'',setsb:'',disb:'',outb:'',date:'',help:'',load:loadsave} if outops.moreplots eq 1 or outops.noerase eq 1 then widgets.disb=disbsave else if disbsave ne '' then widget_control,disbsave,/DESTROY for_widget_plot if strupcase(modops.model) ne 'DATA' then for_widget_model for_widget_top if outops.moreplots eq 0 then for_widget_display endif if strupcase(uvalue) eq 'TOPOLOGYVAL' then variables.cubename='' endif ; ; special case, eigenvalue for giblow or liteslow ; if strupcase(modops.model) eq 'GIBLOW' then begin if strupcase(uvalue) eq 'ALNOTRBUBVAL' then begin if variables.alnotrbub gt 3 or variables.alnotrbub lt 1 or double(value) ne double(variables.alnotrbub) then begin if abs(variables.alnotrbub) gt 6 or abs(variables.alnotrbub) lt 1 then begin message,/info,'please use eigenvalues >/= 1 and