Skip to content
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

169 numpy #187

Merged
merged 3 commits into from
Sep 18, 2020
Merged

169 numpy #187

merged 3 commits into from
Sep 18, 2020

Conversation

scotthavens
Copy link
Contributor

A 2 part PR.

Numpy version

Numpy > v1.19 made some underlying changes that made the vapor pressure calculation slightly different only from HRRR. Looking at the vapor pressure calculation, the air temperature and relative humidity were exactly the same. The differences in vapor pressure stem from the sati and satw with differences in the float tolerance range.

Added a few levels of tests. First still tests for exact match. If the arrays are not exact, then try allclose with relative tolerance of 1e-5 and 1e-4. Raise an exception if these are not met.

SMRF pip install

The setup.py imports numpy which will not work if numpy is not installed. Following steps here, moved the build_ext to a class so numpy is only imported if compiling the pyx files to C.

This does move away from using Cython build_ext but not fully sure that it is needed as setuptools will call gcc to compile.

@scotthavens
Copy link
Contributor Author

Added Cython build_ext back in. If Cython is present, it will compile SMRF from the .pyx files. If not, it willl use the .c files to build the extensions.

setup.py Show resolved Hide resolved
notebooks/numpy_differences.ipynb Show resolved Hide resolved
requirements.txt Show resolved Hide resolved
setup.py Show resolved Hide resolved
smrf/tests/smrf_test_case.py Show resolved Hide resolved
Copy link

@Hedrick-ARS Hedrick-ARS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me.

@scotthavens scotthavens merged commit c93c175 into master Sep 18, 2020
@scotthavens scotthavens deleted the 169_numpy branch September 18, 2020 14:45
jomey referenced this pull request in UofU-Cryosphere/smrf Feb 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants