From 2dacb0f2d3832109142861604d11b353b85351a5 Mon Sep 17 00:00:00 2001
From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr>
Date: Fri, 1 Dec 2023 09:18:03 +0100
Subject: [PATCH] Philippe 01/12/2023: sensors: move XPZ, XTZ and XSVZ to
 TFLYERDATA (instead of TSENSOR) (used only by flyers)

---
 src/MNH/aircraft_balloon_evol.f90  | 26 ++++++++++++--------------
 src/MNH/modd_aircraft_balloon.f90  | 25 ++++++++++++++++++++++++-
 src/MNH/modd_sensor.f90            | 27 ++-------------------------
 src/MNH/profilern.f90              |  6 +-----
 src/MNH/write_aircraft_balloon.f90 |  7 +++----
 src/MNH/write_profilern.f90        |  5 ++---
 6 files changed, 44 insertions(+), 52 deletions(-)

diff --git a/src/MNH/aircraft_balloon_evol.f90 b/src/MNH/aircraft_balloon_evol.f90
index 786aa2165..f7e4f25c2 100644
--- a/src/MNH/aircraft_balloon_evol.f90
+++ b/src/MNH/aircraft_balloon_evol.f90
@@ -108,7 +108,7 @@ CONTAINS
 !          ------------
 !
 USE MODD_AIRCRAFT_BALLOON
-USE MODD_CST,              ONLY: XP00, XRD, XCPD, XLVTT
+USE MODD_CST,              ONLY: XCPD, XLVTT, XP00, XRD
 USE MODD_IO,               ONLY: ISP
 USE MODD_TIME_n,           ONLY: TDTCUR
 USE MODD_TURB_FLUX_AIRCRAFT_BALLOON, ONLY: XRCW_FLUX, XSVW_FLUX, XTHW_FLUX
@@ -931,12 +931,12 @@ ZGAM   = (XRPK * (TPFLYER%XLON_CUR - XLON0) - XBETA)*(XPI/180.)
 TPFLYER%XZON (1,ISTORE) = ZU_BAL * COS(ZGAM) + ZV_BAL * SIN(ZGAM)
 TPFLYER%XMER (1,ISTORE) = - ZU_BAL * SIN(ZGAM) + ZV_BAL * COS(ZGAM)
 !
-TPFLYER%XW   (1,ISTORE) = TPFLYER%INTERP_FROM_MASSPOINT( ZWM )
-TPFLYER%XTH  (1,ISTORE) = TPFLYER%INTERP_FROM_MASSPOINT( PTH )
-!
 ZFLYER_EXN = TPFLYER%INTERP_FROM_MASSPOINT( ZEXN )
+TPFLYER%XW   (1,ISTORE) = TPFLYER%INTERP_FROM_MASSPOINT( ZWM )
 TPFLYER%XP   (1,ISTORE) = XP00 * ZFLYER_EXN**(XCPD/XRD)
+TPFLYER%XTH  (1,ISTORE) = TPFLYER%INTERP_FROM_MASSPOINT( PTH )
 TPFLYER%XT   (1,ISTORE) = TPFLYER%INTERP_FROM_MASSPOINT( PTH ) * ZFLYER_EXN
+!
 
 ZR(:,:,:) = 0.
 DO JLOOP=1,SIZE(PR,4)
@@ -951,22 +951,20 @@ DO JLOOP=1,SIZE(PR,4)
   TPFLYER%XRZ  (:,ISTORE,JLOOP) = TPFLYER%INTERP_HOR_FROM_MASSPOINT( PR(:,:,:,JLOOP) )
 END DO
 
-TPFLYER%XTZ   (:,ISTORE) = TPFLYER%INTERP_HOR_FROM_MASSPOINT( PTH * ZEXN3D )
-
 TPFLYER%XFFZ  (:,ISTORE) = TPFLYER%INTERP_HOR_FROM_MASSPOINT( SQRT(PU**2+PV**2) )
 
 TPFLYER%XRHOD (:,ISTORE) = TPFLYER%INTERP_HOR_FROM_MASSPOINT( PRHODREF )
 
-DO JLOOP=1,SIZE(PSV,4)
-  TPFLYER%XSVZ  (:,ISTORE,JLOOP) = TPFLYER%INTERP_HOR_FROM_MASSPOINT( PSV(:,:,:,JLOOP) )
-END DO
+IF ( CCLOUD=="ICE3" .OR. CCLOUD=="ICE4" ) THEN
+  TPFLYER%XCIZ(:,ISTORE) = TPFLYER%INTERP_HOR_FROM_MASSPOINT( PCIT(:,:,:) )
+END IF
 
-TPFLYER%XPZ  (:,ISTORE) = TPFLYER%INTERP_HOR_FROM_MASSPOINT( PP(:,:,:) )
+TPFLYER%XPZ   (:,ISTORE) = TPFLYER%INTERP_HOR_FROM_MASSPOINT( PP(:,:,:) )
+TPFLYER%XTZ   (:,ISTORE) = TPFLYER%INTERP_HOR_FROM_MASSPOINT( PTH * ZEXN3D )
 
-IF (CCLOUD=="LIMA") THEN
-ELSE IF ( CCLOUD=="ICE3" .OR. CCLOUD=="ICE4" ) THEN
-  TPFLYER%XCIZ  (:,ISTORE) = TPFLYER%INTERP_HOR_FROM_MASSPOINT( PCIT(:,:,:) )
-END IF
+DO JLOOP=1,SIZE(PSV,4)
+  TPFLYER%XSVZ(:,ISTORE,JLOOP) = TPFLYER%INTERP_HOR_FROM_MASSPOINT( PSV(:,:,:,JLOOP) )
+END DO
 
 ZTH_EXN(:,:,:) = PTH(TPFLYER%NI_M:TPFLYER%NI_M+1, TPFLYER%NJ_M:TPFLYER%NJ_M+1, :) * ZEXN(:,:,:)
 ZZ(:) = TPFLYER%INTERP_HOR_FROM_MASSPOINT( ZZM(:,:,:) )
diff --git a/src/MNH/modd_aircraft_balloon.f90 b/src/MNH/modd_aircraft_balloon.f90
index a5bf6a96a..c95161d69 100644
--- a/src/MNH/modd_aircraft_balloon.f90
+++ b/src/MNH/modd_aircraft_balloon.f90
@@ -35,6 +35,7 @@
 !  P. Wautelet 08/02/2019: add missing NULL association for pointers
 !  P. Wautelet 13/09/2019: budget: simplify and modernize date/time management
 !  P. Wautelet    06/2022: reorganize flyers
+!  B. Vie      21/09/2023: add SVs and temperature to recorded variables
 !-------------------------------------------------------------------------------
 !
 !*       0.   DECLARATIONS
@@ -100,6 +101,9 @@ TYPE, EXTENDS(TSENSOR), ABSTRACT :: TFLYERDATA
   REAL, DIMENSION(:),     ALLOCATABLE :: XTKE_DISS  ! tke dissipation rate
   REAL, DIMENSION(:,:),   ALLOCATABLE :: XRTZ       ! tot hydrometeor mixing ratio
   REAL, DIMENSION(:,:,:), ALLOCATABLE :: XRZ        ! water vapour mixing ratio
+  REAL, DIMENSION(:,:),   ALLOCATABLE :: XPZ        ! Pressure
+  REAL, DIMENSION(:,:),   ALLOCATABLE :: XTZ        ! Temperature
+  REAL, DIMENSION(:,:,:), ALLOCATABLE :: XSVZ       ! Scalar variables
   REAL, DIMENSION(:,:),   ALLOCATABLE :: XFFZ       ! horizontal wind
   REAL, DIMENSION(:,:),   ALLOCATABLE :: XWZ        ! vertical profile of vertical velocity
   REAL, DIMENSION(:,:),   ALLOCATABLE :: XZZ        ! vertical profile of mass point altitude (above sea)
@@ -257,8 +261,11 @@ SUBROUTINE DATA_ARRAYS_ALLOCATE_FLYER( TPSENSOR, KSTORE )
 
   ALLOCATE( TPSENSOR%XRTZ (IKU, ISTORE) )
   ALLOCATE( TPSENSOR%XRZ  (IKU, ISTORE, NRR) )
+  ALLOCATE( TPSENSOR%XPZ  (IKU, ISTORE) )
+  ALLOCATE( TPSENSOR%XTZ  (IKU, ISTORE) )
+  ALLOCATE( TPSENSOR%XSVZ (IKU, ISTORE, NSV) )
   ALLOCATE( TPSENSOR%XFFZ (IKU, ISTORE) )
-  IVARSIZE = IVARSIZE + IKU * ( 2 + NRR )
+  IVARSIZE = IVARSIZE + IKU * ( 4 + NRR + NSV )
 
   ALLOCATE( TPSENSOR%XWZ       (IKU, ISTORE) )
   ALLOCATE( TPSENSOR%XZZ       (IKU, ISTORE) )
@@ -282,6 +289,9 @@ SUBROUTINE DATA_ARRAYS_ALLOCATE_FLYER( TPSENSOR, KSTORE )
   TPSENSOR%XLAT  = XUNDEF
   TPSENSOR%XRTZ  = XUNDEF
   TPSENSOR%XRZ   = XUNDEF
+  TPSENSOR%XPZ   = XUNDEF
+  TPSENSOR%XTZ   = XUNDEF
+  TPSENSOR%XSVZ  = XUNDEF
   TPSENSOR%XFFZ  = XUNDEF
   TPSENSOR%XWZ        = XUNDEF
   TPSENSOR%XZZ        = XUNDEF
@@ -315,6 +325,9 @@ SUBROUTINE DATA_ARRAYS_DEALLOCATE_FLYER( TPSENSOR )
   DEALLOCATE( TPSENSOR%XLAT       )
   DEALLOCATE( TPSENSOR%XRTZ       )
   DEALLOCATE( TPSENSOR%XRZ        )
+  DEALLOCATE( TPSENSOR%XPZ        )
+  DEALLOCATE( TPSENSOR%XTZ        )
+  DEALLOCATE( TPSENSOR%XSVZ       )
   DEALLOCATE( TPSENSOR%XFFZ       )
   DEALLOCATE( TPSENSOR%XWZ        )
   DEALLOCATE( TPSENSOR%XZZ        )
@@ -500,6 +513,11 @@ SUBROUTINE BUFFER_PACK_FLYER( TPSENSOR, PBUFFER, KPOS, KSTORE_CURRENT )
   PBUFFER(KPOS:KPOS+IKU*ISTORES*NRR-1) = RESHAPE( TPSENSOR%XRZ(1:IKU,1:ISTORES,1:NRR), [IKU*ISTORES*NRR] )
   KPOS = KPOS + IKU * ISTORES * NRR
 
+  PBUFFER(KPOS:KPOS+IKU*ISTORES-1) = RESHAPE( TPSENSOR%XPZ     (1:IKU,1:ISTORES), [IKU*ISTORES] ) ; KPOS = KPOS + IKU * ISTORES
+  PBUFFER(KPOS:KPOS+IKU*ISTORES-1) = RESHAPE( TPSENSOR%XTZ     (1:IKU,1:ISTORES), [IKU*ISTORES] ) ; KPOS = KPOS + IKU * ISTORES
+  PBUFFER(KPOS:KPOS+IKU*ISTORES*NSV-1) = RESHAPE( TPSENSOR%XSVZ(1:IKU,1:ISTORES,:), [IKU*ISTORES*NSV]  )
+  KPOS = KPOS + IKU * ISTORES * NSV
+
   PBUFFER(KPOS:KPOS+IKU*ISTORES-1) = RESHAPE( TPSENSOR%XFFZ (1:IKU,1:ISTORES), [IKU*ISTORES] ) ; KPOS = KPOS + IKU * ISTORES
 
   PBUFFER(KPOS:KPOS+IKU*ISTORES-1) = RESHAPE( TPSENSOR%XWZ(1:IKU,1:ISTORES), [IKU*ISTORES] ) ; KPOS = KPOS + IKU * ISTORES
@@ -714,6 +732,11 @@ SUBROUTINE BUFFER_UNPACK_FLYER( TPSENSOR, PBUFFER, KPOS, KSTORE )
   TPSENSOR%XRZ(1:IKU,1:KSTORE,1:NRR) = RESHAPE( PBUFFER(KPOS:KPOS+(KSTORE*IKU*NRR)-1), [IKU,KSTORE,NRR] )
   KPOS = KPOS + KSTORE * IKU * NRR
 
+  TPSENSOR%XPZ (1:IKU,1:KSTORE) = RESHAPE( PBUFFER(KPOS:KPOS+IKU*KSTORE-1), [ IKU, KSTORE ] ) ; KPOS = KPOS + IKU * KSTORE
+  TPSENSOR%XTZ (1:IKU,1:KSTORE) = RESHAPE( PBUFFER(KPOS:KPOS+IKU*KSTORE-1), [ IKU, KSTORE ] ) ; KPOS = KPOS + IKU * KSTORE
+  TPSENSOR%XSVZ(1:IKU,1:KSTORE,1:NSV) = RESHAPE( PBUFFER(KPOS:KPOS+IKU*KSTORE*NSV-1), [ IKU, KSTORE, NSV ] )
+  KPOS = KPOS + IKU * KSTORE * NSV
+
   TPSENSOR%XFFZ (1:IKU,1:KSTORE) = RESHAPE( PBUFFER(KPOS:KPOS+KSTORE*IKU-1), [IKU,KSTORE] ) ;  KPOS = KPOS + KSTORE * IKU
 
   TPSENSOR%XWZ(1:IKU,1:KSTORE) = RESHAPE( PBUFFER(KPOS:KPOS+KSTORE*IKU-1), [IKU,KSTORE] ) ;  KPOS = KPOS + KSTORE * IKU
diff --git a/src/MNH/modd_sensor.f90 b/src/MNH/modd_sensor.f90
index 19df53811..12fa4243e 100644
--- a/src/MNH/modd_sensor.f90
+++ b/src/MNH/modd_sensor.f90
@@ -6,7 +6,7 @@
 ! Original version:
 !  P. Wautelet: 27/04/2023
 ! Modifications:
-!  B. Vie: 21/09/2023 Add SVs and temperature to recorded variables
+!  B. Vie      21/09/2023: remove XCCZ and XCRZ + XCIZ (if LIMA)
 !-----------------------------------------------------------------
 MODULE MODD_SENSOR
   USE MODD_PARAMETERS, ONLY: NSENSORNAMELGTMAX, NNEGUNDEF, XNEGUNDEF, XUNDEF
@@ -110,9 +110,6 @@ MODULE MODD_SENSOR
 
       REAL, DIMENSION(:,:),   ALLOCATABLE :: XRHOD      ! density of dry air
       REAL, DIMENSION(:,:),   ALLOCATABLE :: XCIZ       ! Ice concentration
-      REAL, DIMENSION(:,:),   ALLOCATABLE :: XPZ        ! Pressure
-      REAL, DIMENSION(:,:),   ALLOCATABLE :: XTZ        ! Temperature
-      REAL, DIMENSION(:,:,:), ALLOCATABLE :: XSVZ       ! Scalar variables
       REAL, DIMENSION(:,:),   ALLOCATABLE :: XIWCZ      ! ice water content
       REAL, DIMENSION(:,:),   ALLOCATABLE :: XLWCZ      ! liquid water content
       REAL, DIMENSION(:,:),   ALLOCATABLE :: XCRARE     ! cloud radar reflectivity
@@ -228,25 +225,17 @@ MODULE MODD_SENSOR
       IF ( OVERTPROF ) THEN
         ALLOCATE( TPSENSOR%XRHOD(IKU, KSTORE) )      ; IVARSIZE = IVARSIZE + IKU
 
-        ALLOCATE( TPSENSOR%XSVZ  (IKU,KSTORE,NSV) )  ; IVARSIZE = IVARSIZE + IKU * NSV
-        IF ( CCLOUD == 'LIMA') THEN
-          ALLOCATE( TPSENSOR%XCIZ    (0, 0) )
-        ELSE IF ( CCLOUD(1:3) == 'ICE') THEN
+        IF ( CCLOUD(1:3) == 'ICE') THEN
           ALLOCATE( TPSENSOR%XCIZ    (IKU, KSTORE) ) ; IVARSIZE = IVARSIZE + IKU
         ELSE
           ALLOCATE( TPSENSOR%XCIZ    (0, 0) )
         END IF
 
-        ALLOCATE( TPSENSOR%XPZ       (IKU, KSTORE) ) ; IVARSIZE = IVARSIZE + IKU
-        ALLOCATE( TPSENSOR%XTZ       (IKU, KSTORE) ) ; IVARSIZE = IVARSIZE + IKU
         ALLOCATE( TPSENSOR%XIWCZ     (IKU, KSTORE) ) ; IVARSIZE = IVARSIZE + IKU
         ALLOCATE( TPSENSOR%XLWCZ     (IKU, KSTORE) ) ; IVARSIZE = IVARSIZE + IKU
         ALLOCATE( TPSENSOR%XCRARE    (IKU, KSTORE) ) ; IVARSIZE = IVARSIZE + IKU
         ALLOCATE( TPSENSOR%XCRARE_ATT(IKU, KSTORE) ) ; IVARSIZE = IVARSIZE + IKU
       ELSE
-        ALLOCATE( TPSENSOR%XSVZ    (0, 0, 0) )
-        ALLOCATE( TPSENSOR%XPZ     (0, 0) )
-        ALLOCATE( TPSENSOR%XTZ     (0, 0) )
         ALLOCATE( TPSENSOR%XRHOD   (0, 0) )
         ALLOCATE( TPSENSOR%XCIZ    (0, 0) )
         ALLOCATE( TPSENSOR%XIWCZ     (0, 0) )
@@ -268,11 +257,8 @@ MODULE MODD_SENSOR
       TPSENSOR%XSV       (:,:,:) = XUNDEF
       TPSENSOR%XTSRAD    (:)     = XUNDEF_SFX
       TPSENSOR%XRHOD_SENSOR(:)   = XNEGUNDEF
-      TPSENSOR%XPZ       (:,:)   = XUNDEF
-      TPSENSOR%XTZ       (:,:)   = XUNDEF
       TPSENSOR%XRHOD     (:,:)   = XNEGUNDEF
       TPSENSOR%XCIZ      (:,:)   = XUNDEF
-      TPSENSOR%XSVZ      (:,:,:) = XUNDEF
       TPSENSOR%XIWCZ     (:,:)   = XUNDEF
       TPSENSOR%XLWCZ     (:,:)   = XUNDEF
       TPSENSOR%XCRARE    (:,:)   = XUNDEF
@@ -305,11 +291,8 @@ MODULE MODD_SENSOR
       DEALLOCATE( TPSENSOR%XSV        )
       DEALLOCATE( TPSENSOR%XTSRAD     )
       DEALLOCATE( TPSENSOR%XRHOD_SENSOR )
-      DEALLOCATE( TPSENSOR%XPZ        )
-      DEALLOCATE( TPSENSOR%XTZ        )
       DEALLOCATE( TPSENSOR%XRHOD      )
       DEALLOCATE( TPSENSOR%XCIZ       )
-      DEALLOCATE( TPSENSOR%XSVZ       )
       DEALLOCATE( TPSENSOR%XIWCZ      )
       DEALLOCATE( TPSENSOR%XLWCZ      )
       DEALLOCATE( TPSENSOR%XCRARE     )
@@ -1018,13 +1001,10 @@ MODULE MODD_SENSOR
       PBUFFER(KPOS:KPOS+ISTORES-1) = TPSENSOR%XRHOD_SENSOR(1:ISTORES) ; KPOS = KPOS + ISTORES
 
       IF ( SIZE( TPSENSOR%XRHOD ) > 0 ) THEN
-        PBUFFER(KPOS:KPOS+IKU*ISTORES-1) = RESHAPE( TPSENSOR%XPZ       (:,1:ISTORES), [IKU*ISTORES] ) ; KPOS = KPOS + IKU * ISTORES
-        PBUFFER(KPOS:KPOS+IKU*ISTORES-1) = RESHAPE( TPSENSOR%XTZ       (:,1:ISTORES), [IKU*ISTORES] ) ; KPOS = KPOS + IKU * ISTORES
         PBUFFER(KPOS:KPOS+IKU*ISTORES-1) = RESHAPE( TPSENSOR%XRHOD     (:,1:ISTORES), [IKU*ISTORES] ) ; KPOS = KPOS + IKU * ISTORES
         IF ( CCLOUD(1:3) == 'ICE') THEN
           PBUFFER(KPOS:KPOS+IKU*ISTORES-1) = RESHAPE( TPSENSOR%XCIZ    (:,1:ISTORES), [IKU*ISTORES] ) ; KPOS = KPOS + IKU * ISTORES
         END IF
-        PBUFFER(KPOS:KPOS+IKU*ISTORES*NSV-1) = RESHAPE( TPSENSOR%XSVZ  (:,1:ISTORES,:), [IKU*ISTORES*NSV]  ) ; KPOS = KPOS + IKU * ISTORES * NSV
         PBUFFER(KPOS:KPOS+IKU*ISTORES-1) = RESHAPE( TPSENSOR%XIWCZ     (:,1:ISTORES), [IKU*ISTORES] ) ; KPOS = KPOS + IKU * ISTORES
         PBUFFER(KPOS:KPOS+IKU*ISTORES-1) = RESHAPE( TPSENSOR%XLWCZ     (:,1:ISTORES), [IKU*ISTORES] ) ; KPOS = KPOS + IKU * ISTORES
         PBUFFER(KPOS:KPOS+IKU*ISTORES-1) = RESHAPE( TPSENSOR%XCRARE    (:,1:ISTORES), [IKU*ISTORES] ) ; KPOS = KPOS + IKU * ISTORES
@@ -1144,13 +1124,10 @@ MODULE MODD_SENSOR
       TPSENSOR%XRHOD_SENSOR(1:KSTORE) = PBUFFER(KPOS:KPOS+KSTORE-1) ; KPOS = KPOS + KSTORE
 
       IF ( SIZE( TPSENSOR%XRHOD ) > 0 ) THEN
-        TPSENSOR%XPZ       (:,1:KSTORE) = RESHAPE( PBUFFER(KPOS:KPOS+IKU*KSTORE-1), [ IKU, KSTORE ] ) ; KPOS = KPOS + IKU * KSTORE
-        TPSENSOR%XTZ       (:,1:KSTORE) = RESHAPE( PBUFFER(KPOS:KPOS+IKU*KSTORE-1), [ IKU, KSTORE ] ) ; KPOS = KPOS + IKU * KSTORE
         TPSENSOR%XRHOD     (:,1:KSTORE) = RESHAPE( PBUFFER(KPOS:KPOS+IKU*KSTORE-1), [ IKU, KSTORE ] ) ; KPOS = KPOS + IKU * KSTORE
         IF ( CCLOUD(1:3) == 'ICE' ) THEN
           TPSENSOR%XCIZ    (:,1:KSTORE) = RESHAPE( PBUFFER(KPOS:KPOS+IKU*KSTORE-1), [ IKU, KSTORE ] ) ; KPOS = KPOS + IKU * KSTORE
         END IF
-        TPSENSOR%XSVZ(:,1:KSTORE,:)     = RESHAPE( PBUFFER(KPOS:KPOS+IKU*KSTORE*NSV-1), [ IKU, KSTORE, NSV ] ) ; KPOS = KPOS + IKU * KSTORE * NSV
         TPSENSOR%XIWCZ     (:,1:KSTORE) = RESHAPE( PBUFFER(KPOS:KPOS+IKU*KSTORE-1), [ IKU, KSTORE ] ) ; KPOS = KPOS + IKU * KSTORE
         TPSENSOR%XLWCZ     (:,1:KSTORE) = RESHAPE( PBUFFER(KPOS:KPOS+IKU*KSTORE-1), [ IKU, KSTORE ] ) ; KPOS = KPOS + IKU * KSTORE
         TPSENSOR%XCRARE    (:,1:KSTORE) = RESHAPE( PBUFFER(KPOS:KPOS+IKU*KSTORE-1), [ IKU, KSTORE ] ) ; KPOS = KPOS + IKU * KSTORE
diff --git a/src/MNH/profilern.f90 b/src/MNH/profilern.f90
index ba806cab9..f5b467784 100644
--- a/src/MNH/profilern.f90
+++ b/src/MNH/profilern.f90
@@ -332,8 +332,6 @@ PROFILER: DO JP = 1, NUMBPROFILER_LOC
   TPROFILERS(JP)%XW   (:,IN) = TPROFILERS(JP)%INTERP_HOR_FROM_MASSPOINT( PW )
   TPROFILERS(JP)%XTH  (:,IN) = TPROFILERS(JP)%INTERP_HOR_FROM_MASSPOINT( PTH )
   TPROFILERS(JP)%XT   (:,IN) = TPROFILERS(JP)%INTERP_HOR_FROM_MASSPOINT( ZTEMP )
-  TPROFILERS(JP)%XTZ  (:,IN) = TPROFILERS(JP)%INTERP_HOR_FROM_MASSPOINT( ZTEMP )
-  TPROFILERS(JP)%XPZ  (:,IN) = TPROFILERS(JP)%INTERP_HOR_FROM_MASSPOINT( PP )
   TPROFILERS(JP)%XTHV (:,IN) = TPROFILERS(JP)%INTERP_HOR_FROM_MASSPOINT( ZTHV )
   IF ( CCLOUD == 'C2R2' .OR. CCLOUD == 'KHKO' ) &
     TPROFILERS(JP)%XVISIGUL(:,IN) = TPROFILERS(JP)%INTERP_HOR_FROM_MASSPOINT( ZVISIGUL )
@@ -341,8 +339,7 @@ PROFILER: DO JP = 1, NUMBPROFILER_LOC
     TPROFILERS(JP)%XVISIKUN(:,IN) = TPROFILERS(JP)%INTERP_HOR_FROM_MASSPOINT( ZVISIKUN )
   TPROFILERS(JP)%XZZ  (:,IN) = ZZ(:)
   TPROFILERS(JP)%XRHOD(:,IN) = ZRHOD(:)
-  IF (CCLOUD=="LIMA") THEN
-  ELSE IF ( CCLOUD=="ICE3" .OR. CCLOUD=="ICE4" ) THEN
+  IF ( CCLOUD=="ICE3" .OR. CCLOUD=="ICE4" ) THEN
     TPROFILERS(JP)%XCIZ(:,IN) = TPROFILERS(JP)%INTERP_HOR_FROM_MASSPOINT( PCIT )
   END IF
 
@@ -358,7 +355,6 @@ PROFILER: DO JP = 1, NUMBPROFILER_LOC
     ZWORK(:,:,1,:)=PSV(:,:,2,:)
   DO JSV=1,SIZE(PSV,4)
     TPROFILERS(JP)%XSV  (:,IN,JSV) = TPROFILERS(JP)%INTERP_HOR_FROM_MASSPOINT( ZWORK(:,:,:,JSV) )
-    TPROFILERS(JP)%XSVZ (:,IN,JSV) = TPROFILERS(JP)%INTERP_HOR_FROM_MASSPOINT( ZWORK(:,:,:,JSV) )
   END DO
   ZWORK2(:,:,:,:) = 0.
   DO JK=IKB,IKE
diff --git a/src/MNH/write_aircraft_balloon.f90 b/src/MNH/write_aircraft_balloon.f90
index 56b1f20b3..5d7f04acc 100644
--- a/src/MNH/write_aircraft_balloon.f90
+++ b/src/MNH/write_aircraft_balloon.f90
@@ -449,14 +449,14 @@ if ( irr >= 7 ) call Add_profile( 'Rh', '1D Hail mixing ratio',               'k
 call Add_profile( 'FF', 'Horizontal wind', 'm s-1', tpflyer%xffz(:,:) )
 
 call Add_profile( 'T',  'Temperature',     'K',     tpflyer%xtz(:,:) )
-call Add_profile( 'P',  'Pressure',     'Pa',     tpflyer%xpz(:,:) )
+call Add_profile( 'P',  'Pressure',        'Pa',    tpflyer%xpz(:,:) )
 
 call Add_profile( 'IWC', 'Ice water content',    'kg m-3', tpflyer%xiwcz(:,:) )
 call Add_profile( 'LWC', 'Liquid water content', 'kg m-3', tpflyer%xlwcz(:,:) )
 
 call Add_profile( 'Rhod', 'Density of dry air',  'kg m-3', tpflyer%xrhod(:,:) )
 
-IF (SIZE(TPFLYER%XSVZ,3)>=1) THEN
+IF ( nsv > 0 ) THEN
   ! Scalar variables
   DO JSV = 1, NSV
     IF ( TRIM( TSVLIST(JSV)%CUNITS ) == 'ppv' ) THEN
@@ -467,8 +467,7 @@ IF (SIZE(TPFLYER%XSVZ,3)>=1) THEN
   END DO
 ENDIF
 
-IF ( CCLOUD == 'LIMA' ) THEN
-ELSE IF ( CCLOUD == 'ICE3' .OR. CCLOUD == 'ICE4' ) THEN
+IF ( CCLOUD == 'ICE3' .OR. CCLOUD == 'ICE4' ) THEN
   call Add_profile( 'CIT',     'Ice concentration',           'm-3', tpflyer%xciz(:,:) )
 END IF
 
diff --git a/src/MNH/write_profilern.f90 b/src/MNH/write_profilern.f90
index a00231ef2..b05a58c4a 100644
--- a/src/MNH/write_profilern.f90
+++ b/src/MNH/write_profilern.f90
@@ -107,7 +107,7 @@ call Sensor_write_workarrays_allocate( iku, istore, iproc )
 !Treat vertical profiles
 
 call Add_profile( 'Th',       'Potential temperature',         'K',      tpprofiler%xth        )
-call Add_profile( 'T',        'Temperature',                   'K',      tpprofiler%xtz        )
+call Add_profile( 'T',        'Temperature',                   'K',      tpprofiler%xt         )
 call Add_profile( 'Thv',      'Virtual Potential temperature', 'K',      tpprofiler%xthv       )
 if ( ccloud == 'C2R2' .or. ccloud == 'KHKO' ) &
   call Add_profile( 'VISIGUL', 'Visibility Gultepe',           'km',     tpprofiler%xvisigul   )
@@ -129,8 +129,7 @@ jproc_w = Sensor_current_processes_number_get()
 
 call Add_profile( 'TKE_DISS', 'TKE dissipation rate', 'm2 s-2', tpprofiler%xtke_diss )
 
-if ( ccloud == 'LIMA' ) then
-else if ( ccloud == 'ICE3' .or. ccloud == 'ICE4' ) then
+if ( ccloud == 'ICE3' .or. ccloud == 'ICE4' ) then
   call Add_profile( 'CIT',     'Ice concentration',           'm-3', tpprofiler%xciz(:,:) )
 end if
 
-- 
GitLab