function badc2pp,file,array=array,noisy=noisy,bin=bin ; Purpose: convert BADC (reduced reolution lat-lon) output into a pp-field ; Category: IO specialised ; Options ; /array - return data as array rather than wrapped as pp-field ; Expect files to be of the form ; path/Grib-out.var.lev.yyyy.[m]m.DD.hh.avg ; where DD is the last day of that month, [m]m is 1, 2, ...12 ; OR ; path/Grib-out.var.lev.yyyy.[m]m.DD.hh.b4 ; where .b4 indicates binary 4-byte output (from b2tob4.pl) ; (ie, wmc_grib.pl output format) @comm_error if (keyword_Set(noisy)) then message,file,/cont ; Read array of data a=readfromfile(file,bin=keyword_set(bin)) ; Check length of data read in if (n_elements(a) ne 144*73) then message,'File does not contain 144*73 numbers '+shtstr(n_elements(a)) ; Reform into lon-lat a=reform(a,144,73) ; ------------------------------------------------------- ; Past this point we become UKMO (pp-field) specific ; We may want to stop here and just return the data array ; ------------------------------------------------------- if (keyword_set(array)) then return,a ; Wrap as pp-field pp=makeppfield(a,zy=92.5,dy=-2.5,zx=-2.5,dx=2.5) ; Deduce header info gofilename2header,pp,file return,pp end