Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix update for domain-added buffer in LDT #447

Merged
merged 2 commits into from
Jan 31, 2020

Conversation

karsenau
Copy link
Contributor

Added new checks and code to address when a buffer is added around
a subsetted parameter domain in relation to target LIS domain.

Addresses issue #446, as reported by S. Kumar

 Added new checks and code to address when a buffer is added around
  a subsetted parameter domain in relation to target LIS domain.
@emkemp emkemp self-assigned this Jan 27, 2020
@emkemp emkemp added the BugFix Fixes bug found in code label Jan 27, 2020
@emkemp emkemp self-requested a review January 27, 2020 21:04
@emkemp
Copy link
Contributor

emkemp commented Jan 27, 2020

I found a problem when running with GFORTRAN with strict checks. A dimension mismatch occurs in ldt/core/LDT_fileIOMod.F90. I put in several lines to print out the dimensions in question:

diff --git a/ldt/core/LDT_fileIOMod.F90 b/ldt/core/LDT_fileIOMod.F90
index 84d9e24..1163558 100644
--- a/ldt/core/LDT_fileIOMod.F90
+++ b/ldt/core/LDT_fileIOMod.F90
@@ -1142,6 +1142,14 @@ subroutine LDT_create_daobs_filename(n, fname)
case ( "latlon" )

!- Initialize parameter read-in array:
+

  •  if (subpnc .ne. LDT_rc%lnc(n) .or. &
    
  •       subpnr .ne. LDT_rc%lnr(n)) then
    
  •     write(LDT_logunit,*)'EMK: subpnc, subpnr = ', subpnc, subpnr
    
  •     write(LDT_logunit,*)'EMK: lnc, lnr = ', LDT_rc%lnc(n), &
    
  •           LDT_rc%lnr(n)
    
  •  end if
    
  • allocate( read_inputparm(subpnc, subpnr) )
    read_inputparm = LDT_rc%udef
    

And I see this:

EMK: subpnc, subpnr = 474 234
EMK: lnc, lnr = 464 224

GFORTRAN reports this error (note the line number is affected by the print statements I added):

Fortran runtime error: Array bound mismatch for dimension 1 of array 'array' (46
4/474)

Error termination. Backtrace:
#0 0x7711fa in _ldt_fileiomod_MOD_readparam_real_2d
at ../core/LDT_fileIOMod.F90:1186
#1 0xdb2fad in read_hymap_river_width

at ../params/HYMAP/read_HYMAP_river_width.F90:60
#2 0x52a777 in __hymap_parmsmod_MOD_hymapparms_init
at ../params/HYMAP/HYMAP_parmsMod.F90:416
#3 0x87786b in ???
#4 0x87771a in __ldt_routingparamprocmod_MOD_ldt_routingparams_init
at ../core/LDT_routingParamProcMod.F90:39
#5 0x85808c in _ldt_paramprocmod_MOD_ldt_paramprocinit
at ../core/LDT_paramProcMod.F90:147
#6 0x7c586b in ldt_init_lsmparamproc

at ../runmodes/LSMparamproc/LDT_init_LSMparamproc.F90:18
#7 0x898751 in ???
#8 0x923136 in ldtmain
at ../main/LDTmain.F90:39
#9 0x923231 in main
at ../main/LDTmain.F90:20

The code that trips the stack trace is this:

!- Select grid spatial transform option:
if( gridtransform_opt == "none" ) then
write(LDT_logunit,*) " No aggregation applied for parameter file ... "
array(:,:,1) = read_inputparm(:,:) ! <<< EMK HERE IS THE BUG

else
!- Transform parameter from original grid to LIS output grid:
call LDT_transform_paramgrid( n, gridtransform_opt, &
subparam_gridDesc, mi, numtiles, gi, li, mo, go1, lo1 )

endif

The array and read_inputparm arrays must have the same dimensions, but they do not. I'm afraid more work is needed.

@emkemp
Copy link
Contributor

emkemp commented Jan 27, 2020

To clarify, this occurs when I use the ldt.config_noahmp.nldasgrid_all file in the /discover/nobackup/projects/lis/Projects/LDT/LISF_Testcases/LDTDomain_Buffer/NLDAS

 - Added new checks for when to apply a buffer around
   a parameter file target subdomain.
 - Added new LDT config option for user to select whether
   to include a buffer for parameter domains or not. Default
   is buffer is turned on, but with checks in place to turn
   off if not needed.
 - Minor LDT log message updates to the HyMAP routines in LDT.
 - Documented new domain buffer option in LDT config.adoc file.
@karsenau
Copy link
Contributor Author

New updates have been made to fix the issues introduced with adding a buffer around a target parameter grid. New checks and a new LDT config option included, which is only turned on if the user includes the option in their ldt.config file. Thus, users do not need to include the new option in their ldt.config files. I updated the ldt.config.adoc documentation supporting this new option.

Also, just made a minor change to an "error" LDT log statement in the HyMAP parameter reader routines in LDT.

@emkemp
Copy link
Contributor

emkemp commented Jan 31, 2020

Thanks Kristi! I'm testing this now.

Copy link
Contributor

@emkemp emkemp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm satisfied with the test results and the code changes. I approve.

@emkemp emkemp merged commit 24e79d6 into NASA-LIS:master Jan 31, 2020
@karsenau
Copy link
Contributor Author

Thank you for testing the latest updates and approving the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BugFix Fixes bug found in code NotReady
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants