Skip to content

lookup_linke_turbidity speed improvement, mat to h5 #442

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

Merged
merged 4 commits into from
Mar 30, 2018
Merged

lookup_linke_turbidity speed improvement, mat to h5 #442

merged 4 commits into from
Mar 30, 2018

Conversation

cedricleroy
Copy link
Contributor

  • Closes issue lookup_linke_turbidity is (still) slow #437
  • Fully tested. Added and/or modified tests to ensure correct behavior for all reasonable inputs. Tests must pass on the TravisCI and Appveyor testing services.
  • Code quality and style is sufficient. Passes git diff upstream/master -u -- "*.py" | flake8 --diff and/or landscape.io linting service.
  • New code is fully documented. Includes sphinx/numpydoc compliant docstrings and comments in the code where necessary.
  • Updates entries to docs/sphinx/source/api.rst for API changes.
  • Adds description and name entries in the appropriate docs/sphinx/source/whatsnew file for all changes.

Note: git diff upstream/master -u -- "*.py" | flake8 --diff is giving me fatal: bad revision 'upstream/master'. I use pylint though and it didn't complain on additions.

* replace LinkeTurbidity matlab file by hdf5 (gzip 4)
* update for using LinkeTurbidity hdf5 instead of matlab file in
lookup_linke_turbidity function
* tests dependencies updates
* update requirements / ci for LinkeTurbidity hdf5 file
Copy link
Member

@wholmgren wholmgren left a comment

Choose a reason for hiding this comment

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

This looks great! Just a few changes needed.

appveyor.yml Outdated
@@ -28,7 +28,7 @@ install:
- cmd: conda info -a

# install depenencies
- cmd: conda create -n test_env --yes --quiet python=%PYTHON_VERSION% pip numpy scipy pandas nose pytest pytz ephem numba siphon -c conda-forge
- cmd: conda create -n test_env --yes --quiet python=%PYTHON_VERSION% pip numpy scipy tables pandas nose pytest pytz ephem numba siphon -c conda-forge
Copy link
Member

Choose a reason for hiding this comment

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

I think you want pytables here and in the env files below.

@@ -9,7 +9,7 @@ API Changes

Enhancements
~~~~~~~~~~~~
*
* Improve clearsky.lookup_linke_turbidity speed (IO) (:issue:`437`)
Copy link
Member

Choose a reason for hiding this comment

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

Let's add the .mat to .h5 change to the API changes section.

try:
lts = lt_h5_file.root.LinkeTurbidity[latitude_index, longitude_index, :]
except IndexError:
raise IndexError('Latitude should be between 90 and -90, '
Copy link
Member

Choose a reason for hiding this comment

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

We should add a test that asserts that this exception is raised under invalid inputs.

Also, I confirmed that the code below does in fact execute the finally block despite a new exception being raised.

try:
    raise IndexError
except IndexError:
    raise IndexError('blah')
finally:
    print('finally')

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I actually did write a test for that, but then realized it was already covered.

For the try except finally, I was hoping open_file to come with a context manager, but it does not look like it is the case and fall back to the old school way to make sure the file get closed whatever happen.

Copy link
Member

Choose a reason for hiding this comment

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

my bad, thanks for reminding me...

@cedricleroy
Copy link
Contributor Author

Looks like the build is passing now. I can squash commits if needed.

@wholmgren
Copy link
Member

Looks finished to me. I plan to merge tomorrow, so now is the time to comment if anyone has objections.

@wholmgren wholmgren changed the title lookup_linke_turbidity speed improvement (Issue #437) lookup_linke_turbidity speed improvement, mat to h5 Mar 30, 2018
@wholmgren wholmgren merged commit 1c0c3e7 into pvlib:master Mar 30, 2018
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.

2 participants