From c18c7f65621d2bc2d27e8fe87b9cf64b12fcd953 Mon Sep 17 00:00:00 2001
From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr>
Date: Thu, 13 Jul 2023 11:20:02 +0200
Subject: [PATCH] Philippe 13/07/2023: stations/profilers: simplify + improve
 PROFILER_ADD and STATION_ADD

---
 src/MNH/statprof_tools.f90 | 43 +++-----------------------------------
 1 file changed, 3 insertions(+), 40 deletions(-)

diff --git a/src/MNH/statprof_tools.f90 b/src/MNH/statprof_tools.f90
index 2752493ad..86c3d36c4 100644
--- a/src/MNH/statprof_tools.f90
+++ b/src/MNH/statprof_tools.f90
@@ -170,7 +170,7 @@ END SUBROUTINE STATPROF_POSITION
 ! ###################################
 SUBROUTINE PROFILER_ADD( TPPROFILER )
 ! ###################################
-! Subroutine to add a station to the local list of profilers
+! Subroutine to add a profiler to the local list of profilers
   USE MODD_PROFILER_n, ONLY: NUMBPROFILER_LOC, TPROFILERS
 
   IMPLICIT NONE
@@ -187,25 +187,7 @@ SUBROUTINE PROFILER_ADD( TPPROFILER )
     TZPROFILERS(JS) = TPROFILERS(JS)
   END DO
 
-  !Copy fields available in TSTATPROFDATA
-  !other fields are not yet set
-  TZPROFILERS(NUMBPROFILER_LOC)%CNAME    = TPPROFILER%CNAME
-  TZPROFILERS(NUMBPROFILER_LOC)%CTYPE    = 'PROFILER'
-  TZPROFILERS(NUMBPROFILER_LOC)%NID      = TPPROFILER%NID
-  TZPROFILERS(NUMBPROFILER_LOC)%XX_CUR   = TPPROFILER%XX_CUR
-  TZPROFILERS(NUMBPROFILER_LOC)%XY_CUR   = TPPROFILER%XY_CUR
-  TZPROFILERS(NUMBPROFILER_LOC)%XZ_CUR   = TPPROFILER%XZ_CUR
-  TZPROFILERS(NUMBPROFILER_LOC)%XLON_CUR = TPPROFILER%XLON_CUR
-  TZPROFILERS(NUMBPROFILER_LOC)%XLAT_CUR = TPPROFILER%XLAT_CUR
-  TZPROFILERS(NUMBPROFILER_LOC)%NI_M     = TPPROFILER%NI_M
-  TZPROFILERS(NUMBPROFILER_LOC)%NJ_M     = TPPROFILER%NJ_M
-  TZPROFILERS(NUMBPROFILER_LOC)%NI_U     = TPPROFILER%NI_U
-  TZPROFILERS(NUMBPROFILER_LOC)%NJ_V     = TPPROFILER%NJ_V
-  TZPROFILERS(NUMBPROFILER_LOC)%XXMCOEF  = TPPROFILER%XXMCOEF
-  TZPROFILERS(NUMBPROFILER_LOC)%XYMCOEF  = TPPROFILER%XYMCOEF
-  TZPROFILERS(NUMBPROFILER_LOC)%XXUCOEF  = TPPROFILER%XXUCOEF
-  TZPROFILERS(NUMBPROFILER_LOC)%XYVCOEF  = TPPROFILER%XYVCOEF
-  TZPROFILERS(NUMBPROFILER_LOC)%CTYPE    = TPPROFILER%CTYPE
+  TZPROFILERS(NUMBPROFILER_LOC)  = TPPROFILER
 
   IF ( ASSOCIATED( TPROFILERS ) ) DEALLOCATE( TPROFILERS ) !Can be done without memory leak because allocatable arrays were
                                                            !not yet allocated (will be done in PROFILER_ALLOCATE)
@@ -233,26 +215,7 @@ SUBROUTINE STATION_ADD( TPSTATION )
     TZSTATIONS(JS) = TSTATIONS(JS)
   END DO
 
-  !Copy fields available in TSTATPROFDATA
-  !other fields are not yet set
-  TZSTATIONS(NUMBSTAT_LOC)%CNAME    = TPSTATION%CNAME
-  TZSTATIONS(NUMBSTAT_LOC)%CTYPE    = 'STATION'
-  TZSTATIONS(NUMBSTAT_LOC)%NID      = TPSTATION%NID
-  TZSTATIONS(NUMBSTAT_LOC)%XX_CUR   = TPSTATION%XX_CUR
-  TZSTATIONS(NUMBSTAT_LOC)%XY_CUR   = TPSTATION%XY_CUR
-  TZSTATIONS(NUMBSTAT_LOC)%XZ_CUR   = TPSTATION%XZ_CUR
-  TZSTATIONS(NUMBSTAT_LOC)%XLON_CUR = TPSTATION%XLON_CUR
-  TZSTATIONS(NUMBSTAT_LOC)%XLAT_CUR = TPSTATION%XLAT_CUR
-  TZSTATIONS(NUMBSTAT_LOC)%NI_M     = TPSTATION%NI_M
-  TZSTATIONS(NUMBSTAT_LOC)%NJ_M     = TPSTATION%NJ_M
-  TZSTATIONS(NUMBSTAT_LOC)%NI_U     = TPSTATION%NI_U
-  TZSTATIONS(NUMBSTAT_LOC)%NJ_V     = TPSTATION%NJ_V
-  TZSTATIONS(NUMBSTAT_LOC)%XXMCOEF  = TPSTATION%XXMCOEF
-  TZSTATIONS(NUMBSTAT_LOC)%XYMCOEF  = TPSTATION%XYMCOEF
-  TZSTATIONS(NUMBSTAT_LOC)%XXUCOEF  = TPSTATION%XXUCOEF
-  TZSTATIONS(NUMBSTAT_LOC)%XYVCOEF  = TPSTATION%XYVCOEF
-  TZSTATIONS(NUMBSTAT_LOC)%NK       = TPSTATION%NK
-  TZSTATIONS(NUMBSTAT_LOC)%XZMEAS   = TPSTATION%XZMEAS
+  TZSTATIONS(NUMBSTAT_LOC) = TPSTATION
 
   IF ( ASSOCIATED( TSTATIONS ) ) DEALLOCATE( TSTATIONS ) !Can be done without memory leak because allocatable arrays were
                                                          !not yet allocated (will be done in STATION_ALLOCATE)
-- 
GitLab