diff --git a/metis_l2_prep_vl_generic.pro b/metis_l2_prep_vl_generic.pro index cde56d304a5851b65d6f76e07f350eb7d4ae1db1..fca9edb5a2ff3dadf04c656142cb741875ba2da8 100644 --- a/metis_l2_prep_vl_generic.pro +++ b/metis_l2_prep_vl_generic.pro @@ -34,7 +34,20 @@ pro metis_l2_prep_vl_generic ; read the primary hdu data = mrdfits(input.file_name, 0, primary_header, /silent) - + + ; patch to fix the lack of the keyword SEQ_NUM + + pol_id = fxpar(primary_header, 'POL_ID', missing = 0) + if pol_id ge 1 and pol_id le 4 then begin + seq_num = fxpar(primary_header, 'SEQ_NUM', missing = 0) + if seq_num eq 0 then begin + obj_cnt = fxpar(primary_header, 'OBJ_CNT') + n_pol = fxpar(primary_header, 'N_POL', missing = 4) + seq_num = ((obj_cnt - 1)/n_pol + 1) + fxaddpar, primary_header, 'SEQ_NUM', seq_num, before = 'POL_ID' + endif + endif + ; read the quality matrix quality_matrix = mrdfits(input.file_name, 'quality matrix', /silent) diff --git a/metis_l2_prep_vl_polariz.pro b/metis_l2_prep_vl_polariz.pro index 03d203bd311b6023b8e38cdec92adbf92b03b891..9b6c791ce90e0eac23ae0aed0cc35125938dc20e 100755 --- a/metis_l2_prep_vl_polariz.pro +++ b/metis_l2_prep_vl_polariz.pro @@ -55,6 +55,22 @@ pro metis_l2_prep_vl_polariz image = mrdfits(input.file_name[k], 0, primary_header, /silent) + ; patch to fix the lack of the keyword SEQ_NUM + + seq_num = fxpar(primary_header, 'SEQ_NUM', missing = 0) + if seq_num eq 0 then begin + obj_cnt = fxpar(primary_header, 'OBJ_CNT') + n_pol = fxpar(primary_header, 'N_POL', missing = 4) + seq_num = ((obj_cnt - 1)/n_pol + 1) + fxaddpar, primary_header, 'SEQ_NUM', seq_num, before = 'POL_ID' + endif + + if k eq 0 then comment = fxpar(primary_header, 'COMMENT') else begin + sxdelpar, primary_header, 'COMMENT' + foreach line, comment do $ + fxaddpar, primary_header, 'COMMENT', line + endelse + header = fits_hdr2struct(primary_header) ; ====================================