﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
415	Examine ucar2ropp	Ian Culverwell	Ian Culverwell	"Axel von Engeln writes:
{{{
I was just cross-checking some conversions in ROPP, when I noticed 
that the ropp2ucar tool is not working correctly. It writes out the 
same temp and dry_temp from one ucar input file with only dry 
temperature in it.

This is caused in ropp_io_read_ncdf_get.f90, in lines 1846 and
1865, where the routine tries to ""guess"" if this is dry or real 
temperature.

The ucar file is attached, if you run it with ucar2ropp, you see 
that temp = dry_temp in the ROPP file. Nothing major, but ROPP 
should better look at the long name to determine if this is dry 
temperature or actual temperature, and not guess it from which 
variables are available.
}}}

Agreed.  The code says:
{{{
! 6.8 Level2a variables (if any)
! -------------------------------


!! include dry temperature in Level 2a - if variable 'Bend_ang' exists, the
!! UCAR file is an atmPrf file, and the 'Temp' variable is actually dry temperature.
    IF (ncdf_isvar('Temp') .AND. ncdf_isvar('Bend_ang')) THEN

      CALL ncdf_getvar('Temp', data%Lev2a%dry_temp)

!      idx => WHERE((data%Lev2a%dry_temp > -999.0), nidx)
!      IF (nidx > 0) THEN
!        data%Lev2a%dry_temp(idx) = data%Lev2a%dry_temp(idx) + 273.15_wp
!      ENDIF
      WHERE(data%Lev2a%dry_temp > -999.0) &
        data%Lev2a%dry_temp = data%Lev2a%dry_temp + 273.15_wp
      data%Lev2a%units%dry_temp = ""kelvin""

    END IF

...

! 6.9 Level2b variables (if any)
! -------------------------------

    CALL ncdf_getvar('Temp',        data%Lev2b%temp)
!    idx => WHERE(data%Lev2b%temp > -999.0, nidx)
!    IF (nidx > 0) data%Lev2b%temp(idx) = data%Lev2b%temp(idx) + 273.15_wp
    WHERE (data%Lev2b%temp > -999.0) &
      data%Lev2b%temp = data%Lev2b%temp + 273.15_wp
    data%Lev2b%units%temp = ""kelvin""

}}}

The first bit look sensible, but the second doesn't. The CDL of the (attached) file says
{{{
	float Temp(MSL_alt) ;
		Temp:units = ""C"" ;
		Temp:valid_range = -200.f, 100.f ;
		Temp:_FillValue = -999.f ;
		Temp:long_name = ""Dry temperature"" ;
}}}

so we could use that to discriminate between temp and dry_temp, as Axel says.  (Presumably things are different for a wetPrf file.)

While we're at it, we could look at the whole of the UCAR reading section of '''ropp_io_read_ncdf_get.f90''', as other parts may be clobbered by the same sort of thing as hit us in #414.
"	defect	closed	normal	9.0	ROPP (all)	8.0	fixed		
