From c5bf21effd261a8045da9b9d6427b1b420c5b0cc Mon Sep 17 00:00:00 2001 From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr> Date: Wed, 19 May 2021 11:19:58 +0200 Subject: [PATCH] Philippe 19/05/2021: budgets: modify tbudiachrometadata type to better respect diachro file structure (1st step) --- src/MNH/modd_budget.f90 | 14 +++---- src/MNH/mode_les_diachro.f90 | 16 ++++---- src/MNH/write_aircraft_balloon.f90 | 12 +++--- src/MNH/write_budget.f90 | 8 ++-- src/MNH/write_diachro.f90 | 64 +++++++++++++++--------------- src/MNH/write_profilern.f90 | 4 +- src/MNH/write_seriesn.f90 | 12 +++--- src/MNH/write_stationn.f90 | 4 +- 8 files changed, 66 insertions(+), 68 deletions(-) diff --git a/src/MNH/modd_budget.f90 b/src/MNH/modd_budget.f90 index 0a02d5480..312b4f519 100644 --- a/src/MNH/modd_budget.f90 +++ b/src/MNH/modd_budget.f90 @@ -106,13 +106,13 @@ type, extends( tfield_metadata_base ) :: tburhodata end type tburhodata type :: tbudiachrometadata - character(len=NBUNAMELGTMAX) :: cname = CNOTSET - character(len=NCOMMENTLGTMAX) :: ccomment = CNOTSET - character(len=NBUNAMELGTMAX) :: ccategory = CNOTSET !budget, LES, aircraft, balloon, series, station, profiler - character(len=NBUNAMELGTMAX) :: cgroupname = CNOTSET - character(len=NBUNAMELGTMAX) :: cshape = CNOTSET !Shape of the domain (mask, cartesian, vertical profile, point) - character(len=NBUNAMELGTMAX) :: cmask = CNOTSET !Mask defining where data is of meaning - character(len=1) :: cdirection = '' !Used for 2pt correlation and spectrum + character(len=NCOMMENTLGTMAX) :: ccomment = CNOTSET + character(len=NBUNAMELGTMAX) :: ccategory = CNOTSET !budget, LES, aircraft, balloon, series, station, profiler + character(len=NBUNAMELGTMAX) :: csubcategory = CNOTSET + character(len=NBUNAMELGTMAX) :: cgroup = CNOTSET + character(len=NBUNAMELGTMAX) :: cshape = CNOTSET !Shape of the domain (mask, cartesian, vertical profile, point) + character(len=NBUNAMELGTMAX) :: cmask = CNOTSET !Mask defining where data is of meaning + character(len=1) :: cdirection = '' !Used for 2pt correlation and spectrum logical :: lmobile = .false. !Is the domain moving? (ie for aircrafts and balloons) logical :: licompress = .false. logical :: ljcompress = .false. diff --git a/src/MNH/mode_les_diachro.f90 b/src/MNH/mode_les_diachro.f90 index 3be9be3bd..8284d3749 100644 --- a/src/MNH/mode_les_diachro.f90 +++ b/src/MNH/mode_les_diachro.f90 @@ -1068,10 +1068,10 @@ if ( iresp == 0 .and. any( zfield /= XUNDEF ) ) then tzfields(:)%clongname = ytitle(:) tzfields(:)%ccomment = ycomment(:) - tzbudiachro%cname = ygroup !tzbudiachro%ccomment = DONE BEFORE tzbudiachro%ccategory = 'LES' - tzbudiachro%cgroupname = ygroup +! tzbudiachro%csubcategory = CNOTSET + tzbudiachro%cgroup = ygroup tzbudiachro%cshape = 'cartesian' tzbudiachro%lmobile = .false. tzbudiachro%licompress = .true. @@ -1259,14 +1259,14 @@ if ( gavg ) then end do end if -tzbudiachro%cname = ygroup if ( .not. gavg ) then tzbudiachro%ccomment = tzfield%ccomment else tzbudiachro%ccomment = Trim( tzfield%ccomment ) // ' (time averaged)' end if tzbudiachro%ccategory = 'LES' -tzbudiachro%cgroupname = ygroup +! tzbudiachro%csubcategory = CNOTSET +tzbudiachro%cgroup = ygroup tzbudiachro%cshape = '2-point correlation' ! tzbudiachro%cmask = CNOTSET if ( tzfield%ndimlist(1) == NMNHDIM_SPECTRA_2PTS_NI ) then @@ -1421,10 +1421,10 @@ tzfield%cmnhname = ygroup tzfield%clongname = ygroup tzfield%ccomment = ycomment(:) -tzbudiachro%cname = ygroup tzbudiachro%ccomment = tzfield%ccomment tzbudiachro%ccategory = 'LES' -tzbudiachro%cgroupname = ygroup +! tzbudiachro%csubcategory = CNOTSET +tzbudiachro%cgroup = ygroup tzbudiachro%cshape = 'spectrum' ! tzbudiachro%cmask = CNOTSET if ( tzfield%ndimlist(1) == NMNHDIM_SPECTRA_SPEC_NI ) then @@ -1459,10 +1459,10 @@ end do tzfield%cmnhname = ygroup tzfield%clongname = ygroup -tzbudiachro%cname = ygroup tzbudiachro%ccomment = Trim( tzfield%ccomment ) // ' (time averaged)' tzbudiachro%ccategory = 'LES' -tzbudiachro%cgroupname = ygroup +! tzbudiachro%csubcategory = CNOTSET +tzbudiachro%cgroup = ygroup tzbudiachro%cshape = 'spectrum' ! tzbudiachro%cmask = CNOTSET if ( tzfield%ndimlist(1) == NMNHDIM_SPECTRA_SPEC_NI ) then diff --git a/src/MNH/write_aircraft_balloon.f90 b/src/MNH/write_aircraft_balloon.f90 index fc6126822..3dac58df8 100644 --- a/src/MNH/write_aircraft_balloon.f90 +++ b/src/MNH/write_aircraft_balloon.f90 @@ -854,10 +854,10 @@ tzfields(:)%ndimlist(4) = NMNHDIM_FLYER_TIME tzfields(:)%ndimlist(5) = NMNHDIM_UNUSED tzfields(:)%ndimlist(6) = NMNHDIM_FLYER_PROC -tzbudiachro%cname = ygroup tzbudiachro%ccomment = 'Values at position of flyer ' // Trim( tpflyer%title ) -call Aircraft_balloon_longtype_get( tpflyer, tzbudiachro%ccategory ) -tzbudiachro%cgroupname = ygroup +tzbudiachro%ccategory = 'flyer' +call Aircraft_balloon_longtype_get( tpflyer, tzbudiachro%csubcategory ) +tzbudiachro%cgroup = ygroup tzbudiachro%cshape = 'point' ! tzbudiachro%cmask = NOT SET (default values) tzbudiachro%lmobile = .true. @@ -895,10 +895,10 @@ tzfields(:)%ndimlist(4) = NMNHDIM_FLYER_TIME tzfields(:)%ndimlist(5) = NMNHDIM_UNUSED tzfields(:)%ndimlist(6) = NMNHDIM_FLYER_PROC -tzbudiachro%cname = ygroupz tzbudiachro%ccomment = 'Vertical profiles at position of flyer ' // Trim( tpflyer%title ) -! tzbudiachro%ccategory = !unchanged -tzbudiachro%cgroupname = ygroupz +! tzbudiachro%ccategory = !unchanged +! tzbudiachro%csubcategory = !unchanged +tzbudiachro%cgroup = ygroupz tzbudiachro%cshape = 'vertical profile' ! tzbudiachro%cmask = NOT SET (default values) tzbudiachro%lmobile = .true. diff --git a/src/MNH/write_budget.f90 b/src/MNH/write_budget.f90 index 92f38a920..b8df85236 100644 --- a/src/MNH/write_budget.f90 +++ b/src/MNH/write_budget.f90 @@ -537,10 +537,10 @@ subroutine Store_one_budget_rho( tpdiafile, tpdates, tprhodj, knocompress, prhod tzfield%ndimlist(:) = NMNHDIM_UNKNOWN end if - tzbudiachro%cname = tprhodj%cmnhname tzbudiachro%ccomment = tprhodj%ccomment tzbudiachro%ccategory = 'budget' - tzbudiachro%cgroupname = 'RhodJ' +! tzbudiachro%csubcategory = NOT SET (default values) + tzbudiachro%cgroup = 'RhodJ' if ( ybutype == 'CART' ) then tzbudiachro%cshape = 'cartesian' ! tzbudiachro%cmask = NOT SET (default values) @@ -795,10 +795,10 @@ subroutine Store_one_budget( tpdiafile, tpdates, tpbudget, prhodjn, knocompress, end if end do - tzbudiachro%cname = tpbudget%cname tzbudiachro%ccomment = tpbudget%ccomment tzbudiachro%ccategory = 'budget' - tzbudiachro%cgroupname = ygroup_name +! tzbudiachro%csubcategory = NOT SET (default values) + tzbudiachro%cgroup = ygroup_name if ( ybutype == 'CART' ) then tzbudiachro%cshape = 'cartesian' ! tzbudiachro%cmask = NOT SET (default values) diff --git a/src/MNH/write_diachro.f90 b/src/MNH/write_diachro.f90 index c8ecee7cb..fe8308520 100644 --- a/src/MNH/write_diachro.f90 +++ b/src/MNH/write_diachro.f90 @@ -226,28 +226,28 @@ tzfile%cformat = 'LFI' YCOMMENT='NOTHING' !Set ygroup to preserve backward compatibility of LFI files -if ( Any( tpbudiachro%cgroupname == [ 'UU', 'VV', 'WW', 'TH', 'TK', 'RV', 'RC', 'RR', 'RI', 'RS', 'RG', 'RH' ] ) & - .or. ( tpbudiachro%cgroupname(1:2) == 'SV' .and. Len_trim( tpbudiachro%cgroupname ) == 5 ) ) then +if ( Any( tpbudiachro%cgroup == [ 'UU', 'VV', 'WW', 'TH', 'TK', 'RV', 'RC', 'RR', 'RI', 'RS', 'RG', 'RH' ] ) & + .or. ( tpbudiachro%cgroup(1:2) == 'SV' .and. Len_trim( tpbudiachro%cgroup ) == 5 ) ) then Allocate( character(len=9) :: ygroup ) - ygroup(:) = Trim( tpbudiachro%cgroupname ) - do ji = Len_trim( tpbudiachro%cgroupname ) + 1, 5 + ygroup(:) = Trim( tpbudiachro%cgroup ) + do ji = Len_trim( tpbudiachro%cgroup ) + 1, 5 ygroup(ji : ji) = '_' end do Write( ygroup(6:9), '( i4.4 )' ) nbutshift -else if ( tpbudiachro%cgroupname == 'RhodJ' ) then +else if ( tpbudiachro%cgroup == 'RhodJ' ) then Allocate( character(len=9) :: ygroup ) - if ( tpbudiachro%cname == 'RhodJX' ) then + if ( tpfields(1)%cmnhname == 'RhodJX' ) then ygroup(1:3) = 'RJX' - else if ( tpbudiachro%cname == 'RhodJY' ) then + else if ( tpfields(1)%cmnhname == 'RhodJY' ) then ygroup(1:3) = 'RJY' - else if ( tpbudiachro%cname == 'RhodJZ' ) then + else if ( tpfields(1)%cmnhname == 'RhodJZ' ) then ygroup(1:3) = 'RJZ' - else if ( tpbudiachro%cname == 'RhodJS' ) then + else if ( tpfields(1)%cmnhname == 'RhodJS' ) then ygroup(1:3) = 'RJS' else call Print_msg( NVERB_ERROR, 'IO', 'Write_diachro_lfi', & - 'unknown variable ' // Trim( tpbudiachro%cname ) // ' for group ' // Trim( tpbudiachro%cgroupname ) ) + 'unknown variable ' // Trim( tpfields(1)%cmnhname ) // ' for group ' // Trim( tpbudiachro%cgroup ) ) end if ygroup(4:5) = '__' @@ -256,7 +256,7 @@ else if ( tpbudiachro%nsv > 0 ) then Allocate( character(len=9) :: ygroup ) Write( ygroup, '( "SV", i3.3, i4.4 )' ) tpbudiachro%nsv, nbutshift else - ygroup = Trim( tpbudiachro%cgroupname ) + ygroup = Trim( tpbudiachro%cgroup ) end if !Recompute old TYPE for backward compatibility @@ -272,10 +272,7 @@ else if ( ycategory == 'LES' ) then else ytype = 'SPXY' end if -else if ( ycategory == 'aircraft' & - .or. ycategory == 'radiosonde balloon' & - .or. ycategory == 'iso-density balloon' & - .or. ycategory == 'constant volume balloon' ) then +else if ( ycategory == 'flyer' ) then if ( yshape == 'point' ) then ytype = 'RSPL' else @@ -804,7 +801,7 @@ tzfile%cformat = 'NETCDF4' ycategory = Trim( tpbudiachro%ccategory ) yshape = Trim( tpbudiachro%cshape ) -ygroup = Trim( tpbudiachro%cgroupname ) +ygroup = Trim( tpbudiachro%cgroup ) iil = tpbudiachro%nil iih = tpbudiachro%nih @@ -852,7 +849,7 @@ MASTER: if ( isp == tzfile%nmaster_rank) then gleveluse(NLVL_SUBCATEGORY) = .false. gleveluse(NLVL_GROUP) = .true. - ylevelnames(NLVL_GROUP) = Trim( tpbudiachro%cgroupname ) + ylevelnames(NLVL_GROUP) = Trim( tpbudiachro%cgroup ) gleveluse(NLVL_SHAPE) = .false. ylevelnames(NLVL_SHAPE) = Trim( tpbudiachro%cshape ) @@ -919,7 +916,8 @@ MASTER: if ( isp == tzfile%nmaster_rank) then gleveluse(NLVL_SUBCATEGORY) = .false. gleveluse(NLVL_GROUP) = .true. - ylevelnames(NLVL_GROUP) = Trim( tpbudiachro%cgroupname ) + ylevelnames(NLVL_GROUP) = Trim( tpbudiachro%cgroup ) +! ylevelcomments(NLVL_GROUP) = gleveluse(NLVL_SHAPE) = .false. ylevelnames(NLVL_SHAPE) = Trim( tpbudiachro%cshape ) @@ -936,7 +934,7 @@ MASTER: if ( isp == tzfile%nmaster_rank) then gleveluse(NLVL_SUBCATEGORY) = .false. gleveluse(NLVL_GROUP) = .true. - ylevelnames(NLVL_GROUP) = Trim( tpbudiachro%cgroupname ) + ylevelnames(NLVL_GROUP) = Trim( tpbudiachro%cgroup ) gleveluse(NLVL_SHAPE) = .false. ylevelnames(NLVL_SHAPE) = Trim( tpbudiachro%cshape ) @@ -945,17 +943,17 @@ MASTER: if ( isp == tzfile%nmaster_rank) then gleveluse(NLVL_NORM) = .false. gleveluse(NLVL_MASK) = .false. - case( 'aircraft', 'radiosonde balloon', 'iso-density balloon', 'constant volume balloon' ) + case( 'flyer' ) gleveluse(NLVL_CATEGORY) = .true. ylevelnames(NLVL_CATEGORY) = 'Flyers' ylevelcomments(NLVL_CATEGORY) = 'Group for the different flyers (aircrafts and balloons)' gleveluse(NLVL_SUBCATEGORY) = .true. - ylevelnames(NLVL_SUBCATEGORY) = ycategory + ylevelnames(NLVL_SUBCATEGORY) = tpbudiachro%csubcategory ylevelcomments(NLVL_SUBCATEGORY) = 'Group for the different ' // Trim( ycategory ) // 's' gleveluse(NLVL_GROUP) = .true. - ylevelnames(NLVL_GROUP) = Trim( tpbudiachro%cgroupname ) + ylevelnames(NLVL_GROUP) = Trim( tpbudiachro%cgroup ) gleveluse(NLVL_SHAPE) = .true. ylevelnames(NLVL_SHAPE) = Trim( tpbudiachro%cshape ) @@ -974,7 +972,7 @@ MASTER: if ( isp == tzfile%nmaster_rank) then gleveluse(NLVL_SUBCATEGORY) = .false. gleveluse(NLVL_GROUP) = .true. - ylevelnames(NLVL_GROUP) = Trim( tpbudiachro%cgroupname ) + ylevelnames(NLVL_GROUP) = Trim( tpbudiachro%cgroup ) gleveluse(NLVL_SHAPE) = .false. ylevelnames(NLVL_SHAPE) = Trim( tpbudiachro%cshape ) @@ -982,7 +980,7 @@ MASTER: if ( isp == tzfile%nmaster_rank) then gleveluse(NLVL_TIMEAVG) = .false. gleveluse(NLVL_NORM) = .false. - if ( Trim( tpbudiachro%cgroupname ) == 'TSERIES' .or. Trim( tpbudiachro%cgroupname ) == 'ZTSERIES' ) then + if ( Trim( tpbudiachro%cgroup ) == 'TSERIES' .or. Trim( tpbudiachro%cgroup ) == 'ZTSERIES' ) then gleveluse(NLVL_MASK) = .true. ylevelnames(NLVL_MASK) = tpbudiachro%cmask else @@ -1053,9 +1051,9 @@ MASTER: if ( isp == tzfile%nmaster_rank) then if ( ( ycategory == 'budget' .and. yshape == 'cartesian' ) & .or. ycategory == 'LES' & - .or. tpbudiachro%cgroupname == 'TSERIES' & - .or. tpbudiachro%cgroupname == 'ZTSERIES' & - .or. tpbudiachro%cgroupname(1:8) == 'XTSERIES' ) then + .or. tpbudiachro%cgroup == 'TSERIES' & + .or. tpbudiachro%cgroup == 'ZTSERIES' & + .or. tpbudiachro%cgroup(1:8) == 'XTSERIES' ) then call Att_write( ylevelname, ilevelid, 'min I index in physical domain', iil ) call Att_write( ylevelname, ilevelid, 'max I index in physical domain', iih ) call Att_write( ylevelname, ilevelid, 'min J index in physical domain', ijl ) @@ -1063,9 +1061,9 @@ MASTER: if ( isp == tzfile%nmaster_rank) then end if if ( ( ycategory == 'budget' .and. yshape == 'cartesian' ) & - .or. tpbudiachro%cgroupname == 'TSERIES' & - .or. tpbudiachro%cgroupname == 'ZTSERIES' & - .or. tpbudiachro%cgroupname(1:8) == 'XTSERIES' ) then + .or. tpbudiachro%cgroup == 'TSERIES' & + .or. tpbudiachro%cgroup == 'ZTSERIES' & + .or. tpbudiachro%cgroup(1:8) == 'XTSERIES' ) then call Att_write( ylevelname, ilevelid, 'min K index in physical domain', ikl ) call Att_write( ylevelname, ilevelid, 'max K index in physical domain', ikh ) end if @@ -1073,9 +1071,9 @@ MASTER: if ( isp == tzfile%nmaster_rank) then if ( ( ycategory == 'budget' .and. yshape == 'cartesian' ) & .or. ( ycategory == 'LES' .and. yshape == 'cartesian' ) & - .or. tpbudiachro%cgroupname == 'TSERIES' & - .or. tpbudiachro%cgroupname == 'ZTSERIES' & - .or. tpbudiachro%cgroupname(1:8) == 'XTSERIES' ) then + .or. tpbudiachro%cgroup == 'TSERIES' & + .or. tpbudiachro%cgroup == 'ZTSERIES' & + .or. tpbudiachro%cgroup(1:8) == 'XTSERIES' ) then call Att_write( ylevelname, ilevelid, & 'averaged in the I direction', Merge( 'yes', 'no ', tpbudiachro%licompress ) ) call Att_write( ylevelname, ilevelid, & diff --git a/src/MNH/write_profilern.f90 b/src/MNH/write_profilern.f90 index 5dd83fc80..7a9e728fb 100644 --- a/src/MNH/write_profilern.f90 +++ b/src/MNH/write_profilern.f90 @@ -650,10 +650,10 @@ tzfields(:)%ndimlist(4) = NMNHDIM_PROFILER_TIME tzfields(:)%ndimlist(5) = NMNHDIM_UNUSED tzfields(:)%ndimlist(6) = NMNHDIM_PROFILER_PROC -tzbudiachro%cname = ygroup tzbudiachro%ccomment = 'Vertical profiles at position of profiler ' // Trim( ygroup ) tzbudiachro%ccategory = 'profiler' -tzbudiachro%cgroupname = ygroup +! tzbudiachro%csubcategory = NOT SET (default values) +tzbudiachro%cgroup = ygroup tzbudiachro%cshape = 'vertical profile' ! tzbudiachro%cmask = NOT SET (default values) tzbudiachro%lmobile = .false. diff --git a/src/MNH/write_seriesn.f90 b/src/MNH/write_seriesn.f90 index e8a677364..4ec7e6a57 100644 --- a/src/MNH/write_seriesn.f90 +++ b/src/MNH/write_seriesn.f90 @@ -261,10 +261,10 @@ tzfields(:)%ndimlist(5) = NMNHDIM_UNUSED ! tzfields(:)%ndimlist(6) = NMNHDIM_SERIES_PROC tzfields(:)%ndimlist(6) = NMNHDIM_UNUSED !Set to unused because write are done in a loop (1 write per "process") -tzbudiachro%cname = 'TSERIES' tzbudiachro%ccomment = 'Time series of horizontally and vertically averaged fields' tzbudiachro%ccategory = 'time series' -tzbudiachro%cgroupname = 'TSERIES' +! tzbudiachro%csubcategory = NOT SET (default values) +tzbudiachro%cgroup = 'TSERIES' tzbudiachro%cshape = 'cartesian' !It is based on a cartesian domain (with compression in all directions) ! tzbudiachro%cmask = set in the process loop tzbudiachro%lmobile = .false. @@ -366,10 +366,10 @@ tzfields(:)%ndimlist(5) = NMNHDIM_UNUSED ! tzfields(:)%ndimlist(6) = NMNHDIM_SERIES_PROC tzfields(:)%ndimlist(6) = NMNHDIM_UNUSED !Set to unused because write are done in a loop (1 write per "process") -tzbudiachro%cname = 'ZTSERIES' tzbudiachro%ccomment = 'Time series of horizontally averaged vertical profile' tzbudiachro%ccategory = 'time series' -tzbudiachro%cgroupname = 'ZTSERIES' +! tzbudiachro%csubcategory = NOT SET (default values) +tzbudiachro%cgroup = 'ZTSERIES' tzbudiachro%cshape = 'cartesian' !It is based on a cartesian domain (with horizontal compression) ! tzbudiachro%cmask = set in the process loop tzbudiachro%lmobile = .false. @@ -473,10 +473,10 @@ DO JS=1,NBJSLICE tzfields(:)%ndimlist(5) = NMNHDIM_UNUSED tzfields(:)%ndimlist(6) = NMNHDIM_SERIES_PROC - tzbudiachro%cname = ygroup tzbudiachro%ccomment = 'Time series of y-horizontally averaged fields at one level or vertically averaged between 2 levels' tzbudiachro%ccategory = 'time series' - tzbudiachro%cgroupname = ygroup +! tzbudiachro%csubcategory = NOT SET (default values) + tzbudiachro%cgroup = ygroup tzbudiachro%cshape = 'cartesian' !It is based on a cartesian domain (with compression in 1 direction) ! tzbudiachro%cmask = NOT SET (default values) tzbudiachro%lmobile = .false. diff --git a/src/MNH/write_stationn.f90 b/src/MNH/write_stationn.f90 index 8697653f9..61cb5cb77 100644 --- a/src/MNH/write_stationn.f90 +++ b/src/MNH/write_stationn.f90 @@ -735,10 +735,10 @@ tzfields(:)%ndimlist(4) = NMNHDIM_STATION_TIME tzfields(:)%ndimlist(5) = NMNHDIM_UNUSED tzfields(:)%ndimlist(6) = NMNHDIM_STATION_PROC -tzbudiachro%cname = ygroup tzbudiachro%ccomment = 'Values at position of station ' // Trim( ygroup ) tzbudiachro%ccategory = 'station' -tzbudiachro%cgroupname = ygroup +! tzbudiachro%csubcategory = NOT SET (default values) +tzbudiachro%cgroup = ygroup tzbudiachro%cshape = 'point' ! tzbudiachro%cmask = NOT SET (default values) tzbudiachro%lmobile = .false. -- GitLab