NCAR / ccpp-scm

CCPP Single Column Model
Other
13 stars 50 forks source link

Add fix for reading sfc fluxes for DEPHYv1 format #428

Closed hertneky closed 3 months ago

hertneky commented 5 months ago

These changes address a bug found when running SCM with DEHPYv1 cases where surface fluxes are prescribed. This addresses Issue #427

egrell commented 5 months ago

For the MPACE case, the name of the attribute was 'surface_forcing_temp'. So I changed line 494 and 496, but not 493.

        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('surface_forcing_temp') nc_fid.close() if (surfaceForcing.lower() == 'flux' or surfaceForcing.lower() == 'surface_flux'): surface_flux_spec = True

On Thu, Jan 25, 2024 at 12:51 PM Dustin Swales @.***> wrote:

@.**** requested changes on this pull request.

In scm/src/run_scm.py https://github.com/NCAR/ccpp-scm/pull/428#discussion_r1466893042:

@@ -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')

I don't think we need these changes to lines 493-494? (Just the change to line 496)

— Reply to this email directly, view it on GitHub https://github.com/NCAR/ccpp-scm/pull/428#pullrequestreview-1844568560, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADMPXGJDL2WPVOZQWUO75QDYQKZULAVCNFSM6AAAAABCJQFI6OVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTQNBUGU3DQNJWGA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

dustinswales commented 5 months ago

For the MPACE case, the name of the attribute was 'surface_forcing_temp'. So I changed line 494 and 496, but not 493. 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('surface_forcing_temp') nc_fid.close() if (surfaceForcing.lower() == 'flux' or surfaceForcing.lower() == 'surface_flux'): surface_flux_spec = True On Thu, Jan 25, 2024 at 12:51 PM Dustin Swales @.> wrote: @*.*** requested changes on this pull request. ------------------------------ In scm/src/run_scm.py <#428 (comment)>: > @@ -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') I don't think we need these changes to lines 493-494? (Just the change to line 496) — Reply to this email directly, view it on GitHub <#428 (review)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADMPXGJDL2WPVOZQWUO75QDYQKZULAVCNFSM6AAAAABCJQFI6OVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTQNBUGU3DQNJWGA . You are receiving this because you are subscribed to this thread.Message ID: @.>

@egrell Sorry, I see in the DEPHY standard that its "surface_forcing_temp".

grantfirl commented 3 months ago

@hertneky Is this ready? I'm combining several PRs into #459 for ease of merging.

grantfirl commented 3 months ago

Closing due to changes being combined into https://github.com/NCAR/ccpp-scm/pull/459.

hertneky commented 3 months ago

@grantfirl The only remaining question was...do we need to do something different since in DEPHY, the surface flux flags are separate > "surface_forcing_temp" and "surface_forcing_moist". Right now, only "surface_forcing_temp" is checked to determine whether surface fluxes are prescribed or not.