From 5624774484172b4eb03dd3bc30a60da2c4fe00fe Mon Sep 17 00:00:00 2001 From: ronesy <rlt@nilu.no> Date: Fri, 28 Feb 2025 11:10:38 +0100 Subject: [PATCH] changed read_obs.f90 to deal with different length of satellite name and in mod_settings.f90 updated default values and tests for parameters --- source/mod_settings.f90 | 42 ++++++++++++++++++++++------------------- source/read_obs.f90 | 7 ++++++- 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/source/mod_settings.f90 b/source/mod_settings.f90 index d6c7405..b49c866 100644 --- a/source/mod_settings.f90 +++ b/source/mod_settings.f90 @@ -44,7 +44,6 @@ module mod_settings character(len=max_path_len) :: path_flexpart ! path to flexpart output for ground-based obs character(len=max_path_len) :: path_flexsat ! path to flexpart output for satellite obs character(len=max_path_len) :: path_flexncdf ! path to flexpart netcdf output (from previous run) -! character(len=max_path_len) :: path_satrel ! path to satellite releases info character(len=max_path_len) :: file_bg ! prior best guess file character(len=max_name_len) :: suffix ! observation file suffix character(len=max_name_len) :: file_log ! log file name @@ -403,9 +402,6 @@ module mod_settings identifier = "path_flexncdf:" call read_content (line, identifier, cc, cn, cl, match) if ( match ) files%path_flexncdf = cc -! identifier = "path_satrel:" -! call read_content (line, identifier, cc, cn, cl, match) -! if ( match ) files%path_satrel = cc identifier = "path_output:" call read_content (line, identifier, cc, cn, cl, match) if ( match ) files%path_output = cc @@ -650,17 +646,17 @@ module mod_settings config%selectobs = .false. !initialize values for config, overwritten by any values in SETTINGS_config file - config%trunc = 1.e-3 - config%ffferr = 1.e-3 - config%coeff = 1.0 - config%measerr = 1.e-3 - config%cinierr = 1.e-3 - config%flxerr = 1.e-3 - config%flxerr_ll = 1.e-9 - config%sigma_land = 150. - config%sigma_ocean = 2000. - config%sigmatime = 15. - config%globerr = -1 + config%trunc = 1.e-6 + config%ffferr = -999. + config%coeff = -999. + config%measerr = -999. + config%cinierr = -999. + config%flxerr = -999. + config%flxerr_ll = -999. + config%sigma_land = -999. + config%sigma_ocean = -999. + config%sigmatime = -999. + config%globerr = -1. ! open file open (100, file = trim (filename), status = 'old', iostat=ierr) @@ -920,10 +916,10 @@ module mod_settings print*, 'ERROR: uncorrect value of sigma_ocean' stop endif - if ( config%sigmatime.lt.0 ) then - print*, 'ERROR: uncorrect value of sigmatime' - stop - endif + endif + if ( config%sigmatime.lt.0 ) then + print*, 'ERROR: uncorrect value of sigmatime' + stop endif if ( config%measerr.lt.0 ) then print*, 'ERROR: uncorrect value of measerr' @@ -937,10 +933,18 @@ module mod_settings print*, 'ERROR: uncorrect value of flxerr' stop endif + if ( (config%spec.eq.'co2').and.(config%ffferr.lt.0) ) then + print*, 'ERROR: uncorrect value of ffferr' + stop + endif if ( config%flxerr_ll.lt.0 ) then print*, 'ERROR: uncorrect value of flxerr_ll' stop endif + if ( config%coeff.lt.0 ) then + print*, 'ERROR: uncorrect value of coeff' + stop + endif if ( config%lognormal ) then print*, 'MESSAGE: lognormal inversion needs M1QN3 method' config%method = 'm1qn3' diff --git a/source/read_obs.f90 b/source/read_obs.f90 index 7110f02..47dc6c7 100755 --- a/source/read_obs.f90 +++ b/source/read_obs.f90 @@ -38,6 +38,8 @@ subroutine read_obs(config, files) type (files_t), intent(in) :: files character(len=max_path_len), dimension(:), allocatable :: filelist character(len=max_path_len) :: rowfmt, numfmt, filerelease + character(len=max_path_len), dimension(4) :: args + integer :: narg character(len=recname_len) :: recs character(len=50) :: species, before, sep character(len=200) :: header, string @@ -113,7 +115,10 @@ subroutine read_obs(config, files) ! --------- ! check if data is in inversion time interval - read(before(19:26),*) yyyymmdd + call parse_string(before,"_",args,narg) + adate = args(narg) + print*, 'read_obs: adate = ',adate + read(adate,*) yyyymmdd jdate = juldate(yyyymmdd, 0) if ( jdate.lt.juldatei.or.jdate.gt.juldatef ) cycle -- GitLab