From 1ba5a444dbdfcc466b55de038175b44e2ea46409 Mon Sep 17 00:00:00 2001 From: RussTreadon-NOAA Date: Tue, 19 Sep 2023 17:45:57 +0000 Subject: [PATCH 1/4] replace Time with Obs_Time in setuprad netcdf, add inquire to init_directories (#623) --- src/gsi/obsmod.F90 | 17 +++++++++++------ src/gsi/setuprad.f90 | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/gsi/obsmod.F90 b/src/gsi/obsmod.F90 index 26f8ff1bbf..b6b562d138 100644 --- a/src/gsi/obsmod.F90 +++ b/src/gsi/obsmod.F90 @@ -1022,12 +1022,12 @@ subroutine init_directories(in_pe,num_pe) integer(i_kind),intent(in ) :: in_pe integer(i_kind),intent(in ) :: num_pe - logical :: l_mkdir_stat + logical :: l_mkdir_stat, l_dir_exist character(len=144):: command character(len=8):: pe_name, loc_pe_name character(len=128):: loc_dirname - integer(i_kind) :: i + integer(i_kind) :: i, ierror if (lrun_subdirs) then write(pe_name,'(i4.4)') in_pe @@ -1038,10 +1038,15 @@ subroutine init_directories(in_pe,num_pe) write(loc_pe_name,'(i4.4)') i loc_dirname = 'dir.'//trim(loc_pe_name) #ifdef __INTEL_COMPILER - l_mkdir_stat = MAKEDIRQQ(trim(loc_dirname)) - if(.not. l_mkdir_stat) then - write(6, *) "Failed to create directory ", trim(loc_dirname), " for PE ", loc_pe_name - call stop2(678) + INQUIRE(directory=trim(loc_dirname), exist=l_dir_exist) + if (.not.l_dir_exist) then + l_mkdir_stat = MAKEDIRQQ(trim(loc_dirname)) + if(.not.l_mkdir_stat) then + ierror=GETLASTERRORQQ() + write(6, *) "INIT_DIRECTORIES: ***ERROR** Failed to create directory ", & + trim(loc_dirname)," for PE ", loc_pe_name, ' ierror= ' + call stop2(678) + endif endif #else command = 'mkdir -p -m 755 ' // trim(loc_dirname) diff --git a/src/gsi/setuprad.f90 b/src/gsi/setuprad.f90 index ebdd8de52a..803965b351 100644 --- a/src/gsi/setuprad.f90 +++ b/src/gsi/setuprad.f90 @@ -2575,7 +2575,7 @@ subroutine contents_netcdf_diag_(odiags,idv,iob) call nc_diag_metadata_to_single("Elevation",zsges ) ! model (guess) elevation at observation location - call nc_diag_metadata_to_single("Time",dtime,time_offset,'-') + call nc_diag_metadata_to_single("Obs_Time",dtime,time_offset,'-') call nc_diag_metadata_to_single("Scan_Position",data_s(iscan_pos,n) ) ! sensor scan position call nc_diag_metadata_to_single("Sat_Zenith_Angle", zasat,rad2deg,'*') ! satellite zenith angle (degrees) From 4fdbd2f164dafbee94f2a24a01f68540662296b5 Mon Sep 17 00:00:00 2001 From: RussTreadon-NOAA Date: Tue, 19 Sep 2023 19:32:30 +0000 Subject: [PATCH 2/4] replace Obs_Time with Time in aod netcdf diagnostic ouptut (#623) --- src/gsi/setupaod.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gsi/setupaod.f90 b/src/gsi/setupaod.f90 index 5fe4233ada..58707acd6a 100644 --- a/src/gsi/setupaod.f90 +++ b/src/gsi/setupaod.f90 @@ -844,7 +844,7 @@ subroutine contents_netcdf_diag_ call nc_diag_metadata("Observation_Class", obsclass) call nc_diag_metadata_to_single("Latitude",(cenlat)) ! observation latitude (degrees) call nc_diag_metadata_to_single("Longitude",(cenlon)) ! observation longitude (degrees) - call nc_diag_metadata_to_single("Obs_Time",(dtime))!-time_offset)) ! observation time (hours relative to analysis time) + call nc_diag_metadata_to_single("Time",(dtime))!-time_offset)) ! observation time (hours relative to analysis time) call nc_diag_metadata_to_single("Sol_Zenith_Angle",(pangs)) ! solar zenith angle (degrees) call nc_diag_metadata_to_single("Sol_Azimuth_Angle",(data_s(isazi_ang,n))) ! solar azimuth angle (degrees) call nc_diag_metadata("Surface_type", nint(data_s(istyp,n))) From 45eff7041bc42bfa15340423727643ef51a0b924 Mon Sep 17 00:00:00 2001 From: RussTreadon-NOAA Date: Thu, 21 Sep 2023 15:11:01 +0000 Subject: [PATCH 3/4] use integer for setupozlev Analysis_Use_Flag (#623) --- src/gsi/setupoz.f90 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gsi/setupoz.f90 b/src/gsi/setupoz.f90 index d7a85de0b2..7112e967ba 100644 --- a/src/gsi/setupoz.f90 +++ b/src/gsi/setupoz.f90 @@ -1720,6 +1720,7 @@ subroutine contents_netcdf_diag_(odiag) type(obs_diag),pointer,intent(in):: odiag ! Observation class character(7),parameter :: obsclass = ' ozlev' + integer(i_kind),parameter :: ione = 1 real(r_kind),dimension(miter) :: obsdiag_iuse call nc_diag_metadata_to_single("Latitude", data(ilate,i) ) call nc_diag_metadata_to_single("Longitude", data(ilone,i) ) @@ -1731,9 +1732,9 @@ subroutine contents_netcdf_diag_(odiag) call nc_diag_metadata_to_single("Obs_Minus_Forecast_unadjusted",ozone_inv ) call nc_diag_metadata_to_single("Reference_Pressure", preso3l*r100 ) ! Pa if(luse(i)) then - call nc_diag_metadata_to_single("Analysis_Use_Flag", one ) + call nc_diag_metadata("Analysis_Use_Flag", ione ) else - call nc_diag_metadata_to_single("Analysis_Use_Flag", -one ) + call nc_diag_metadata("Analysis_Use_Flag", -ione ) endif call nc_diag_metadata_to_single("Input_Observation_Error",obserror ) From 2bc4f13f78ae6c42199e1ab4464362151075aa0f Mon Sep 17 00:00:00 2001 From: Russ-Treadon-NOAA Date: Mon, 25 Sep 2023 16:28:02 +0000 Subject: [PATCH 4/4] add error flag to error message printout (#629) --- src/gsi/obsmod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gsi/obsmod.F90 b/src/gsi/obsmod.F90 index b6b562d138..633bde91ab 100644 --- a/src/gsi/obsmod.F90 +++ b/src/gsi/obsmod.F90 @@ -1044,7 +1044,7 @@ subroutine init_directories(in_pe,num_pe) if(.not.l_mkdir_stat) then ierror=GETLASTERRORQQ() write(6, *) "INIT_DIRECTORIES: ***ERROR** Failed to create directory ", & - trim(loc_dirname)," for PE ", loc_pe_name, ' ierror= ' + trim(loc_dirname)," for PE ", loc_pe_name, ' ierror= ', ierror call stop2(678) endif endif