;pro demo_for_desaturation
;;; Demo for the desaturation procedure SE-DESAT for AIA images

;;; Cutout data request line.
;ssw_cutout_service,'2017/09/10 15:45:00','2017/09/10 16:15:00',ref_helio='S09W91',fovx=350,fovy=350,email='guastavino@dima.unige.it',waves=[94,131,171,193],max_frames=1000,instrument='aia',aec=1

;
; NOTE: in the code images will be resized to 499 * 499 pixels FOV by ctrl_data function.
; So, a bigger FOV for the input data is needed.

;cd,'personal_path' ;

add_path, './', /EXPAND
RESOLVE_ALL, /CONTINUE_ON_ERROR ;


tstart =   '25-sep-2011 03:28:55';'10-sep-2017 16:06:20'; ; start time selection
tend   =   '25-sep-2011 03:28:58';'10-sep-2017 16:06:22'; ; end time selection

;cd, current=current_dir                  
;path = current_dir+'\25sep2011' ; data storage folder path
path = './25sep2011'
;wav  = ['94','131','171','193','211','304','335']  ; wavelength to process
wav = ['193']

obj = obj_new('desat_PRiL')

result = obj ->desaturation( wav , tstart , tend  , path , save_fts = 1 , aec = 1, loud = 1)

end