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

A problem in WRFHYDRO 5.2 - Hydro_IO reading fulldom_hires.nc #709

Open
jbensabat opened this issue Sep 22, 2023 · 0 comments
Open

A problem in WRFHYDRO 5.2 - Hydro_IO reading fulldom_hires.nc #709

jbensabat opened this issue Sep 22, 2023 · 0 comments

Comments

@jbensabat
Copy link

This file seems to be organized such that the North-West corner of the domain corresponds to index (1,1) in the 2D arrays read in this file, while the lower resolution file it is the South-West corner of the domain that corresponds to index (1,1)
this is the routine

 subroutine readRT2d_int(var_name, inv, ixrt, jxrt, fileName, fatalErr)
     implicit none
     INTEGER, INTENT(IN) :: ixrt,jxrt
     INTEGER :: i, j, ii,jj
     CHARACTER(len=*):: var_name,fileName
     integer, INTENT(OUT), dimension(ixrt,jxrt) :: inv
     integer, dimension(ixrt,jxrt) :: inv_tmp
     logical, optional, intent(in) :: fatalErr
     logical :: fatalErr_local
     fatalErr_local = .FALSE.
     if(present(fatalErr)) fatalErr_local=fatalErr
     call  get2d_int(var_name,inv_tmp,ixrt,jxrt,trim(fileName), fatalErr=fatalErr_local)

     jj = jxrt
     do j = 1, jxrt
        inv(:,j) = inv_tmp(:,jj)
        jj = jxrt - j
     end do

 end SUBROUTINE readRT2d_int

Expected Behavior

I would expect that the loop at the end of the routine reverts the rows of the 2D arrays so they are compatible with the low resolution ones
for example if we have a matrix (11,12,13,14)
(21,22,23,24)
(31,32,33,34)
I would expect to transform it to (31,32,33,34)
(21,22,23,24)
(11,12,13,14)

while in fact this loop creates the following matrix (13,12,11,0)
(23,22,21,0)
(33,32,31,0)

If I correct the code is swaping columns and not rows

a correct version of the code would be

    jj = jxrt
     do j = 1, jxrt
        inv(j,:) = inv_tmp(jj:,)
        jj = jxrt - j
     end do

I am not sufficiently acquainted with the code and I would be grateful if you could help in determining if this is a bug or if I am mistaken
best
jac

Your Environment

  • Version of the code used: 5.2
  • Operating System and version: Windows 10
  • Compiler and version: Intel visual Fortran , Version 19
  • Other relevant information:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant