Skip to content

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

@jbensabat

Description

@jbensabat

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions