-
Notifications
You must be signed in to change notification settings - Fork 32
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
Throw exception if not enough data is passed to cmor.write in Python #500
Conversation
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.
@mauzey1 could we have a FORTRAN test? Also why is the test called "CV" it's not prepare/cv related.
@doutriaux1 It is currently named test_python_CMIP6_CV_not_enough_data.py since the CMIP6_CV tests are the only Python tests currently being used in CI. #493 will add the other Python tests back in. I will get started on a Fortran test. |
@doutriaux1 Is there a way to catch an error in Fortran? If cmor_write has an error it will return CMOR_CRITICAL, but I want to catch the "not enough data" message. |
@mauzey1 I was dealing with these sort of things back here: https://github.com/PCMDI/cmor/pull/387/files Let me know if it does not help you. |
@doutriaux1 I am not sure what to take from that. Another issue with the Fortran test is that the error uses CMOR_CRITICAL, which exits the program at cmor_handle_error before cmor_write can return the error flag. |
@doutriaux1 I have moved the not-enough-data test from the CMIP6 CV tests to the Python tests in the Makefile. |
Resolves #485
This change checks the amount of data being passed to cmor.write in Python if it is the expected amount for the amount of time passed (either by setting ntimes_passed or passing time values). It will throw an exception if the amount is lower than expected (or if ntimes_passed is negative).
I also added a test to see if the exception is being thrown.
As for Fortran, it looks like it already handles this issue.
cmor/Src/cmor_fortran_interface.f90
Lines 1032 to 1037 in 8a48023