Pierre-Louis Ligier have a nice solution for this problem (in condim.f) that you might like to look into aswell.
I paste the code below. The vectors of course need to be introduced in the beginning as:
DOUBLE PRECISION TEMP_PLLI(13),SALT_PLLI(13)
Where the lenght of the vectors (13) correspond to the number of vertical layers. The temperature for each layer is then specified in the vectors (marked as bold text below)
!*************PLLI***********
IF(NTRAC.GT.0) THEN
!
! Vectors with TEMP(Plan1), TEMP(Plan2) etc, + SALT
TEMP_PLLI = (/5.8D0,5.8D0,6.3D0,6.5D0,8.D0,9.3D0,10.8D0,
& 12.D0,14.D0,14.2D0,14.5D0,14.5D0,14.5D0/)
!
SALINITY_PLLI = (/4.48D0,4.48D0,4.29D0,4.09D0,3.90D0,3.70D0,3.51D0,
& 3.31D0,3.12D0,2.92D0,2.73D0,2.73D0,2.73D0/)
!
DO IPLAN=1,NPLAN
DO I=1,NPOIN2
J=NPOIN2*(IPLAN-1)+I
TA%ADR(1)%P%R(J)=TEMP_PLLI(IPLAN) !TEMP
TA%ADR(2)%P%R(J)=SALINITY_PLLI(IPLAN) ! SALINITY
TA%ADR(3)%P%R(J)=0.D0 !AIR
ENDDO
ENDDO
WRITE (LU,*) 'STRATIFICATION PROFILES OK'
ENDIF