  subroutine rdclapp_ice(nopr,iout,indir,outdir,lstrn,iset,&
  lset,llset,nlines,wcm,wavelength,rndat,ridat,iwave)

! ***
! Read in the data from the netCDF file
! Will use netCDF f90 routines
  use netcdf

! param1.inc gives the maximum size of indices and extinction vectors
  include 'param1.inc'

! ****
! See rdinoutdir.f90
  character(len=60) :: indir,outdir
  integer :: nopr,iout,iset

! See main.f90
  integer :: nlines,iwave
  real :: wcm(nwavemax),wavelength(nwavemax)
  real :: rndat(nwavemax),ridat(nwavemax)
  character(len=100) :: lstrn,lset,filnm

! Used here
! Notice that the exact number of elements in wcmdat,wavedat,rnval,rival works
  integer,parameter :: ndat=3322,nt=9
  integer :: i,itemp
  integer :: start(1),count(1),stride(1)
  integer :: start2(2),count2(2),stride2(2)
  real :: diff,diffmin
! Note that the ndat,nt is opposite to the ncdump dump
  real :: wcmdat(ndat,nt),wavedat(ndat,nt)
  real :: rnval(ndat,nt),rival(ndat,nt)
  real :: tk(nt)
  real :: numlines(nt)
  character(len=30) :: fil
  character (len=16) :: llset

! ***
! Will specify which temperature to work with

  write(0,fmt=140)
  140 format(2x,"Specify temp ( 130, 140, 150, 160, 170, 180, 190, 200, 210 K ")

! numlines = 3321, 3322, 3322, 3320, 3318, 3314, 3320, 3320, 3320 ;

  write(0,fmt=160)
  160 format(2x,"Specify temp in K ")

  read(5,*) temp

  do i=1,nt
   tk(i)=130.0+((i-1)*10.0)
  end do

   diffmin=1.0e6
  do i=1,nt
    diff=abs(temp-tk(i))
   if (diff .le. diffmin) then
    itemp=i
    diffmin=diff
   endif
  end do

! The compound string
!       '1234567890123456'
  llset=' CLAPP Ice      '

  write(0,fmt=170) itemp,tk(itemp),llset
  write(iout,fmt=170) itemp,tk(itemp),llset
  170 format(2x," itemp,tk(itemp),llset ",i4,2x,f10.4,2x,a16)

! ***
! Read in the data from the netCDF file
   lset=lstrn

! ***
! The input netCDF file
!     '123456789012345678901234567890'
  fil='clapp_ice.nc                  '

! Obtain the full pathname of the input netCDF file
   noprf=1
  call getfilnm(noprf,iout,fil,indir,filnm)
  if (noprf .eq. 1) then
!  stop
  end if

! ***
! Open the netCDF file
  istat=nf90_open(filnm,nf90_nowrite,id1)
   call handle(iout,istat)

  if (nopr .eq. 1) then
   write(iout,fmt=100) id1,filnm
   100 format(/,2x,"rdclapp_ice: id1,filnm ",i8,2x,a100)
  end if

! ***
! Get dimension ids
  istat=nf90_inq_varid(id1,'ntext',idntext)
   call handle(iout,istat)
  istat=nf90_inq_varid(id1,'n70',idn70)
   call handle(iout,istat)
  istat=nf90_inq_varid(id1,'nlines',idnlines)
   call handle(iout,istat)
  istat=nf90_inq_varid(id1,'ntemps',idntemps)
   call handle(iout,istat)

! *****
! Get the dimensions
  istat=nf90_get_var(id1,idnlines,nlines)
   call handle(iout,istat)
  istat=nf90_get_var(id1,idntext,ntext)
   call handle(iout,istat)
  istat=nf90_get_var(id1,idn70,n70)
   call handle(iout,istat)
  istat=nf90_get_var(id1,idntemps,ntemps)
   call handle(iout,istat)

! *****
! Get variable ids
  istat=nf90_inq_varid(id1,'temps',idtemps)
   call handle(iout,istat)
  istat=nf90_inq_varid(id1,'numlines',idnumlines)
   call handle(iout,istat)
  istat=nf90_inq_varid(id1,'wcm',idwcm)
   call handle(iout,istat)
  istat=nf90_inq_varid(id1,'wavelength',idwave)
   call handle(iout,istat)
  istat=nf90_inq_varid(id1,'rn',idrn)
   call handle(iout,istat)
  istat=nf90_inq_varid(id1,'ri',idri)
   call handle(iout,istat)

   nlinesorig=nlines
  if (nopr .eq. 1) then
   write(iout,fmt=500) nlines,ntemps,ntext,n70
   500 format(/,2x,"nlines,ntemps,ntext,n70",/,2x,4(2x,i4))
   write(iout,fmt=510) idtemps,idwcm,idwave,idrn,idri,idnumlines
   510 format(/,2x,"idtemps,idwcm,idwave,idrn,idri,idnumlines",/,2x,6(2x,i4))
  end if

! ****
! The number of lines in each data set
   start(1)=1
   count(1)=nt
   stride(1)=1
  istat=nf90_get_var(id1,idnumlines,numlines,start,count,stride)

! This is the number of lines for the itemp set
   nlines=int(numlines(itemp))

  if (nopr .eq. 1) then
   write(iout,fmt=520) nlines,nlinesorig
   520 format(/,2x,"nlines,nlinesorig,",/,2x,2(2x,i4))
  end if

! ****
!  Read in the real and imaginary indices
! Note that count2(1) and count2(2) are opposite to the ncdump dump
   start2(1)=1
   start2(2)=1
   count2(1)=nlinesorig
   count2(2)=nt
   stride2(1)=1
   stride2(2)=1
  istat=nf90_get_var(id1,idwcm,wcmdat,start2,count2,stride2)
   call handle(iout,istat)
  istat=nf90_get_var(id1,idwave,wavedat,start2,count2,stride2)
   call handle(iout,istat)
  istat=nf90_get_var(id1,idrn,rnval,start2,count2,stride2)
   call handle(iout,istat)
  istat=nf90_get_var(id1,idri,rival,start2,count2,stride2)
   call handle(iout,istat)

! ****
! Exit define mode
  istat=nf90_enddef(id1)

! Close the data set
  istat=nf90_close(id1)

! *****
! Put values into the output arrays
  do i=1,nlines
   wcm(i)=wcmdat(i,itemp)
   wavelength(i)=wavedat(i,itemp)
   rndat(i)=rnval(i,itemp)
   ridat(i)=rival(i,itemp)
   700 format(2x,i4,1p,9(1x,e10.3))
  end do

! *****
  if (nopr .eq. 1) then
    write(iout,fmt=170) itemp,tk(itemp),llset
    write(iout,fmt=840)
    840 format(/,2x,"rdclapp_ice: i,wcm,wavelength,rndat,ridat")
   do i=1,nlines
    write(iout,fmt=850) i,wcm(i),wavelength(i),rndat(i),ridat(i)
    850 format(2x,i4,2(1x,f12.4),1p,2(1x,e10.3))
   end do
  end if

! ******
  return
  end
