Opened 8 years ago

Closed 8 years ago

#460 closed defect (fixed)

Segmentation fault in ropp_fm_bg2ro_1d

Reported by: Ian Culverwell Owned by: Ian Culverwell
Priority: major Milestone: 9.0
Component: ropp_fm Version: 8.0
Keywords: Cc:

Description

The attached file, from the ROM SAF bgr archive, http://www.romsaf.org/priv/nrt/bgr/, causes a segmentation fault in ropp_fm_bg2ro_1d, thus:

ropp_fm_bg2ro_1d -f bgr20160101_000039_M01_2170584400_N0021_XXXX.nc -o bgr20160101_000039_M01_2170584400_N0021_XXXX_out.nc -d 

-----------------------------------------------------------------------
                     ROPP Forward Model
-----------------------------------------------------------------------


INFO (from ropp_fm_bg2ro_1d):  Processing profile    1 of      1
INFO (from ropp_fm_bg2ro_1d):  (BG_20160101000039_METB_G017_DMI_) 

 
WARNING (from ropp_fm_roprof2state):  RO data has no level 2b (free atmospheric) parameters.
INFO (from ropp_fm_roprof2state):  Check input data and valid_range attributes
INFO (from ropp_fm_roprof2state):  Check input data and valid_range attributes
INFO (from ropp_fm_roprof2state):  Set status flag state%ok to FALSE

forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image              PC                Routine            Line        Source             
ropp_fm_bg2ro_1d   000000000043DC20  Unknown               Unknown  Unknown
ropp_fm_bg2ro_1d   0000000000435416  Unknown               Unknown  Unknown
ropp_fm_bg2ro_1d   0000000000409A38  Unknown               Unknown  Unknown
ropp_fm_bg2ro_1d   0000000000406190  Unknown               Unknown  Unknown
ropp_fm_bg2ro_1d   0000000000403E4C  Unknown               Unknown  Unknown
libc.so.6          0000003F0B61ED5D  Unknown               Unknown  Unknown
ropp_fm_bg2ro_1d   0000000000403D49  Unknown               Unknown  Unknown

(It fails because there are no geopotentials in the file. That's understood, and should be addressed by #423. But it shouldn't cause a segmentation fault.)

Attachments (2)

bgr20160101_000039_M01_2170584400_N0021_XXXX.nc (15.1 KB ) - added by Ian Culverwell 8 years ago.
bgr20160101_000039_M01_2170584400_N0021_XXXX.nc
bgr20160101_000039_M01_2170584400_N0021_XXXX_test1.nc (81.1 KB ) - added by Ian Culverwell 8 years ago.
bgr20160101_000039_M01_2170584400_N0021_XXXX_test1.nc

Download all attachments as: .zip

Change history (7)

by Ian Culverwell, 8 years ago

bgr20160101_000039_M01_2170584400_N0021_XXXX.nc

comment:1 by Ian Culverwell, 8 years ago

The root of the problem is that subroutine set_obs_levels_bangle in ropp_fm_bg2ro_1d.f90 needs the state vector, to calculate the refracs, to calculate the impact height levels. There is no check on state%state_ok to see if it can do this. Previously, when the bgr files had 91 levels, the geops were -999, which is greater than ropp_MDTV=-9999, and so the data were considered valid (state%state_ok was true) and the calculation could proceed. Now that the bgr files have 137 levels, the geops are ropp_MDFV=-9.9999e7, which makes state%state_ok false, yet it tries to proceed. It should be easy enough to fix this. But how did the calculation proceed when the geops were all -999? It must have had to locate the temps and shums somewhere, to calculate the refracs and bangles. To be continued ...

comment:2 by Ian Culverwell, 8 years ago

Because ropp_fm_roprof2state generates geops from the AK and Bk coeffs and the surface pressure, ie it ignores the geops in the input file anyway! So we just need the new 137L files to stop being flagged with state_ok=F just because the geops are missing.

comment:3 by Ian Culverwell, 8 years ago

Running with --no-ranchk prevents ro_data%lev2b%npoints being set to zero, and we no longer get a crash. So the problem should fixed by #423. Certainly, changing

    idx => WHERE ( Lev2b%Geop > ropp_MDTV, nidx )

to

    idx => WHERE ( (Lev2b%Geop > ropp_MDTV) .OR. &
                   (Lev2b%Temp > ropp_MDTV), nidx )

lets it work without the need for --no-ranchk.

by Ian Culverwell, 8 years ago

bgr20160101_000039_M01_2170584400_N0021_XXXX_test1.nc

comment:4 by Ian Culverwell, 8 years ago

The fix described in #423 (namely, r4948) produces this output when the attached file is run through ropp_fm_bg2ro_1d:

-----------------------------------------------------------------------
                     ROPP Forward Model
-----------------------------------------------------------------------


INFO (from ropp_fm_bg2ro_1d):  Processing profile    1 of      1
 
WARNING (from ropp_io_read):  No valid geopotentials found, but valid temperatures and humidities are present.
  This is OK for ECMWF fields provided that valid Ak and Bk coefficients and surface pressures are present.
INFO (from ropp_fm_bg2ro_1d):  (BG_20160101000039_METB_G017_DMI_) 

 
WARNING (from set_obs_levels_bangle):  RoC missing from data structure ... setting equal to effective radius

It generates the attached bgr20160101_000039_M01_2170584400_N0021_XXXX_test1.nc file, which has sensible looking bangles and refracs.

comment:5 by Ian Culverwell, 8 years ago

Resolution: fixed
Status: newclosed

Segmentation fault fixed, so closing the ticket.

Note: See TracTickets for help on using tickets.