[Git][debian-gis-team/pyspectral][upstream] New upstream version 0.10.1+ds

Antonio Valentino gitlab at salsa.debian.org
Wed Oct 7 08:50:20 BST 2020



Antonio Valentino pushed to branch upstream at Debian GIS Project / pyspectral


Commits:
92107178 by Antonio Valentino at 2020-10-07T06:33:12+00:00
New upstream version 0.10.1+ds
- - - - -


10 changed files:

- CHANGELOG.md
- + CODE_OF_CONDUCT.md
- + CONTRIBUTING.rst
- bin/composite_rsr_plot.py
- doc/seviri_example.rst
- pyspectral/blackbody.py
- pyspectral/near_infrared_reflectance.py
- pyspectral/tests/test_reflectance.py
- pyspectral/utils.py
- setup.py


Changes:

=====================================
CHANGELOG.md
=====================================
@@ -1,3 +1,33 @@
+
+## Version <v0.10.1> (2020/10/06)
+
+### Issues Closed
+
+* [Issue 112](https://github.com/pytroll/pyspectral/issues/112) - Do not cut NIR reflectance with a single threshold ([PR 113](https://github.com/pytroll/pyspectral/pull/113))
+* [Issue 111](https://github.com/pytroll/pyspectral/issues/111) - Error in equation in documentation ([PR 117](https://github.com/pytroll/pyspectral/pull/117))
+
+In this release 2 issues were closed.
+
+### Pull Requests Merged
+
+#### Bugs fixed
+
+* [PR 117](https://github.com/pytroll/pyspectral/pull/117) - Fix documentation error in SI unit conversion ([111](https://github.com/pytroll/pyspectral/issues/111))
+
+#### Features added
+
+* [PR 116](https://github.com/pytroll/pyspectral/pull/116) - Skip python2 support
+* [PR 113](https://github.com/pytroll/pyspectral/pull/113) - Separate masking and Sun zenith angle correction ([112](https://github.com/pytroll/pyspectral/issues/112))
+* [PR 110](https://github.com/pytroll/pyspectral/pull/110) - Add bandname mapping for slstr
+
+#### Documentation changes
+
+* [PR 117](https://github.com/pytroll/pyspectral/pull/117) - Fix documentation error in SI unit conversion ([111](https://github.com/pytroll/pyspectral/issues/111))
+
+In this release 5 pull requests were closed.
+
+
+
 ## Version v0.10.0 (2020/06/24)
 
 ### Issues Closed
@@ -14,11 +44,13 @@ In this release 1 issue was closed.
 
 #### Features added
 
+* [PR 109](https://github.com/pytroll/pyspectral/pull/109) - add more realistic METimage RSRs
 * [PR 108](https://github.com/pytroll/pyspectral/pull/108) - Add option to specify sun-zenith angle threshold applied
 * [PR 107](https://github.com/pytroll/pyspectral/pull/107) - Add support for FCI
 * [PR 105](https://github.com/pytroll/pyspectral/pull/105) - Use original channel data on the night side for NIR emissive
+* [PR 104](https://github.com/pytroll/pyspectral/pull/104) - Updated Zenodo link for addition of SLSTR on Sentinel 3B ([96](https://github.com/pytroll/pyspectral/issues/96))
 
-In this release 4 pull requests were closed.
+In this release 5 pull requests were closed.
 
 
 


=====================================
CODE_OF_CONDUCT.md
=====================================
@@ -0,0 +1,76 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as
+contributors and maintainers pledge to making participation in our project and
+our community a harassment-free experience for everyone, regardless of age, body
+size, disability, ethnicity, sex characteristics, gender identity and expression,
+level of experience, education, socio-economic status, nationality, personal
+appearance, race, religion, or sexual identity and orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment
+include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or
+  advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic
+  address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+  professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable
+behavior and are expected to take appropriate and fair corrective action in
+response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or
+reject comments, commits, code, wiki edits, issues, and other contributions
+that are not aligned to this Code of Conduct, or to ban temporarily or
+permanently any contributor for other behaviors that they deem inappropriate,
+threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces
+when an individual is representing the project or its community. Examples of
+representing a project or community include using an official project e-mail
+address, posting via an official social media account, or acting as an appointed
+representative at an online or offline event. Representation of a project may be
+further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported by contacting the project team at <pytroll-conduct at lists.wisc.edu>. All
+complaints will be reviewed and investigated and will result in a response that
+is deemed necessary and appropriate to the circumstances. The project team is
+obligated to maintain confidentiality with regard to the reporter of an incident.
+Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good
+faith may face temporary or permanent repercussions as determined by other
+members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
+available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
+
+[homepage]: https://www.contributor-covenant.org
+
+For answers to common questions about this code of conduct, see
+https://www.contributor-covenant.org/faq


=====================================
CONTRIBUTING.rst
=====================================
@@ -0,0 +1,151 @@
+=================
+How to contribute
+=================
+
+Thank you for considering contributing to Pyspectral! Pyspectral's development
+team is made up of volunteers so any help we can get is very
+appreciated. Pyspectral is a fairly small library/application in the Pytroll
+family of open source packages. Pyspectral is used in Satpy, and this
+guidelines document here is copied from Satpy's.
+
+Contributions from users are what keep this and the entire Pytroll community
+going. We welcome any contributions including bug reports, documentation fixes
+or updates, bug fixes, and feature requests. By contributing to Pyspectral you
+are providing code that everyone can use and benefit from.
+
+The following guidelines will describe how the Satpy project structures
+its code contributions from discussion to code to package release.
+
+For more information on contributing to open source projects see
+`GitHub's Guide <https://opensource.guide/how-to-contribute/>`_.
+
+What can I do?
+==============
+
+- Make sure you have a `GitHub account <https://github.com/signup/free>`_.
+- Submit a ticket for your issue, assuming one does not already exist.
+- If you're uncomfortable using Git/GitHub, see
+  `Learn Git Branching <https://learngitbranching.js.org/>`_ or other
+  online tutorials.
+- If you are uncomfortable contributing to an open source project see:
+
+  * `How to Contribute to an Open Source Project on GitHub <https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github>`_
+    video series
+  * Aaron Meurer's `Git Workflow <http://www.asmeurer.com/git-workflow/>`_
+  * `How to Contribute to Open Source <https://opensource.guide/how-to-contribute/>`_
+
+- See what `issues <https://github.com/pytroll/pyspectral/issues/>`_ already
+  exist. Issues marked
+  `good first issue <https://github.com/pytroll/pyspectral/labels/good%20first%20issue>`_
+  or `help wanted <https://github.com/pytroll/pyspectral/labels/help%20wanted>`_
+  can be good issues to start with.
+- Read the :doc:`index` for more details on contributing code.
+- `Fork <https://help.github.com/articles/fork-a-repo/>`_ the repository on
+  GitHub and install the package in development mode.
+- Update the Pyspectral documentation to make it clearer and more detailed.
+- Contribute code to either fix a bug or add functionality and submit a
+  `Pull Request <https://help.github.com/articles/creating-a-pull-request/>`_.
+- Make an example Jupyter Notebook and add it to the
+  `available examples <https://github.com/pytroll/pytroll-examples>`_.
+
+What if I break something?
+==========================
+
+Not possible. If something breaks because of your contribution it was our
+fault. When you submit your changes to be merged as a GitHub
+`Pull Request <https://help.github.com/articles/creating-a-pull-request/>`_
+they will be automatically tested and checked against coding style rules..
+Before they are merged they are reviewed by at least one maintainer of the
+Pyspectral project. If anything needs updating, we'll let you know.
+
+What is expected?
+=================
+
+You can expect the Pyspectral maintainers to help you. We are all volunteers,
+have jobs, and occasionally go on vacations. We will try our best to answer
+your questions as soon as possible. We will try our best to understand your
+use case and add the features you need. Although we strive to make
+Pyspectral useful for everyone there may be some feature requests that we can't
+allow if they would require breaking existing features. Other features may
+be best for a different package, Pytroll or otherwise. Regardless, we will
+help you find the best place for your feature and to make it possible to do
+what you want.
+
+We, the Pyspectral maintainers, expect you to be patient, understanding, and
+respectful of both developers and users. Pyspectral can only be successful if
+everyone in the community feels welcome. We also expect you to put in as
+much work as you expect out of us. There is no dedicated Pytroll or Pyspectral
+support team, so there may be times when you need to do most of the work
+to solve your problem (trying different test cases, environments, etc).
+
+Being respectful includes following the style of the existing code for any
+code submissions. Please follow
+`PEP8 <https://www.python.org/dev/peps/pep-0008/>`_ style guidelines and
+limit lines of code to 80 characters whenever possible and when it doesn't
+hurt readability. Codelines should never exceed 120 characters. Pyspectral follows
+`Google Style Docstrings <http://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html>`_
+for all code API documentation. When in doubt use the existing code as a
+guide for how coding should be done.
+
+.. _dev_help:
+
+How do I get help?
+==================
+
+The Pyspectral developers (and all other Pytroll package developers) monitor the:
+
+- `Mailing List <https://groups.google.com/group/pytroll>`_
+- `Slack chat <https://pytroll.slack.com/>`_ (get an `invitation <https://pytrollslackin.herokuapp.com/>`_)
+- `GitHub issues <https://github.com/pytroll/pyspectral/issues>`_
+
+How do I submit my changes?
+===========================
+
+Any contributions should start with some form of communication (see above) to
+let the Pyspectral maintainers know how you plan to help. The larger the
+contribution the more important direct communication is so everyone can avoid
+duplicate code and wasted time.
+After talking to the Pyspectral developers any additional work like code or
+documentation changes can be provided as a GitHub
+`Pull Request <https://help.github.com/articles/creating-a-pull-request/>`_.
+
+To make sure that your code complies with the pytroll python standard, you can
+run the `flake8 <http://flake8.pycqa.org/en/latest/>`_ linter on your changes
+before you submit them, or even better install a pre-commit hook that runs the
+style check for you. To this aim, we provide a configuration file for the
+`pre-commit <http://pre-commit.com>`_ tool, that you can install with eg::
+
+  pip install pre-commit
+  pre-commit install
+
+running from your base pyspectral directory. This will automatically check code style for every commit.
+
+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://github.com/pytroll/pyspectral/blob/master/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
+an individual is representing the project or the community. Online examples
+of this include the Pytroll Slack team, mailing list, and the Pytroll twitter
+account. This code of conduct also applies to in-person situations like
+Pytroll Contributor Weeks (PCW), conference meet-ups, or any other time when
+the project is being represented.
+
+Any violations of this code of conduct will be handled by the core maintainers
+of the project including David Hoese, Martin Raspaud, Panu Lahtinen, and Adam Dybbroe.
+If you wish to report one of the maintainers for a violation and are
+not comfortable with them seeing it, please contact one or more of the other
+maintainers to report the violation. Responses to violations will be
+determined by the maintainers and may include one or more of the following:
+
+- Verbal warning
+- Ask for public apology
+- Temporary or permanent ban from in-person events
+- Temporary or permanent ban from online communication (Slack, mailing list, etc)
+
+For details see the official
+`code of conduct document <https://github.com/pytroll/pyspectral/blob/master/CODE_OF_CONDUCT.md>`_.


=====================================
bin/composite_rsr_plot.py
=====================================
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 
-# Copyright (c) 2016-2019 Adam.Dybbroe
+# Copyright (c) 2016-2020 Adam.Dybbroe
 
 # Author(s):
 
@@ -154,7 +154,7 @@ if __name__ == "__main__":
                 rsr = RelativeSpectralResponse(platform, sensor)
             except IOError:
                 # LOG.exception('Failed getting the rsr data for platform %s ' +
-                #               'and sensor %s', platform, sensor)
+                #              'and sensor %s', platform, sensor)
                 rsr = None
             else:
                 break


=====================================
doc/seviri_example.rst
=====================================
@@ -25,6 +25,10 @@ reflectance, saving a few milliseconds per call::
   >>> print('%4.3f' %refl39.reflectance_from_tbs(sunz, tb3, tb4))
   0.555
 
+By default the data are masked outside the default Sun zenith-angle (SZA) correction limit (85.0 degrees).
+The masking can be adjusted via `masking_limit` keyword argument to `Calculator`, and turned of by
+defining `Calculator(..., masking_limit=None)`.  The SZA limit can be adjusted via `sunz_threshold` keyword argument:
+`Calculator(..., sunz_threshold=88.0)`.
 
 Integration with SatPy
 ^^^^^^^^^^^^^^^^^^^^^^


=====================================
pyspectral/blackbody.py
=====================================
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 
-# Copyright (c) 2013-2019 Adam.Dybbroe
+# Copyright (c) 2013-2020 Adam.Dybbroe
 
 # Author(s):
 
@@ -140,7 +140,7 @@ def planck(wave, temperature, wavelength=True):
             Unit = W/m^2 sr^-1 (m^-1)^-1 = W/m sr^-1
 
             Converting from SI units to mW/m^2 sr^-1 (cm^-1)^-1:
-            1.0 W/m^2 sr^-1 (m^-1)^-1 = 0.1 mW/m^2 sr^-1 (cm^-1)^-1
+            1.0 W/m^2 sr^-1 (m^-1)^-1 = 1.0e5 mW/m^2 sr^-1 (cm^-1)^-1
 
     """
     units = ['wavelengths', 'wavenumbers']


=====================================
pyspectral/near_infrared_reflectance.py
=====================================
@@ -67,7 +67,7 @@ class Calculator(RadTbConverter):
 
     def __init__(self, platform_name, instrument, band,
                  detector='det-1', wavespace=WAVE_LENGTH,
-                 solar_flux=None, sunz_threshold=TERMINATOR_LIMIT):
+                 solar_flux=None, sunz_threshold=TERMINATOR_LIMIT, masking_limit=TERMINATOR_LIMIT):
         """Initialize the Class instance."""
         super(Calculator, self).__init__(platform_name, instrument, band, detector=detector, wavespace=wavespace)
 
@@ -97,6 +97,7 @@ class Calculator(RadTbConverter):
         # terminator we try derive a
         self.detector = detector
         self.sunz_threshold = sunz_threshold
+        self.masking_limit = masking_limit
         self._rad3x = None
         self._rad3x_t11 = None
         self._solar_radiance = None
@@ -264,10 +265,7 @@ class Calculator(RadTbConverter):
         if l_nir.ravel().shape[0] < 10:
             LOG.info('l_nir = %s', str(l_nir))
 
-        LOG.debug("Apply sun-zenith angle clipping between 0 and %5.2f", self.sunz_threshold)
-        sunzmask = (sun_zenith < 0.0) | (sun_zenith > self.sunz_threshold)
-        # Could do a more smooth transition here:ยง
-        # FIXME!
+        LOG.debug("Apply sun-zenith angle clipping between 0 and %5.2f", self.masking_limit)
         sunz = sun_zenith.clip(0, self.sunz_threshold)
         mu0 = np.cos(np.deg2rad(sunz))
 
@@ -288,7 +286,9 @@ class Calculator(RadTbConverter):
         data = nomin / denom
         mask = denom < EPSILON
 
-        logical_or(sunzmask, mask, out=mask)
+        if self.masking_limit is not None:
+            sunzmask = (sun_zenith < 0.0) | (sun_zenith > self.masking_limit)
+            logical_or(sunzmask, mask, out=mask)
         logical_or(mask, np.isnan(tb_nir), out=mask)
 
         self._r3x = where(mask, np.nan, data)


=====================================
pyspectral/tests/test_reflectance.py
=====================================
@@ -22,7 +22,7 @@
 
 """Unit testing the 3.7 micron reflectance calculations."""
 
-from pyspectral.near_infrared_reflectance import Calculator
+from pyspectral.near_infrared_reflectance import Calculator, TERMINATOR_LIMIT
 import numpy as np
 import sys
 if sys.version_info < (2, 7):
@@ -155,9 +155,12 @@ class TestReflectance(unittest.TestCase):
             instance.si_scale = 1e-6
 
             refl37 = Calculator('EOS-Aqua', 'modis', '20')
+            self.assertEqual(refl37.sunz_threshold, TERMINATOR_LIMIT)
+            self.assertEqual(refl37.masking_limit, TERMINATOR_LIMIT)
 
-            refl37_sz88 = Calculator('EOS-Aqua', 'modis', '20', sunz_threshold=88.0)
+            refl37_sz88 = Calculator('EOS-Aqua', 'modis', '20', sunz_threshold=88.0, masking_limit=None)
             self.assertEqual(refl37_sz88.sunz_threshold, 88.0)
+            self.assertIsNone(refl37_sz88.masking_limit)
             self.assertAlmostEqual(refl37_sz88.bandwavelength, 3.780282, 5)
             self.assertEqual(refl37_sz88.bandname, '20')
 


=====================================
pyspectral/utils.py
=====================================
@@ -146,6 +146,19 @@ BANDNAMES['fci'] = {'vis_04': 'ch1',
                     'ir_133': 'ch16'
                     }
 
+BANDNAMES['slstr'] = {'S1': 'ch1',
+                      'S2': 'ch2',
+                      'S3': 'ch3',
+                      'S4': 'ch4',
+                      'S5': 'ch5',
+                      'S6': 'ch6',
+                      'S7': 'ch7',
+                      'S8': 'ch8',
+                      'S9': 'ch9',
+                      'F1': 'ch7',
+                      'F2': 'ch8',
+                      }
+
 INSTRUMENTS = {'NOAA-19': 'avhrr/3',
                'NOAA-18': 'avhrr/3',
                'NOAA-17': 'avhrr/3',


=====================================
setup.py
=====================================
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 
-# Copyright (c) 2013-2019 Pytroll
+# Copyright (c) 2013-2020 Pytroll
 
 # Author(s):
 
@@ -103,7 +103,7 @@ setup(name=NAME,
                              'pyspectral/data/MSG_SEVIRI_Spectral_Response_Characterisation.XLS'])],
       test_suite='pyspectral.tests.suite',
       tests_require=test_requires,
-      python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*',
+      python_requires='>=3.7',
       zip_safe=False,
       use_scm_version=True
       )



View it on GitLab: https://salsa.debian.org/debian-gis-team/pyspectral/-/commit/92107178bd2a7eaf797d134d48dd71a0b1a6bd8b

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/pyspectral/-/commit/92107178bd2a7eaf797d134d48dd71a0b1a6bd8b
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20201007/d636e293/attachment-0001.html>


More information about the Pkg-grass-devel mailing list