Opened 6 years ago

Closed 3 years ago

#539 closed task (fixed)

Update of ropp_apps_tph_tool in Section 7 [?]

Reported by: Ian Culverwell Owned by: Ian Culverwell
Priority: normal Milestone: ROPP9.1 carry over
Component: ropp_apps Version: 11.0
Keywords: Cc:

Description

Change history (9)

comment:1 by Ian Culverwell, 6 years ago

Owner: changed from Kent Bækgaard Lauritsen to Ian Culverwell
Status: newassigned
Summary: Update of ropp_apps_tph_tool in Section 7 [0.5 d]Update of ropp_apps_tph_tool in Section 7 [?]

comment:2 by Ian Culverwell, 6 years ago

Component: ROPP(all)ropp_apps

comment:3 by Ian Culverwell, 5 years ago

The transplanting of global attributes from an ascii file to the ROprof structure requires a lot of work in the ropp_io module. Leave that for now, but speak to DMI about it. And it's not in Sec 7, to which the title of the ticket refers.

comment:4 by Ian Culverwell, 5 years ago

Note that running make test on the code as given results in

Running t_apps_tph_1 (APPS TPH; default options) ...
 
ERROR (from ropp_io_addvar_rodataD1d):  The name "CT_bangle" is already in use ... cannot add the newly computed variable to the ROprof structure.
 
ERROR (from ropp_io_addvar_rodataD1d):  The name "CT_bangle_impact" is already in use ... cannot add the newly computed variable to the ROprof structure.
 
ERROR (from ropp_io_addvar_rodataD1d):  The name "CT_refrac" is already in use ... cannot add the newly computed variable to the ROprof structure.
 
ERROR (from ropp_io_addvar_rodataD1d):  The name "CT_refrac_alt" is already in use ... cannot add the newly computed variable to the ROprof structure.
 
ERROR (from ropp_io_addvar_rodataD1d):  The name "diag_lapse_tph_tdry" is already in use ... cannot add the newly computed variable to the ROprof structure.
 
ERROR (from ropp_io_addvar_rodataD1d):  The name "diag_press_tph_tdry" is already in use ... cannot add the newly computed variable to the ROprof structure.
 
ERROR (from ropp_io_addvar_rodataD1d):  The name "diag_alt_tph_tdry" is already in use ... cannot add the newly computed variable to the ROprof structure.
 
ERROR (from ropp_io_addvar_rodataD1d):  The name "diag_lapse_tph_temp" is already in use ... cannot add the newly computed variable to the ROprof structure.
 
ERROR (from ropp_io_addvar_rodataD1d):  The name "diag_press_tph_temp" is already in use ... cannot add the newly computed variable to the ROprof structure.
 
ERROR (from ropp_io_addvar_rodataD1d):  The name "diag_geop_tph_temp" is already in use ... cannot add the newly computed variable to the ROprof structure.

----------------------------------------------------------------------
                    ROPP APPS File Comparison Tool
----------------------------------------------------------------------

INFO (from ropp_apps_compare):  Comparing ropp_apps_tph_test.nc and ../data/ropp_apps_tph_test.nc:
   the results of running test t_apps_tph_1 (APPS TPH; default options)
****************************
**********  PASS  **********
****************************
... examine t_apps_tph_1.log for details

This is because the input file, ropp_apps/data/ropp_apps_tph_test.nc, already contains CT_bangle etc. This wasn't a problem with the previous version, because the extra data elements of ro_data1 were not copied across to ro_data.

Why wasn't this a problem for DMI? Perhaps they didn't run with -d? Or perhaps they didn't/don't run make test routinely? Needs to be discussed with them.

A simple solution is to nullify the ingested extra data (which is all one-dimensional), thus:

      IF ( l_diag ) CALL ropp_io_free_vlistD1d(ro_data%vlist%vlistD1d)

It then works OK.

(This is in fact better than the previous method, since 0-D and 2-D extra data are always carried from the input to the output file, as are 1-D extra data if extra diagnostics are not requested. Previously, all the input extra data would have been zapped, and would only have appeared in the output if it was asked for.)

comment:5 by Ian Culverwell, 5 years ago

These changes made at r5894 and r5895. Leaving ticket open as it needs discussion with DMI.

comment:6 by Ian Culverwell, 5 years ago

This change needs correcting because it causes a SEG FAULT with gfortran. This is because there are no level 1a data in the input file, ropp_apps/data/ropp_apps_tph_test.nc, and therefore

 ro_data%lev1a%npoints =            0
 ro_data%lev1a%missing =  T
 ro_data%lev1a%dtime = 

This makes sense. However, gfortran then computes

 SIZE(ro_data%lev1a%dtime) =            1

which means that the line

      ro_data%lev1a%npoints = SIZE(ro_data%lev1a%dtime) 

in Sec. 7.2 allocates space for data that don't exist, which causes the SEG FAULT. ifort17, however, and all the other compilers I tried, say

 SIZE(ro_data%lev1a%dtime) =            0

which causes no problems. (I can't find anything that says what fortran should return for the size of a disassociated pointer, so this compiler-dependency would appear to be allowable.)

Why are all the %npoints evaluations in Sec 7.2 needed anyway?

      ro_data%lev1a%npoints = SIZE(ro_data%lev1a%dtime)
      ro_data%lev1b%npoints = SIZE(ro_data%lev1b%impact)
      ro_data%lev2a%npoints = SIZE(ro_data%lev2a%alt_refrac)
      ro_data%lev2b%npoints = SIZE(ro_data%lev2b%geop)
      ro_data%lev2c%npoints = 1
      ro_data%lev2c%missing = .FALSE.
      ro_data%lev2d%npoints = SIZE(ro_data%lev2d%level_coeff_a)

As far as I can see, they're all defined in ropp_io/ropp/ropp_io_read_ncdf_get.f90, which is called by the call to ropp_io_read. And if you remove the SIZE statements above, gfortran and ifort17 both run OK.

Ask Stig why these statements were instigated at r4875.

comment:7 by Ian Culverwell, 5 years ago

(For the record, the segmentation fault was

rogram received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x7FBE5DB01697
#1  0x7FBE5DB01CDE
#2  0x7FBE5CFF63EF
#3  0xD1D56F in ut_converta_1d_eightbytereal_ at ut_convert.f90:1609 (discriminator 2)
#4  0x801A8D in ncdf_putvar_1d_eightbytereal_ at ncdf_putvar.f90:2961 (discriminator 6)
#5  0x4FD175 in ropp_io_write_put_rodata_ at ropp_io_write_ncdf_put.f90:235
#6  0x4CAEB3 in ropp_io_write_rodatass_ at ropp_io_write.f90:212
#7  0x407311 in MAIN__ at ropp_apps_tph_tool.f90:489 (discriminator 1)
Memory fault

.)

comment:8 by Ian Culverwell, 5 years ago

This change has been committed at r6118.

comment:9 by Ian Culverwell, 3 years ago

Resolution: fixed
Status: assignedclosed
Version: 9.011.0

This has been done and done. A good example of why changes need to be reviewed and tested, rather than blindly accepted.

Closing ticket.

Note: See TracTickets for help on using tickets.