From 7fddd50ec46a7c20ba1bcf050da3d19befdde88f Mon Sep 17 00:00:00 2001 From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr> Date: Fri, 22 Sep 2023 10:26:41 +0200 Subject: [PATCH] Philippe 22/09/2023: IO / flyers: harden check (needed for later commits) --- src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90 b/src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90 index 3f5860da5..9559f6b17 100644 --- a/src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90 +++ b/src/LIB/SURCOUCHE/src/mode_io_write_nc4.f90 @@ -2301,7 +2301,9 @@ subroutine Write_flyer_time_coord( tpflyer ) type(tdimnc), pointer :: tzdim !Do it only if correct model level and has really flown - if ( tpflyer%nmodel == imi .and. Count( tpflyer%xx /= XUNDEF) > 1 ) then + if ( tpflyer%nmodel == imi ) then + ! Do the second if only if the first one is OK (if not, xx may be not allocated) + if ( Count( tpflyer%xx /= XUNDEF) > 1 ) then Allocate( tzdim ) istatus = NF90_INQ_NCID( tpfile%nncid, 'Flyers', icatid ) @@ -2342,6 +2344,7 @@ subroutine Write_flyer_time_coord( tpflyer ) !Restore file identifier to root group incid = tpfile%nncid end if + end if end subroutine Write_flyer_time_coord -- GitLab