;+ ; Contains the r_valid procedure ; ; :Author: ; Gaƫlle Boisnard ; ; :History: ; 2005/10/05: Created ; ; 2005/10/05: Last Edit ;- ; ;+ ; Finds the data with the wanted parameters and write them in a ; binary file ; ; :Uses: ; ddmm_to_ddd, valid_day, valid_month, valid_year ; ; :Params: ; ev: in, required, type=sometype ; A parameter named ev ;- PRO r_valid, ev common comABC common ComH1 common comH2 common RDATA, r_df_but1, r_df_but2, r_df_but3a, r_df_but3b, r_df_but3c,r_df_but3d, r_df_but3e, $ r_df_but3, r_data_filename_txt, r_data_filename_but, r_bands_Abut, r_bands_Bbut, r_bands_Cbut, $ r_bands_H1but, r_bands_H2but common RTIME common RMODE_CYCLE, r_mode_list, r_cycle_txt1, r_cycle_txt2 common R_LOG common R_MODE, selectedmode, tabfileinter t1=systime(/seconds) print, 'commence' ;--------------------- ; Band ABC parameters ;--------------------- ind1=widget_info(r_ABC_list1, /droplist_select) ind2=0 ind3=0 ind4=0 ind5=0 ind6=0 ind7=0 ind8=0 ind9=0 ind10b=0 ind10c=0 ind11b=0 ind11c=0 ind12=0 if (ind1 ne 0) then begin print, 'bandABC' ind2=widget_info(r_ABC_list2 , /droplist_select) ind3=widget_info(r_ABC_list3 , /droplist_select) ind4=widget_info(r_ABC_list4 , /droplist_select) ind5=widget_info(r_ABC_list5 , /droplist_select) ind6=widget_info(r_ABC_list6 , /droplist_select) ind7=widget_info(r_ABC_list7 , /droplist_select) ind8=widget_info(r_ABC_list8 , /droplist_select) widget_control, r_ABC_list9, get_value=ind9str if (ind9str ne '') then begin ind9=fix(ind9str) endif bandABC=ptr_new(obj_new('bandmode', ind1, ind2, ind3, ind4, ind5, ind6, ind7, ind8, ind9, $ ind10b, ind10c, ind11b, ind11c, ind12)) endif else begin bandABC=ptr_new() endelse ;-------------------------- ; Band H1 parameters ;-------------------------- ind1=widget_info(r_H1_list1 , /droplist_select)+2 ind2=0 ind3=0 ind4=0 ind5=0 ind6=0 ind7=0 ind8=0 ind9=0 ind10=0 ind11=0 ind12=0 ind13=0 print, 'H1', ind1 if (ind1 ne 2) then begin ind2=widget_info(r_H1_list2 , /droplist_select) ind3=widget_info(r_H1_list3 , /droplist_select) ind4=widget_info(r_H1_list4 , /droplist_select) if (ind4 ne 0) then begin ind4=ind4+4 endif ind5=widget_info(r_H1_list5 , /droplist_select) ind6=widget_info(r_H1_list6 , /droplist_select) ind7=widget_info(r_H1_list7 , /droplist_select) print, 'ind7', ind7 ind8=widget_info(r_H1_list8 , /droplist_select)+5 widget_control, r_H1_list9, get_value=ind9str if (ind9str ne '') then begin ind9=fix(ind9str) endif ind10b=widget_info(r_H1_list10b , /droplist_select) widget_control, r_H1_list10c, get_value=ind10cstr if (ind10cstr ne '') then begin ind10c=fix(ind10cstr) endif ind11b=widget_info(r_H1_list11b , /droplist_select)+2 widget_control, r_H1_list11c, get_value=ind11cstr if (ind11cstr ne '') then begin ind11c=fix(ind11cstr) endif widget_control, r_H1_list12, get_value=ind12str if (ind12str ne '') then begin ind12=fix(ind12str) endif bandH1=ptr_new(obj_new('bandmode', ind1, ind2, ind3, ind4, ind5, ind6, ind7, ind8, ind9, $ ind10b, ind10c, ind11b, ind11c, ind12)) endif else begin bandH1=ptr_new() endelse ;-------------------------- ; Band H2 parameters ;-------------------------- ind1=widget_info(r_H2_list1 , /droplist_select)+4 ind2=0 ind3=0 ind4=0 ind5=0 ind6=0 ind7=0 ind8=0 ind9=0 ind10b=0 ind10c=0 ind11b=0 ind11c=0 ind12=0 ind13=0 if (ind1 ne 4) then begin ind2=widget_info(r_H2_list2 , /droplist_select) ind3=widget_info(r_H2_list3 , /droplist_select) ind4=widget_info(r_H2_list4 , /droplist_select) if (ind4 ne 0) then begin ind4=ind4+4 endif ind5=widget_info(r_H2_list5 , /droplist_select) ind6=widget_info(r_H2_list6 , /droplist_select) ind7=widget_info(r_H2_list7 , /droplist_select) ind8=widget_info(r_H2_list8 , /droplist_select) if (ind8 ne 0) then begin ind8=ind8+10 endif widget_control, r_H2_list9, get_value=ind9str if(ind9str ne '') then begin ind9=fix(ind9str) endif ind10b=widget_info(r_H2_list10b , /droplist_select) widget_control, r_H2_list10c, get_value=ind10cstr if (ind10cstr ne '') then begin ind10c=fix(ind10cstr) endif ind11b=widget_info(r_H2_list11b , /droplist_select)+2 widget_control, r_H2_list11c, get_value=ind11cstr if (ind11cstr ne '') then begin ind11c=fix(ind11cstr) endif widget_control, r_H2_list12, get_value=ind12str if (ind12str ne '') then begin ind12=fix(ind12str) endif bandH2=ptr_new(obj_new('bandmode', ind1, ind2, ind3, ind4, ind5, ind6, ind7, ind8, ind9, $ ind10b, ind10c, ind11b, ind11c, ind12)) endif else begin bandH2=ptr_new() endelse ;----------------------------------- ; Output format ;----------------------------------- n1data=widget_info(r_df_but1, /button_set) n2data=widget_info(r_df_but2, /button_set) n3data=widget_info(r_df_but3, /button_set) n3adata=widget_info(r_df_but3a, /button_set) n3bdata=widget_info(r_df_but3b, /button_set) n3cdata=widget_info(r_df_but3c, /button_set) n3ddata=widget_info(r_df_but3d, /button_set) if ((n1data eq 0) and (n2data eq 0) and (n3adata eq 0) and (n3bdata eq 0) and $ (n3cdata eq 0) and (n3ddata eq 0) and (n3data eq 0)) then begin widget_control, r_infolog_txt, set_value='An output data level must be defined', /append return endif data=n1data+n2data*2+n3adata*3+n3bdata*4+n3cdata*5+n3ddata*6+n3data*7 widget_control, r_data_filename_txt, get_value=datafilename ;----------------------------------- ; Time interval (with filenames or dates) ;----------------------------------- widget_control, r_time_from_txt, get_value=time1 widget_control, r_time_to_txt, get_value=time2 time1=time1[0] time2=time2[0] if ((time1 eq '') or (time2 eq '')) then begin widget_control, r_infolog_txt, set_value='Select a year for the beginning of the time interval', $ /append return endif ; FIRST TIME if (strmid(time1, 5, 1) eq '/') then begin if (strmid(time1, 4, 1) ne '/') then begin widget_control, r_infolog_txt, set_value='Error in the beginning of the time interval', /append return endif i=0 month1=0 day1=0 year1=valid_year(strmid(time1, 0, 4)) if (year1 eq 0) then begin widget_control, r_infolog_txt, set_value='Bad year for the beginning of the time interval', $ /append return endif ddday1=long(strtrim(strmid(time1, 6, 3), 2)) if (ddday1 gt 366 or ddday1 lt 1) then begin widget_control, r_infolog_txt, set_value='Bad day for the beginning of the time interval', /append return endif endif else begin if (strmid(time1, 4, 1) ne '/') then begin widget_control, r_infolog_txt, set_value='Error in the beginning of the time interval', /append return endif i=1 ddday1=0 year1=valid_year(strmid(time1, 0, 4)) if (year1 eq 0) then begin widget_control, r_infolog_txt, set_value='Bad year for the beginning of the time interval', $ /append return endif month1=valid_month(strmid(time1, 5, 2)) if (month1 eq 0) then begin widget_control, r_infolog_txt, set_value='Bad month for the beginning of the time interval', $ /append return endif day1=valid_day(strmid(time1, 8, 2), month1, year1) if (day1 eq 0) then begin widget_control, r_infolog_txt, set_value='Bad day for the beginning of the time interval', $ /append return endif ddday1=ddmm_to_ddd(year1, month1, day1) endelse if (strlen(time1) lt 10+i) then begin hour1=0 min1=0 sec1=0 endif else begin if ((strmid(time1, 9+i, 1) ne ' ') or (strmid(time1, 12+i, 1) ne ':') or $ (strmid(time1, 15+i, 1) ne ':')) then begin widget_control, r_infolog_txt, set_value='Error in the beginning of the time interval', /append return endif hour1=long(strtrim(strmid(time1, 10+i, 2), 2)) if ((hour1 lt 0) or (hour1 gt 24)) then begin widget_control, r_infolog_txt, set_value='Bad hour for the beginning of the time interval', $ /append return endif min1=long(strtrim(strmid(time1, 13+i, 2), 2)) if ((min1 lt 0) or (min1 gt 59)) then begin widget_control, r_infolog_txt, $ set_value='Bad minute for the beginning of the time interval',/append return endif sec1=long(strtrim(strmid(time1, 16+i, 2), 2)) if ((sec1 lt 0) or (sec1 gt 59)) then begin widget_control, r_infolog_txt, set_value='Bad second for the beginning of the time interval',$ /append return endif endelse ; LAST TIME if (strmid(time2, 5, 1) eq '/') then begin if (strmid(time2, 4, 1) ne '/') then begin widget_control, r_infolog_txt, set_value='Error in the end of the time interval', /append return endif i=0 month2=0 day2=0 year2=valid_year(strmid(time2, 0, 4)) if (year2 eq 0) then begin widget_control, r_infolog_txt, set_value='Bad year for the end of the time interval', $ /append return endif ddday2=long(strtrim(strmid(time2, 6, 3), 2)) if (ddday2 gt 366 or ddday2 lt 1) then begin widget_control, r_infolog_txt, set_value='Bad day for the end of the time interval', /append return endif endif else begin if ((strmid(time2, 4, 1) ne '/') or (strmid(time2, 7, 1) ne '/')) then begin widget_control, r_infolog_txt, set_value='Error in the end of the time interval', /append return endif i=1 ddday2=0 year2=valid_year(strmid(time2, 0, 4)) if (year2 eq 0) then begin widget_control, r_infolog_txt, set_value='Bad year for the end of the time interval', /append return endif month2=valid_month(strmid(time2, 5, 2)) if (month2 eq 0) then begin widget_control, r_infolog_txt, set_value='Bad month for the end of the time interval', /append return endif day2=valid_day(strmid(time2, 8, 2), month2, year2) if (day2 eq 0) then begin widget_control, r_log_txt, set_value='Bad day for the end of the time interval', /append return endif ddday2=ddmm_to_ddd(year2, month2, day2) endelse if (strlen(time2) lt 10+i) then begin hour2=24 min2=0 sec2=0 endif else begin if ((strmid(time2, 9+i, 1) ne ' ') or (strmid(time2, 12+i, 1) ne ':') or $ (strmid(time2, 15+i, 1) ne ':')) then begin widget_control, r_log_txt, set_value='Error in the end of the time interval', /append return endif hour2=long(strtrim(strmid(time2, 10+i, 2), 2)) if ((hour2 lt 0) or (hour2 gt 24)) then begin widget_control, r_infolog_txt, set_value='Bad hour for the end of the time interval', /append return endif min2=long(strtrim(strmid(time2, 13+i, 2), 2)) if ((min2 lt 0) or (min2 gt 59)) then begin widget_control, r_infolog_txt, $ set_value='Bad minute for the end of the time interval',/append return endif sec2=long(strtrim(strmid(time2, 16+i, 2), 2)) if ((sec2 lt 0) or (sec2 gt 59)) then begin widget_control, r_infolog_txt, set_value='Bad second for the end of the time interval', /append return endif endelse ;------------------------------- ; Mode parameter ;------------------------------- indmode=widget_info(r_mode_list, /button_set) ;------------------------------- ; Duration of the cycle ;------------------------------- indcycle1=0 indcycle2=0 widget_control, r_cycle_txt1, get_value=indstrcycle if (indstrcycle ne '') then begin indcycle1=fix(strtrim(indstrcycle, 2)) endif widget_control, r_cycle_txt2, get_value=indstrcycle if (indstrcycle ne '') then begin indcycle2=fix(strtrim(indstrcycle, 2)) endif ;------------------------------- ; Antenna parameter set ;------------------------------- ;antset='' ;if (widget_info(r_rheometry_but, /button_set)) then begin ; antset='R' ;endif ;if (widget_info(r_jupitercal_but, /button_set)) then begin ; antset='J' ;endif ;------------------------------- ; Radiosource ;------------------------------- ;radiosource='' ;if (widget_info(r_sun_but, /button_set)) then begin ; radiosource='su' ;endif ;if (widget_info(r_jupiter_but, /button_set)) then begin ; radiosource='ju' ;endif ;if (widget_info(r_sc_but, /button_set)) then begin ; radisource='sc' ;endif ;if (widget_info(r_sn_but, /button_set)) then begin ; radiosource='sn' ;endif ;if (widget_info(r_ss_but, /button_set)) then begin ; radiosource='ss' ;endif ;-------------------------------- ; Creation of the mode ;-------------------------------- selectedmode=ptr_new(obj_new('mode', bandABC, bandH1, bandH2, year1, month1, day1, ddday1, hour1, $ min1, sec1, year2, month2, day2, ddday2, hour2, min2, sec2, data, $ indmode, indcycle1, indcycle2, antset, radiosource)) widget_control, r_infomode_txt, set_value=(*selectedmode)->get_mode(), /append tabfileinter=ptr_new() a=(*selectedmode)->find_mode(tabfileinter) help, *tabfileinter print, *tabfileinter if (ptr_valid(tabfileinter) eq 0) then begin widget_control, r_infolog_txt, set_value='No data for this mode in this time interval', /append return endif else begin if ((size(*tabfileinter))[1] eq 0) then begin widget_control, r_infolog_txt, set_value='No data for this mode in this time interval', /append return endif endelse filename='' widget_control, r_data_filename_txt, get_value=filename if (filename eq '') then begin filename=(*selectedmode)->get_filename_result() endif case 1 of n1data: begin widget_control, r_data_filename_txt, set_value=filename widget_control, r_data_filename_but, /sensitive end n2data: begin widget_control, r_data_filename_txt, set_value=filename widget_control, r_data_filename_but, /sensitive end n3adata: begin a=get_n3adatarecords(workpath+filename, *tabfileinter, antenna, radiosources) end n3bdata: begin a=get_n3bdatarecords(workpath+filename, *tabfileinter) end n3cdata: begin a=get_n3cdatarecords(workpath+filename, *tabfileinter) end n3ddata: begin a=get_n3ddatarecords(workpath+filename, *tabfileinter) end else: endcase ptr_free, selectedmode print, systime(/seconds)-t1 end