﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
385	PCD wrong in bufr2ropp	Ian Culverwell	Ian Culverwell Dave Offiler	"The quality flags in (for example) the attached BUFR files are being incorrectly mapped to the ROPP variable 'PCD' by '''bufr2ropp'''. 
Eg:
{{{
unix> file=GRAS_1B_M02_20140101000329Z_20140101000436Z_R_O_20140709200600Z_G23_NN.bufr
unix> ropp_io/tools/bufr2ropp $file -o $(echo $file |sed -es/'.bufr'/'.nc'/)
unix> ncks -H -vpcd $(echo $file |sed -es/'.bufr'/'.nc'/)

dim_unlim[0] pcd[0]=128 
}}}

decbufr on the original file reveals
{{{
 QUALITY FLAGS FOR RADIO OCCULTATION DATA              Flag 033039 
 .......1........
}}}
which is 256.


Part of the problem is line ~500 of '''ropp_io/bufr/bufr2ropp_mod.f90'''

{{{
      IF ( BTEST(PCD, in) ) ROdata%PCD = IBSET(ROdata%PCD, 15-in)
}}}

which should read

{{{
      IF ( BTEST(PCD, in) ) ROdata%PCD = IBSET(ROdata%PCD, in)
}}}

This correctly gives ROdata%PCD = 256 for 
'''GRAS_1B_M02_20140101000329Z_20140101000436Z_R_O_20140709200600Z_G23_NN.bufr'''.

But even after correcting this, there remain problems with the other two files: '''GRAS_1B_M02_20140101001207Z_20140101001354Z_R_O_20140709200652Z_G14_NN.bufr''' outputs ROdata%PCD = 8449 (should be 8448), while

'''GRAS_1B_M02_20140101174452Z_20140101174657Z_R_O_20140710002204Z_G22_NN.bufr''' outputs 65535 (it should be 43512).


"	defect	closed	normal	9.0	ropp_io	7.1	invalid	BUFR	
