diff --git a/src/MNH/mode_les_diachro.f90 b/src/MNH/mode_les_diachro.f90 index 3bef1bc2405da3c47a9a50e825420ebe317527b3..bf7af4a955bdcf6648077a73cff4178bb2b89881 100644 --- a/src/MNH/mode_les_diachro.f90 +++ b/src/MNH/mode_les_diachro.f90 @@ -842,8 +842,8 @@ end subroutine Les_diachro_3D subroutine Les_diachro_4D( tpdiafile, tpfield, hgroup, hgroupcomment, odoavg, odonorm, pfield, hsuffixes, hmasks ) !################################################################################################################# -use modd_field, only: NMNHDIM_BUDGET_LES_LEVEL, NMNHDIM_BUDGET_LES_MASK, NMNHDIM_BUDGET_LES_SV, & - NMNHDIM_BUDGET_LES_TIME, NMNHDIM_BUDGET_TERM, NMNHDIM_UNUSED, & +use modd_field, only: NMNHDIM_BUDGET_LES_LEVEL, NMNHDIM_BUDGET_LES_MASK, NMNHDIM_BUDGET_LES_PDF, NMNHDIM_BUDGET_LES_SV, & + NMNHDIM_BUDGET_LES_TIME, NMNHDIM_BUDGET_TERM, NMNHDIM_UNUSED, & tfield_metadata_base use modd_io, only: tfiledata @@ -880,10 +880,13 @@ if ( tzfield%ndimlist(1) == NMNHDIM_BUDGET_LES_LEVEL& call Print_msg( NVERB_ERROR, 'IO', 'Les_diachro_4D', & 'optional dummy argument hmasks is needed for tpfield (' // Trim( tzfield%cmnhname ) // ')' ) + if ( Present( hsuffixes ) ) & + call Print_msg( NVERB_ERROR, 'IO', 'Les_diachro_4D', & + 'optional dummy argument hsuffixes is not needed for tpfield (' // Trim( tzfield%cmnhname ) // ')' ) + if ( Size( hmasks ) /= Size( pfield, 3) ) & call Print_msg( NVERB_FATAL, 'IO', 'Les_diachro_4D', 'wrong size for hmasks (' // Trim( tzfield%cmnhname ) // ')' ) - call Les_diachro_common( tpdiafile, tzfield, hgroup, hgroupcomment, pfield, odoavg, odonorm, hmasks = hmasks ) else if ( tzfield%ndimlist(1) == NMNHDIM_BUDGET_LES_LEVEL & .and. tzfield%ndimlist(2) == NMNHDIM_BUDGET_LES_TIME & .and. tzfield%ndimlist(3) == NMNHDIM_BUDGET_TERM & @@ -892,15 +895,36 @@ else if ( tzfield%ndimlist(1) == NMNHDIM_BUDGET_LES_LEVEL & call Print_msg( NVERB_ERROR, 'IO', 'Les_diachro_4D', & 'optional dummy argument hsuffixes is needed for tpfield (' // Trim( tzfield%cmnhname ) // ')' ) + if ( Present( hmasks ) ) & + call Print_msg( NVERB_ERROR, 'IO', 'Les_diachro_4D', & + 'optional dummy argument hmasks is not needed for tpfield (' // Trim( tzfield%cmnhname ) // ')' ) + if ( Size( hsuffixes ) /= Size( pfield, 3) ) & call Print_msg( NVERB_FATAL, 'IO', 'Les_diachro_4D', 'wrong size for hsuffixes (' // Trim( tzfield%cmnhname ) // ')' ) - call Les_diachro_common( tpdiafile, tzfield, hgroup, hgroupcomment, pfield, odoavg, odonorm, hsuffixes= hsuffixes ) +else if ( tzfield%ndimlist(1) == NMNHDIM_BUDGET_LES_LEVEL & + .and. tzfield%ndimlist(2) == NMNHDIM_BUDGET_LES_TIME & + .and. tzfield%ndimlist(3) == NMNHDIM_BUDGET_LES_MASK & + .and. tzfield%ndimlist(4) == NMNHDIM_BUDGET_LES_PDF ) then + if ( .not. Present( hmasks ) ) & + call Print_msg( NVERB_ERROR, 'IO', 'Les_diachro_4D', & + 'optional dummy argument hmasks is needed for tpfield (' // Trim( tzfield%cmnhname ) // ')' ) + + if ( Present( hsuffixes ) ) & + call Print_msg( NVERB_ERROR, 'IO', 'Les_diachro_4D', & + 'optional dummy argument hsuffixes is not needed for tpfield (' // Trim( tzfield%cmnhname ) // ')' ) + + if ( Size( hmasks ) /= Size( pfield, 3) ) & + call Print_msg( NVERB_FATAL, 'IO', 'Les_diachro_4D', 'wrong size for hmasks (' // Trim( tzfield%cmnhname ) // ')' ) + else call Print_msg( NVERB_ERROR, 'IO', 'Les_diachro_4D', & 'ndimlist configuration not yet implemented for ' // Trim( tzfield%cmnhname ) ) end if +call Les_diachro_common( tpdiafile, tzfield, hgroup, hgroupcomment, pfield, odoavg, odonorm, & + hsuffixes = hsuffixes, hmasks = hmasks ) + end subroutine Les_diachro_4D !##################################################################################################################### diff --git a/src/MNH/write_diachro.f90 b/src/MNH/write_diachro.f90 index d78c07c1d517c474bde97f793383808a6f9d5be7..4dfae1c2ab6a681a218086ff44e1b4638b9394f1 100644 --- a/src/MNH/write_diachro.f90 +++ b/src/MNH/write_diachro.f90 @@ -1272,6 +1272,13 @@ select case ( idims ) do ji = 1, Size( pvar, 6 ) call Diachro_one_field_write_nc4( tzfile, tpbudiachro, tpfields(ji), pvar(:,:,:,:,:,ji:ji), [ 3, 4 ], gsplit, gdistributed ) end do + else if ( tpfields(1)%ndimlist(3) == NMNHDIM_BUDGET_LES_LEVEL & + .and. ( tpfields(1)%ndimlist(4) == NMNHDIM_BUDGET_LES_TIME & + .or. tpfields(1)%ndimlist(4) == NMNHDIM_BUDGET_LES_AVG_TIME ) & + .and. tpfields(1)%ndimlist(5) == NMNHDIM_BUDGET_LES_PDF ) then + if ( Size( tpfields ) /= 1 ) call Print_msg( NVERB_FATAL, 'IO', 'Write_diachro_nc4', & + 'wrong size of tpfields (variable '//trim(tpfields(1)%cmnhname)//')' ) + call Diachro_one_field_write_nc4( tzfile, tpbudiachro, tpfields(1), pvar, [ 3, 4, 5 ], gsplit, gdistributed ) else if ( tpfields(1)%ndimlist(3) == NMNHDIM_BUDGET_LES_LEVEL & .and. ( tpfields(1)%ndimlist(4) == NMNHDIM_BUDGET_LES_TIME & .or. tpfields(1)%ndimlist(4) == NMNHDIM_BUDGET_LES_AVG_TIME ) & diff --git a/src/MNH/write_lesn.f90 b/src/MNH/write_lesn.f90 index 3ddc8353765636afce5c7319c125e0110d721114..1369cb378249bfbe9d38b9925d2d77117bde88a8 100644 --- a/src/MNH/write_lesn.f90 +++ b/src/MNH/write_lesn.f90 @@ -80,6 +80,7 @@ subroutine Write_les_n( tpdiafile ) use modd_conf_n, only: luserv, luserc, luserr, luseri, lusers, luserg, luserh use modd_io, only: tfiledata use modd_field, only: NMNHDIM_BUDGET_LES_TIME, NMNHDIM_BUDGET_LES_LEVEL, NMNHDIM_BUDGET_LES_SV, NMNHDIM_BUDGET_LES_MASK, & + NMNHDIM_BUDGET_LES_PDF, & NMNHDIM_SPECTRA_2PTS_NI, NMNHDIM_SPECTRA_2PTS_NJ, NMNHDIM_SPECTRA_LEVEL, NMNHDIM_UNUSED, & TYPEREAL use modd_grid_n, only: xdxhat, xdyhat @@ -386,6 +387,13 @@ if ( lles_pdf ) then cgroup = 'PDF' cgroupcomment = '' + tfield%ndims = 4 + !tfield%ndimlist(1) = NMNHDIM_BUDGET_LES_LEVEL + !tfield%ndimlist(2) = NMNHDIM_BUDGET_LES_TIME + !tfield%ndimlist(3) = NMNHDIM_BUDGET_LES_MASK + tfield%ndimlist(4) = NMNHDIM_BUDGET_LES_PDF + tfield%ndimlist(5:) = NMNHDIM_UNUSED + call Les_diachro_write( tpdiafile, XLES_PDF_TH, 'PDF_TH', 'Pdf potential temperature Profiles', '1', ymasks ) call Les_diachro_write( tpdiafile, XLES_PDF_W, 'PDF_W', 'Pdf vertical velocity Profiles', '1', ymasks ) call Les_diachro_write( tpdiafile, XLES_PDF_THV, 'PDF_THV', 'Pdf virtual pot. temp. Profiles', '1', ymasks )