From af90e7ddb7613350bd476b319329e68d87695af0 Mon Sep 17 00:00:00 2001 From: Tracy Date: Wed, 24 Jan 2024 15:10:52 -0700 Subject: [PATCH 1/6] Add fix for reading sfc fluxes for DHEPHYv1 format --- scm/src/run_scm.py | 6 +++--- scm/src/scm_input.F90 | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scm/src/run_scm.py b/scm/src/run_scm.py index 20cfbce6a..64ad23559 100755 --- a/scm/src/run_scm.py +++ b/scm/src/run_scm.py @@ -490,10 +490,10 @@ def setup_rundir(self): if input_type == 1: #open the case data file and read the surfaceForcing global attribute case_data_dir = case_nml['case_config']['case_data_dir'] - nc_fid = Dataset(os.path.join(SCM_ROOT, case_data_dir) + '/' + self._case + '_SCM_driver.nc' , 'r') - surfaceForcing = nc_fid.getncattr('surfaceForcing') + nc_fid = Dataset(os.path.join(SCM_ROOT, self._case_data_dir) + '/' + self._case + '_SCM_driver.nc' , 'r') + surfaceForcing = nc_fid.getncattr('surface_forcing_temp') nc_fid.close() - if (surfaceForcing.lower() == 'flux' or surfaceForcing.lower() == 'surfaceflux'): + if (surfaceForcing.lower() == 'flux' or surfaceForcing.lower() == 'surface_flux'): surface_flux_spec = True except KeyError: # if not using DEPHY format, check to see if surface fluxes are specified in the case configuration file (default is False) diff --git a/scm/src/scm_input.F90 b/scm/src/scm_input.F90 index a39404366..cc3effcd5 100644 --- a/scm/src/scm_input.F90 +++ b/scm/src/scm_input.F90 @@ -950,7 +950,7 @@ subroutine get_case_init_DEPHY(scm_state, scm_input) real(kind=sp) :: z_nudging_temp, z_nudging_theta, z_nudging_thetal, z_nudging_qv, z_nudging_qt, z_nudging_rv, z_nudging_rt, z_nudging_u, z_nudging_v real(kind=sp) :: p_nudging_temp, p_nudging_theta, p_nudging_thetal, p_nudging_qv, p_nudging_qt, p_nudging_rv, p_nudging_rt, p_nudging_u, p_nudging_v character(len=5) :: input_surfaceType - character(len=11) :: input_surfaceForcingWind='',input_surfaceForcingMoist='',input_surfaceForcingLSM='',input_surfaceForcingTemp='' + character(len=12) :: input_surfaceForcingWind='',input_surfaceForcingMoist='',input_surfaceForcingLSM='',input_surfaceForcingTemp='' ! initial variables (IC = Initial Condition) real(kind=dp), allocatable :: input_lat(:) !< column latitude (deg) @@ -1630,7 +1630,7 @@ subroutine get_case_init_DEPHY(scm_state, scm_input) call NetCDF_read_var(ncid, "wprvp_s", .False., input_force_wprvp) call NetCDF_read_var(ncid, "wprtp_s", .False., input_force_wprtp) else if (trim(input_surfaceForcingMoist) == 'surface_flux') then - call NetCDF_read_var(ncid, "hfls", .False., input_force_sfc_sens_flx) + call NetCDF_read_var(ncid, "hfls", .False., input_force_sfc_lat_flx) endif ! From 85336198f5a5a82d2b96bd4452949866ca8d0319 Mon Sep 17 00:00:00 2001 From: Tracy Date: Thu, 25 Jan 2024 14:14:53 -0700 Subject: [PATCH 2/6] Revert case data dir change --- scm/src/run_scm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scm/src/run_scm.py b/scm/src/run_scm.py index 64ad23559..26ea900e1 100755 --- a/scm/src/run_scm.py +++ b/scm/src/run_scm.py @@ -490,7 +490,7 @@ def setup_rundir(self): if input_type == 1: #open the case data file and read the surfaceForcing global attribute case_data_dir = case_nml['case_config']['case_data_dir'] - nc_fid = Dataset(os.path.join(SCM_ROOT, self._case_data_dir) + '/' + self._case + '_SCM_driver.nc' , 'r') + nc_fid = Dataset(os.path.join(SCM_ROOT, case_data_dir) + '/' + self._case + '_SCM_driver.nc' , 'r') surfaceForcing = nc_fid.getncattr('surface_forcing_temp') nc_fid.close() if (surfaceForcing.lower() == 'flux' or surfaceForcing.lower() == 'surface_flux'): From 05c75e42bf55cdc2273cda0825111d9ffd3d4f5e Mon Sep 17 00:00:00 2001 From: Tracy Date: Fri, 23 Feb 2024 14:01:06 -0700 Subject: [PATCH 3/6] correctly assign case_data_dir for reading in surface_flux attribute --- scm/src/run_scm.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scm/src/run_scm.py b/scm/src/run_scm.py index 26ea900e1..f3c73fc00 100755 --- a/scm/src/run_scm.py +++ b/scm/src/run_scm.py @@ -470,6 +470,8 @@ def setup_rundir(self): case_nml['case_config']['n_itt_diag'] = self._n_itt_diag if self._timestep: case_nml['case_config']['dt'] = self._timestep + if self._case_data_dir: + case_nml['case_config']['case_data_dir'] = self._case_data_dir # look for the output_dir variable in the case configuration namelist and use it if it does; # if it doesn't exist, create a default output directory name (from the case and suite names) and create a namelist patch try: From 540a586635d9c26ed3a3bccaa98976d63d248843 Mon Sep 17 00:00:00 2001 From: Tracy Date: Fri, 23 Feb 2024 14:26:45 -0700 Subject: [PATCH 4/6] Assign surface_flux_spec a default value > fixes CI failure for MAGIC_LEG04A caused by now reading the case_data_dir correctly from previous commit --- scm/src/run_scm.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scm/src/run_scm.py b/scm/src/run_scm.py index f3c73fc00..b2b10a87b 100755 --- a/scm/src/run_scm.py +++ b/scm/src/run_scm.py @@ -490,6 +490,7 @@ def setup_rundir(self): try: input_type = case_nml['case_config']['input_type'] if input_type == 1: + surface_flux_spec = False #open the case data file and read the surfaceForcing global attribute case_data_dir = case_nml['case_config']['case_data_dir'] nc_fid = Dataset(os.path.join(SCM_ROOT, case_data_dir) + '/' + self._case + '_SCM_driver.nc' , 'r') From 29c6963a1663927ef3adc1011589f3458691b5af Mon Sep 17 00:00:00 2001 From: Tracy Date: Wed, 27 Mar 2024 11:26:15 -0600 Subject: [PATCH 5/6] revert to previous fix for assigning the case_data_dir --- scm/src/run_scm.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scm/src/run_scm.py b/scm/src/run_scm.py index b2b10a87b..d0f5a10e1 100755 --- a/scm/src/run_scm.py +++ b/scm/src/run_scm.py @@ -492,8 +492,7 @@ def setup_rundir(self): if input_type == 1: surface_flux_spec = False #open the case data file and read the surfaceForcing global attribute - case_data_dir = case_nml['case_config']['case_data_dir'] - nc_fid = Dataset(os.path.join(SCM_ROOT, case_data_dir) + '/' + self._case + '_SCM_driver.nc' , 'r') + nc_fid = Dataset(os.path.join(SCM_ROOT, self._case_data_dir) + '/' + self._case + '_SCM_driver.nc' , 'r') surfaceForcing = nc_fid.getncattr('surface_forcing_temp') nc_fid.close() if (surfaceForcing.lower() == 'flux' or surfaceForcing.lower() == 'surface_flux'): From dda1d46631230bab36c802c65796fb1477e3e1ae Mon Sep 17 00:00:00 2001 From: Tracy Date: Wed, 27 Mar 2024 11:30:33 -0600 Subject: [PATCH 6/6] rm from nml --- scm/src/run_scm.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/scm/src/run_scm.py b/scm/src/run_scm.py index d0f5a10e1..926fb68ba 100755 --- a/scm/src/run_scm.py +++ b/scm/src/run_scm.py @@ -470,8 +470,6 @@ def setup_rundir(self): case_nml['case_config']['n_itt_diag'] = self._n_itt_diag if self._timestep: case_nml['case_config']['dt'] = self._timestep - if self._case_data_dir: - case_nml['case_config']['case_data_dir'] = self._case_data_dir # look for the output_dir variable in the case configuration namelist and use it if it does; # if it doesn't exist, create a default output directory name (from the case and suite names) and create a namelist patch try: