Skip to content

Commit

Permalink
Merge pull request #138 from adybbroe/bugfix-unittests-rayleigh
Browse files Browse the repository at this point in the history
Bugfix unittests rayleigh
  • Loading branch information
adybbroe authored Dec 17, 2021
2 parents 21c0f8a + 045cf62 commit 7bb9c5e
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 285 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Code of Conduct

Pyspectral follows the same code of conduct as the Pytroll project. For reference
it is copied to this repository in
`CODE_OF_CONDUCT.md <https:/pytroll/pyspectral/blob/master/CODE_OF_CONDUCT.md>`_.
`CODE_OF_CONDUCT.md <https:/pytroll/pyspectral/blob/main/CODE_OF_CONDUCT.md>`_.

As stated in the Pytroll home page, this code of conduct applies to the
project space (GitHub) as well as the public space online and offline when
Expand All @@ -148,4 +148,4 @@ determined by the maintainers and may include one or more of the following:
- Temporary or permanent ban from online communication (Slack, mailing list, etc)

For details see the official
`code of conduct document <https:/pytroll/pyspectral/blob/master/CODE_OF_CONDUCT.md>`_.
`code of conduct document <https:/pytroll/pyspectral/blob/main/CODE_OF_CONDUCT.md>`_.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ Pyspectral
==========


[![Build status](https:/pytroll/pyspectral/workflows/CI/badge.svg?branch=master)](https:/pytroll/pyspectral/workflows/CI/badge.svg?branch=master)
[![Build status](https:/pytroll/pyspectral/workflows/CI/badge.svg?branch=main)](https:/pytroll/pyspectral/workflows/CI/badge.svg?branch=main)
[![Anaconda-Server Badge](https://anaconda.org/conda-forge/pyspectral/badges/version.svg)](https://anaconda.org/conda-forge/pyspectral)
[![Build status](https://ci.appveyor.com/api/projects/status/5lm42n0l65l5o9xn?svg=true)](https://ci.appveyor.com/project/pytroll/pyspectral)
[![Coverage Status](https://coveralls.io/repos/github/pytroll/pyspectral/badge.svg?branch=master)](https://coveralls.io/github/pytroll/pyspectral?branch=master)
[![Coverage Status](https://coveralls.io/repos/github/pytroll/pyspectral/badge.svg?branch=main)](https://coveralls.io/github/pytroll/pyspectral?branch=main)
[![PyPI version](https://badge.fury.io/py/pyspectral.svg)](https://badge.fury.io/py/pyspectral)

Given a passive sensor on a meteorological satellite Pyspectral provides the
Expand All @@ -22,4 +22,4 @@ scattering of molecules, absorption by atmospheric gases and aerosols, and Mie
scattering of aerosols.

Adam Dybbroe
March 2018, Norrkoping, Sweden
May 2021, Norrkoping, Sweden
13 changes: 11 additions & 2 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
prerequisites: `pip install setuptools twine`


1. checkout master
1. checkout main
2. pull from repo
3. run the unittests
4. run `loghub` and update the `CHANGELOG.md` file:
Expand All @@ -25,4 +25,13 @@ See [semver.org](http://semver.org/) on how to write a version number.

6. push changes to github `git push --follow-tags`

7. Verify travis tests passed and deployed sdist and wheel to PyPI
7. Verify the Github actions unit tests passed

8. Create a "Release" on GitHub by going to
https:/pytroll/pyspectral/releases and clicking "Draft a new
release". On the next page enter the newly created tag in the "Tag version"
field, "Version X.Y.Z" in the "Release title" field, and paste the markdown
from the changelog (the portion under the version section header) in the
"Describe this release" box. Finally click "Publish release".

9. Verify the GitHub actions for deployment succeed and the release is on PyPI
44 changes: 0 additions & 44 deletions appveyor.yml

This file was deleted.

71 changes: 0 additions & 71 deletions appveyor/install.ps1

This file was deleted.

60 changes: 0 additions & 60 deletions appveyor/run_with_compiler.cmd

This file was deleted.

57 changes: 0 additions & 57 deletions compare2rsrfiles.py

This file was deleted.

2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def __getattr__(cls, name):

# General information about the project.
project = u'Pyspectral'
copyright = u'2013-2018, PyTroll'
copyright = u'2013-2021, Pytroll'


# The language for content autogenerated by Sphinx. Refer to documentation
Expand Down
2 changes: 1 addition & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.. Pyspectral documentation master file, created by
.. Pyspectral documentation main file, created by
sphinx-quickstart on Tue Oct 15 13:31:45 2013.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Expand Down
4 changes: 2 additions & 2 deletions pyspectral/near_infrared_reflectance.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
import logging
import numpy as np
try:
from dask.array import where, logical_or, asanyarray, array, isnan
from dask.array import where, logical_or, asanyarray, isnan
except ImportError:
from numpy import where, logical_or, asanyarray, array, isnan
from numpy import where, logical_or, asanyarray, isnan

from pyspectral.solar import (SolarIrradianceSpectrum,
TOTAL_IRRADIANCE_SPECTRUM_2000ASTM)
Expand Down
20 changes: 11 additions & 9 deletions pyspectral/rayleigh.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016-2020 Pytroll developers
# Copyright (c) 2016-2021 Pytroll developers
#
# Author(s):
#
Expand Down Expand Up @@ -65,6 +65,7 @@

class BandFrequencyOutOfRange(ValueError):
"""Exception when the band frequency is out of the visible range."""

pass


Expand Down Expand Up @@ -184,7 +185,7 @@ def get_effective_wavelength(self, bandname):
"""Get the effective wavelength with Rayleigh scattering in mind."""
try:
rsr = RelativeSpectralResponse(self.platform_name, self.sensor)
except(IOError, OSError):
except OSError:
LOG.exception(
"No spectral responses for this platform and sensor: %s %s", self.platform_name, self.sensor)
if isinstance(bandname, (float, integer_types)):
Expand Down Expand Up @@ -215,12 +216,13 @@ def get_effective_wavelength(self, bandname):
def get_reflectance_lut(self):
"""Get reflectance LUT.
Read the LUT with reflectances as a function of wavelength, satellite zenith
If not already cached (read previously) read the file with Look-Up
Tables of reflectances as a function of wavelength, satellite zenith
secant, azimuth difference angle, and sun zenith secant.
"""
if self._rayl is None:
lut_vars = get_reflectance_lut(self.reflectance_lut_filename)
lut_vars = get_reflectance_lut_from_file(self.reflectance_lut_filename)
self._rayl = lut_vars[0]
self._wvl_coord = lut_vars[1]
self._azid_coord = lut_vars[2]
Expand Down Expand Up @@ -322,12 +324,12 @@ def get_reflectance(self, sun_zenith, sat_zenith, azidiff, bandname, redband=Non
return res


def get_reflectance_lut(filename):
"""
Get reflectance LUT.
def get_reflectance_lut_from_file(filename):
"""Get reflectance LUT.
Read the LUT with reflectances as a function of wavelength, satellite
zenith secant, azimuth difference angle, and sun zenith secant
Read the Look-Up Tables from file with reflectances as a function of
wavelength, satellite zenith secant, azimuth difference angle, and sun
zenith secant
"""
h5f = h5py.File(filename, 'r')
Expand Down
Loading

0 comments on commit 7bb9c5e

Please sign in to comment.