-
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
Replace cdms2 with netCDF4 in PrePARE and Python tests #493
Conversation
…ecking data types, and removed the index from _FillValue
@muryanto1 this is the same error as you. I think a package got corrupted on their server |
@mauzey1 can we have some test with cdms and some w/o like that we test both ways |
@@ -457,15 +457,15 @@ def ControlVocab(self, ncfile, variable=None, print_all=True): | |||
for attr in ['branch_time_in_child', 'branch_time_in_parent']: | |||
if attr in list(self.dictGbl.keys()): | |||
self.set_double_value(attr) | |||
if not isinstance(self.dictGbl[attr], numpy.float64): | |||
if not numpy.issubdtype(self.dictGbl[attr], numpy.float64): |
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.
nice!
@@ -535,7 +535,7 @@ def ControlVocab(self, ncfile, variable=None, print_all=True): | |||
# ------------------------------------------------------------------- | |||
varid = cmip6_cv.setup_variable(variable_cmor_entry, | |||
self.dictVar['units'], | |||
self.dictVar['_FillValue'][0], |
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.
is this due to the switch from cdms2 to netcdf?
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.
cdms2 was returning values as numpy ndarrays even if they were just one value. netCDF4 returns numpy scalars for single values.
@doutriaux1 Should we include cdms2 along side netCDF4, or just use cdms2 in the testing environment for cdms tests? |
@doutriaux1 The tests that I previously modified to use netCDF4 instead of cdms2 now have test cases for both. cdms2 is installed in the testing environment but not for the build. |
…on_toomany_tables.py, and commented out deletion of CMIP6 folder
…issing tests in Makefile, and placed the "2Gb" in a separate section.
@doutriaux1
I suspect it is due to it creating a lot of open file handles faster than it can close them. The Python 3.7 MacOS check is getting an error at line 153 in Test/test_python_joerg_3.py. cmor/Test/test_python_joerg_3.py Lines 148 to 154 in 36351d7
It produces this error:
It seems that Python 3.7 on OSX is having an issue with CMOR returning a file name when closing a variable that was already closed. |
@doutriaux1 Looking at the function cmor_close_variable, the parts that set the parameter Should we set file_name to an empty string if the variable is closed? Or, should we throw an error or warning if attempting to close an already closed variable? edit: If |
In this case I think a "Warning" should be raised (not an "error"). If "preserve" is set to true, I think is would be nice to return the file name (even if the file had already been closed), but if this is difficult to do, then don't bother. [We should probably document the behavior in the CMOR documentation. |
I'm not sure about how to handle the test_python_max_variables.py error. It seems to stem from an open file descriptor limit on CircleCI's MacOS. It runs fine on my Macbook. All it seems to be doing is creating, writing, and closing a variable 600 times. I will comment it out of the Makefile for the time being. |
@doutriaux1 Do you think this pull request can be approved? Should I put the changes for the inclusion of the Python tests in another PR? |
@mauzey1 how does |
@doutriaux1 There are some Python tests, such as test_python_history.py, that check if cdms2 is installed. If not installed then the test will exit. There are similar checks for cdms2 in the CMIP6 CV tests. The code below will skip the test case if cdms2 is not installed. cmor/Test/test_python_CMIP6_CV_trackingNoprefix.py Lines 64 to 66 in 0d7618a
Since cdms2 is a Python libary, should we only rerun the Python tests after installing cdms2? |
@mauzey1 looks good. |
Resolves #490
This PR replaces the use of cdms2 in PrePARE and some of the Python tests with netCDF4.
Note: The MacOS CircleCI checks failed due to an error when creating the conda environment.
However, the changes that triggered the failed tests (9f56aa6) didn't change the CircleCI configuration script. The previous commit (8ee7112) that did change the CircleCI and Travis scripts was passing tests.