diff --git a/src/LIB/SURCOUCHE/src/mode_io_tools_nc4.f90 b/src/LIB/SURCOUCHE/src/mode_io_tools_nc4.f90 index baa8dc0abcb158f7473f1e8bcfcf6e4e6534ded6..904c8651e451f71c33504210533f9d4217465043 100644 --- a/src/LIB/SURCOUCHE/src/mode_io_tools_nc4.f90 +++ b/src/LIB/SURCOUCHE/src/mode_io_tools_nc4.f90 @@ -341,32 +341,38 @@ else Allocate( tpfile%tncdims%tdims(NMNHDIM_LASTDIM_DIACHRO) ) end if -call IO_Add_dim_nc4( tpfile, NMNHDIM_NI, 'ni', IIU_ll ) -call IO_Add_dim_nc4( tpfile, NMNHDIM_NJ, 'nj', IJU_ll ) -if ( tpfile%ctype == 'MNHOUTPUT' .and. lout_physical_simplified ) then - call IO_Add_dim_nc4( tpfile, NMNHDIM_NI_U, 'ni_u', IIU_ll ) -else - ! There is one more PHYSICAL horizontal layer for u points (but the same number for physical + unphysical borders) - call IO_Add_dim_nc4( tpfile, NMNHDIM_NI_U, 'ni_u', MIN( IIU_ll+1, IIU_MAX ) ) -end if -call IO_Add_dim_nc4( tpfile, NMNHDIM_NJ_U, 'nj_u', IJU_ll ) -call IO_Add_dim_nc4( tpfile, NMNHDIM_NI_V, 'ni_v', IIU_ll ) -if ( tpfile%ctype == 'MNHOUTPUT' .and. lout_physical_simplified ) then - call IO_Add_dim_nc4( tpfile, NMNHDIM_NJ_V, 'nj_v', IJU_ll ) -else - ! There is one more PHYSICAL horizontal layer for v points (but the same number for physical + unphysical borders) - call IO_Add_dim_nc4( tpfile, NMNHDIM_NJ_V, 'nj_v', MIN( IJU_ll+1, IJU_MAX ) ) +if ( tpfile%ctype /= 'MNHOUTPUT' .or. lout_bigbox_write ) then !Do not write dimensions of main domain if it is not written + call IO_Add_dim_nc4( tpfile, NMNHDIM_NI, 'ni', IIU_ll ) + call IO_Add_dim_nc4( tpfile, NMNHDIM_NJ, 'nj', IJU_ll ) + if ( tpfile%ctype == 'MNHOUTPUT' .and. lout_physical_simplified ) then + call IO_Add_dim_nc4( tpfile, NMNHDIM_NI_U, 'ni_u', IIU_ll ) + else + ! There is one more PHYSICAL horizontal layer for u points (but the same number for physical + unphysical borders) + call IO_Add_dim_nc4( tpfile, NMNHDIM_NI_U, 'ni_u', MIN( IIU_ll+1, IIU_MAX ) ) + end if + call IO_Add_dim_nc4( tpfile, NMNHDIM_NJ_U, 'nj_u', IJU_ll ) + call IO_Add_dim_nc4( tpfile, NMNHDIM_NI_V, 'ni_v', IIU_ll ) + if ( tpfile%ctype == 'MNHOUTPUT' .and. lout_physical_simplified ) then + call IO_Add_dim_nc4( tpfile, NMNHDIM_NJ_V, 'nj_v', IJU_ll ) + else + ! There is one more PHYSICAL horizontal layer for v points (but the same number for physical + unphysical borders) + call IO_Add_dim_nc4( tpfile, NMNHDIM_NJ_V, 'nj_v', MIN( IJU_ll+1, IJU_MAX ) ) + end if + + if ( Trim( yprogram ) /= 'PGD' .and. Trim( yprogram ) /= 'NESPGD' .and. Trim( yprogram ) /= 'ZOOMPG' & + .and. .not. ( Trim( yprogram ) == 'REAL' .and. cstorage_type == 'SU' ) ) then !condition to detect PREP_SURFEX + call IO_Add_dim_nc4( tpfile, NMNHDIM_LEVEL, 'level', IKU ) + if ( tpfile%ctype == 'MNHOUTPUT' .and. lout_physical_simplified ) then + call IO_Add_dim_nc4( tpfile, NMNHDIM_LEVEL_W, 'level_w', IKU ) + else + ! There is one more PHYSICAL vertical layer for w points (but the same number for physical + unphysical borders) + call IO_Add_dim_nc4( tpfile, NMNHDIM_LEVEL_W, 'level_w', MIN( IKU+1, IKU_MAX ) ) + end if + end if end if if ( Trim( yprogram ) /= 'PGD' .and. Trim( yprogram ) /= 'NESPGD' .and. Trim( yprogram ) /= 'ZOOMPG' & .and. .not. ( Trim( yprogram ) == 'REAL' .and. cstorage_type == 'SU' ) ) then !condition to detect PREP_SURFEX - call IO_Add_dim_nc4( tpfile, NMNHDIM_LEVEL, 'level', IKU ) - if ( tpfile%ctype == 'MNHOUTPUT' .and. lout_physical_simplified ) then - call IO_Add_dim_nc4( tpfile, NMNHDIM_LEVEL_W, 'level_w', IKU ) - else - ! There is one more PHYSICAL vertical layer for w points (but the same number for physical + unphysical borders) - call IO_Add_dim_nc4( tpfile, NMNHDIM_LEVEL_W, 'level_w', MIN( IKU+1, IKU_MAX ) ) - end if if ( tpfile%ctype /= 'MNHDIACHRONIC' ) & call IO_Add_dim_nc4( tpfile, NMNHDIM_TIME, 'time', Int( NF90_UNLIMITED, kind = Kind(1) ) ) end if diff --git a/src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90 b/src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90 index adb43c00ad325b3b70fb7ba3d14e54122cd94e66..02d4713d8f36592e634ea9781e7d28bbd385b336 100644 --- a/src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90 +++ b/src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90 @@ -1504,7 +1504,7 @@ use modd_les, only: cles_level_type, cspectra_level_type, nlesn_iinf, nle use modd_les_n, only: nles_dtcount, nles_mean_end, nles_mean_start, nles_mean_step, nles_mean_times, & nles_times, nspectra_ni, nspectra_nj, tles_dates, xles_times use modd_netcdf, only: tdimnc -use modd_out_n, only: nout_nboxes, tout_boxes +use modd_out_n, only: lout_bigbox_write, nout_nboxes, tout_boxes use modd_parameters, only: jphext, JPVEXT use modd_profiler_n, only: lprofiler, tprofilers_time use modd_series, only: lseries @@ -1784,24 +1784,27 @@ else tzdim_nj_v => Null() end if -call Write_hor_coord1d( tzdim_ni, 'x-dimension of the grid', & - trim(ystdnameprefix)//'_x_coordinate', 'X', 0., iim_bdmin, iim_bdmax, & - zxhatm_glob(iim_min:iim_max) ) -call Write_hor_coord1d( tzdim_nj, 'y-dimension of the grid', & - trim(ystdnameprefix)//'_y_coordinate', 'Y', 0., ijm_bdmin, ijm_bdmax, & - zyhatm_glob(ijm_min:ijm_max) ) -call Write_hor_coord1d( tzdim_ni_u, 'x-dimension of the grid at u location', & - trim(ystdnameprefix)//'_x_coordinate_at_u_location', 'X', -0.5, iiu_bdmin, iiu_bdmax, & - zxhat_glob(iiu_min:iiu_max) ) -call Write_hor_coord1d( tzdim_nj_u, 'y-dimension of the grid at u location', & - trim(ystdnameprefix)//'_y_coordinate_at_u_location', 'Y', 0., iju_bdmin, iju_bdmax, & - zyhatm_glob(iju_min:iju_max) ) -call Write_hor_coord1d( tzdim_ni_v, 'x-dimension of the grid at v location', & - trim(ystdnameprefix)//'_x_coordinate_at_v_location', 'X', 0., iiv_bdmin, iiv_bdmax, & - zxhatm_glob(iiv_min:iiv_max) ) -call Write_hor_coord1d( tzdim_nj_v, 'y-dimension of the grid at v location', & - trim(ystdnameprefix)//'_y_coordinate_at_v_location', 'Y', -0.5, ijv_bdmin, ijv_bdmax, & - zyhat_glob(ijv_min:ijv_max) ) + +if ( tzfile%ctype /= 'MNHOUTPUT' .or. lout_bigbox_write ) then !Do not write coordinates of main domain if it is not written + call Write_hor_coord1d( tzdim_ni, 'x-dimension of the grid', & + trim(ystdnameprefix)//'_x_coordinate', 'X', 0., iim_bdmin, iim_bdmax, & + zxhatm_glob(iim_min:iim_max) ) + call Write_hor_coord1d( tzdim_nj, 'y-dimension of the grid', & + trim(ystdnameprefix)//'_y_coordinate', 'Y', 0., ijm_bdmin, ijm_bdmax, & + zyhatm_glob(ijm_min:ijm_max) ) + call Write_hor_coord1d( tzdim_ni_u, 'x-dimension of the grid at u location', & + trim(ystdnameprefix)//'_x_coordinate_at_u_location', 'X', -0.5, iiu_bdmin, iiu_bdmax, & + zxhat_glob(iiu_min:iiu_max) ) + call Write_hor_coord1d( tzdim_nj_u, 'y-dimension of the grid at u location', & + trim(ystdnameprefix)//'_y_coordinate_at_u_location', 'Y', 0., iju_bdmin, iju_bdmax, & + zyhatm_glob(iju_min:iju_max) ) + call Write_hor_coord1d( tzdim_ni_v, 'x-dimension of the grid at v location', & + trim(ystdnameprefix)//'_x_coordinate_at_v_location', 'X', 0., iiv_bdmin, iiv_bdmax, & + zxhatm_glob(iiv_min:iiv_max) ) + call Write_hor_coord1d( tzdim_nj_v, 'y-dimension of the grid at v location', & + trim(ystdnameprefix)//'_y_coordinate_at_v_location', 'Y', -0.5, ijv_bdmin, ijv_bdmax, & + zyhat_glob(ijv_min:ijv_max) ) +end if !Warning: the following block has to be reenabled if IO_Coordvar_write_nc4 is again called for Z-split files #if 0 @@ -1828,14 +1831,16 @@ if ( .not. lcartesian ) then call Gather_hor_coord2d( zxhat, zyhat, zlatf_glob, zlonf_glob ) end if - ! Mass point - call Write_hor_coord2d( zlatm_glob, zlonm_glob, 'latitude', 'longitude', iim_min, iim_max, ijm_min, ijm_max ) - ! u point - call Write_hor_coord2d( zlatu_glob, zlonu_glob, 'latitude_u','longitude_u', iiu_min, iiu_max, iju_min, iju_max ) - ! v point - call Write_hor_coord2d( zlatv_glob, zlonv_glob, 'latitude_v','longitude_v', iiv_min, iiv_max, ijv_min, ijv_max ) - ! xi vorticity point (=f point =uv point) - call Write_hor_coord2d( zlatf_glob, zlonf_glob, 'latitude_f','longitude_f', iiu_min, iiu_max, ijv_min, ijv_max ) + if ( tzfile%ctype /= 'MNHOUTPUT' .or. lout_bigbox_write ) then !Do not write coordinates of main domain if it is not written + ! Mass point + call Write_hor_coord2d( zlatm_glob, zlonm_glob, 'latitude', 'longitude', iim_min, iim_max, ijm_min, ijm_max ) + ! u point + call Write_hor_coord2d( zlatu_glob, zlonu_glob, 'latitude_u','longitude_u', iiu_min, iiu_max, iju_min, iju_max ) + ! v point + call Write_hor_coord2d( zlatv_glob, zlonv_glob, 'latitude_v','longitude_v', iiv_min, iiv_max, ijv_min, ijv_max ) + ! xi vorticity point (=f point =uv point) + call Write_hor_coord2d( zlatf_glob, zlonf_glob, 'latitude_f','longitude_f', iiu_min, iiu_max, ijv_min, ijv_max ) + end if Deallocate( zlat, zlon ) @@ -1845,12 +1850,14 @@ if ( .not. lcartesian ) then end if if ( tzfile%lmaster ) then !vertical coordinates in the transformed space are the same on all processes - if ( Trim( yprogram ) /= 'PGD' .and. Trim( yprogram ) /= 'NESPGD' .and. Trim( yprogram ) /= 'ZOOMPG' & - .and. .not. ( Trim( yprogram ) == 'REAL' .and. cstorage_type == 'SU') ) then !condition to detect prep_surfex - call Write_ver_coord( tzfile%tncdims%tdims(NMNHDIM_LEVEL), 'position z in the transformed space', '', & - 'altitude', 0., ikm_bdmin, ikm_bdmax, ZZHATM(ikm_min:ikm_max) ) - call Write_ver_coord( tzfile%tncdims%tdims(NMNHDIM_LEVEL_W),'position z in the transformed space at w location','', & - 'altitude_at_w_location', -0.5, ikw_bdmin, ikw_bdmax, ZZHAT (ikw_min:ikw_max) ) + if ( tzfile%ctype /= 'MNHOUTPUT' .or. lout_bigbox_write ) then !Do not write coordinates of main domain if it is not written + if ( Trim( yprogram ) /= 'PGD' .and. Trim( yprogram ) /= 'NESPGD' .and. Trim( yprogram ) /= 'ZOOMPG' & + .and. .not. ( Trim( yprogram ) == 'REAL' .and. cstorage_type == 'SU') ) then !condition to detect prep_surfex + call Write_ver_coord( tzfile%tncdims%tdims(NMNHDIM_LEVEL), 'position z in the transformed space', '', & + 'altitude', 0., ikm_bdmin, ikm_bdmax, ZZHATM(ikm_min:ikm_max) ) + call Write_ver_coord( tzfile%tncdims%tdims(NMNHDIM_LEVEL_W),'position z in the transformed space at w location','', & + 'altitude_at_w_location', -0.5, ikw_bdmin, ikw_bdmax, ZZHAT (ikw_min:ikw_max) ) + end if end if end if