-
Notifications
You must be signed in to change notification settings - Fork 9
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
adding test for 4.9 #125
adding test for 4.9 #125
Conversation
lvl_type1 = 'xxx' | ||
scale_fac1 = 0 | ||
scaled_val1 = 0 | ||
lvl_type2 = 'xxx' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@EricJames-NOAA as with 4.46, this is letting me use 'xxx' as a lvl_type. Is that expected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@edwardhartnett lvl_type is a character type variable...that should be fine for a test. In real application, it will be text indicating one of these options:
https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-5.shtml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The table you indicate has integer codes. Why are these types char array?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the subroutine call get_g2_fixedsurfacetypes matches the text string with the integer value using the table4_5. You can see the lvl_type is type char array for other templates too (for example g2sec4_temp0).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, here's the code:
!> This subroutine returns the corresponding GRIB2 - Fixed Surface Types and Units
!> value for a given short key name based on Table 4.5 of Section 4, Octets 23 and 29
!>
!> @param[in] key - GRIB2 character short key for fixed surface types from Table 4.5
!> @param[out] value - corresponding GRIB2 value from Table 4.5
!> @param[out] ierr - 0 for success, 9 if key not found
!>
!> @author V. Krishna Kumar ORG: W/NP12 @date 2009-12-10
subroutine get_g2_fixedsurfacetypes(key, value, ierr)
character(len=*) :: key
integer :: value, n, ierr
!
ierr = 0
do n=1, MAXFIXEDSURFACETYPES
if (trim(table4_5(n)%fixedsurfacetypeskey).eq.trim(key)) then
value=table4_5(n)%fixedsurfacetypesval
return
endif
enddo
value=table4_5(66)%fixedsurfacetypesval
! print *, 'get_g2_fixedsurfacetypes key: ', trim(key), value, &
! ' not found in table 4.5'
ierr=9
return
end subroutine get_g2_fixedsurfacetypes
Note that the print statement is commented out. Is that intentional? All the other lookup functions print an error message when a text string is not found.
Also, when this code is called, the return code is never checked:
call get_g2_fixedsurfacetypes(lvl_type1, value, ierr)
ipdstmpl0(10) = value
ipdstmpl0(11) = scale_fac1
ipdstmpl0(12) = scaled_val1
!
call get_g2_fixedsurfacetypes(lvl_type2, value, ierr)
ipdstmpl0(13) = value
!
ipdstmpl0(14) = scale_fac2
ipdstmpl0(15) = scaled_val2
!
So what's happening is that 'xxx' is used, it is not found in the table, but no error message is printed. It returns an error code, but that code is never checked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why that print statement is commented out. I did not modify this section of code. I'm fine with uncommenting that print statement.
Part of #113