-
Notifications
You must be signed in to change notification settings - Fork 33
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
Recursive directory output issue / error vs warning #540
Comments
@sashakames Line 476 in 829a78a
However, the function that should be returning the error count is returning 0 for parent_mip_era .Lines 1326 to 1351 in 829a78a
@durack1 @taylor13 @doutriaux1 Should cmor_CV_checkParentExpID be returning 1 if it encounters an error with parent_mip_era ?
|
The checks performed in function
branch_method – “no parent”
|
@sashakames Could you provide the NetCDF file(s) that you used when you encountered this issue? |
@sashakames @durack1 @taylor13 I have tried adding the return value of -1 to make the returned error code non-zero.
This allows
log output
Lines 4504 to 4511 in 01ad655
All of the other tests appear to be passing. If cmor.write returning an error in above test is the expected behavior, then I will change the test to expect this behavior.
|
I'm pretty sure that "days since 1980-01" should probably trigger a fatal error because it's mssing the "day". A correct unit would be "days since 1980-1-1" or "days since 1980-01-01". If I'm right, then the test traps the error as it should. I wonder, however, if there are subsequent checks performed under this test that now get skipped because it already has encountered a fatal error? |
@taylor13
|
I think the "Warning" is not the point of this test (since the test code's name is test_python_CMIP6_CV_parenttimeunits.py, which suggests it's meant to uncover the error it flags. So I think the new behavior is in fact what we expect, so go ahead and make any changes necessary. |
Another issue that I am finding in the code is the use of 1 or -1 as an error code returned by functions. I used -1 for the error code returned by For example, a file thad had both the attribute I remedied this in PrePARE by using a bitwise OR instead of an add when combining the errors in the file. Since PrePARE doesn't output the number of errors per file, we can just replace it with a boolean. However, I think we should make the error codes in CMOR be consistent. |
Before proceeding, perhaps we should get some overview from Charles and Denis on what the strategy has been for error handling. I vaguely remember some distinction between -1 and +1. |
@taylor13 These changes include:
|
@doutriaux1 @dnadeau4 can you guys chime in here RE: error codes (-1, +1)? |
@durack1 I have no recollection of CMOR2.0 having positive and negative value errors. I believe it was all one sign back then. |
I used +1 to count how many errors occurred, CMOR2 used to exit at the first error, CMOR3 will keep going like a compiler and accumulate the number of errors. This usually happens when there is some mistake made in the user metadata and cannot be match with the rules in the CV. |
Seems like it may be o.k. making errors positive. I would note that some functions, as coded in FORTRAN (at least in early versions of CMOR), return a positive integer, which serves as an index (or handle) pointing to a variable or a dimension or a zfactor, but if an error is encountered, a negative integer is returned. The CMOR documentation explains this. |
There are some functions in the Fortran API that return a negative error such as cmor_axis. The Fortran code will invert the error returned by the C function. cmor/Src/cmor_fortran_interface.f90 Lines 6772 to 6779 in 87979a0
Looking at the C code for cmor_axis shows only one error returning 1. Lines 1639 to 1643 in 87979a0
All the other return values are 0 for cmor_axis. There are other CMOR_CRITICAL errors in that function that don't return any value.
|
I've ran PrePARE to recurse a subdirectory. When this happens, some messages are ambiguous regarding which file they pertain to. These for the most part must be
warning
messages but its isn't entirely clear. One such message is the following, and I ran again after listing the files and providing each via a sh loop:ESC[2;31;47mC Traceback:
! In function: _CV_checkParentExpID
! ESC[0m
ESC[1;31;47m!!!!!!!!!!!!!!!!!!!!!!!!!
!
! Error: Your input attribute "parent_mip_era" is not defined
! properly for historical
! Please refer to the CMIP6 documentations.
!
!
!!!!!!!!!!!!!!!!!!!!!!!!!ESC[0m
ESC[95m
Number of files scanned: 1ESC[0mESC[1;32m
Number of file with error(s): 0ESC[0m
The message indicates an error, but the summary info at the bottom says otherwise. Is the message really a warning, or should the bottom count it as an Error?
The text was updated successfully, but these errors were encountered: