[Git][debian-gis-team/pyspectral][master] 5 commits: New upstream version 0.9.4+ds

Antonio Valentino gitlab at salsa.debian.org
Tue Dec 31 07:27:42 GMT 2019



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


Commits:
5060472c by Antonio Valentino at 2019-12-31T07:14:57Z
New upstream version 0.9.4+ds
- - - - -
c398066e by Antonio Valentino at 2019-12-31T07:14:59Z
Update upstream source from tag 'upstream/0.9.4+ds'

Update to upstream version '0.9.4+ds'
with Debian dir f2e507fcc09dddad814742e421fb77b75668e7d1
- - - - -
f62a9c8f by Antonio Valentino at 2019-12-31T07:15:42Z
New upstream release

- - - - -
b32c74dc by Antonio Valentino at 2019-12-31T07:22:28Z
Refresh all patches

- - - - -
ecf92611 by Antonio Valentino at 2019-12-31T07:23:21Z
Set distribution to unstable

- - - - -


8 changed files:

- CHANGELOG.md
- debian/changelog
- debian/patches/0003-No-setuptools-scm.patch
- doc/conf.py
- doc/index.rst
- doc/rayleigh_correction.rst
- pyspectral/near_infrared_reflectance.py
- pyspectral/radiance_tb_conversion.py


Changes:

=====================================
CHANGELOG.md
=====================================
@@ -1,3 +1,23 @@
+## Version v0.9.4 (2019/12/30)
+
+
+### Pull Requests Merged
+
+#### Bugs fixed
+
+* [PR 99](https://github.com/pytroll/pyspectral/pull/99) - Fix Read The Doc pages - does not build at the moment
+
+#### Features added
+
+* [PR 97](https://github.com/pytroll/pyspectral/pull/97) - Fix NIR computations to be more lenient towards dask arrays
+
+#### Documentation changes
+
+* [PR 99](https://github.com/pytroll/pyspectral/pull/99) - Fix Read The Doc pages - does not build at the moment
+
+In this release 3 pull requests were closed.
+
+
 ## Version v0.9.3 (2019/12/06)
 
 ### Issues Closed


=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+pyspectral (0.9.4+ds-1) unstable; urgency=medium
+
+  * New upstream release.
+  * Refresh all patches.
+
+ -- Antonio Valentino <antonio.valentino at tiscali.it>  Tue, 31 Dec 2019 07:23:03 +0000
+
 pyspectral (0.9.3+ds-1) unstable; urgency=medium
 
   * New upstream release.


=====================================
debian/patches/0003-No-setuptools-scm.patch
=====================================
@@ -3,23 +3,9 @@ Date: Sat, 7 Dec 2019 09:16:27 +0100
 Subject: No setuptools-scm
 
 ---
- doc/conf.py | 2 +-
- setup.cfg   | 8 ++++----
- 2 files changed, 5 insertions(+), 5 deletions(-)
+ setup.cfg | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
 
-diff --git a/doc/conf.py b/doc/conf.py
-index b3ba906..a69b601 100644
---- a/doc/conf.py
-+++ b/doc/conf.py
-@@ -39,7 +39,7 @@ sys.path.insert(0, os.path.abspath('../pyspectral'))
- # |version| and |release|, also used in various other places throughout the
- # built documents.
- #
--release = get_distribution('satpy').version
-+release = get_distribution('pyspectral').version
- # for example take major/minor
- version = '.'.join(release.split('.')[:2])
- 
 diff --git a/setup.cfg b/setup.cfg
 index 0628c31..94e5892 100644
 --- a/setup.cfg


=====================================
doc/conf.py
=====================================
@@ -17,17 +17,8 @@ from pkg_resources import get_distribution
 
 # PYTHONPATH = docs/source
 DOC_SOURCES_DIR = os.path.dirname(os.path.abspath(__file__))
-PROJECT_ROOT_DIR = os.path.dirname(DOC_SOURCES_DIR)
 sys.path.insert(0, DOC_SOURCES_DIR)
 
-# If runs on ReadTheDocs environment
-on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
-
-# Hack for lacking git-lfs support ReadTheDocs
-if on_rtd:
-    # print('Fetching files with git_lfs')
-    from git_lfs import fetch
-    fetch(PROJECT_ROOT_DIR)
 
 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the
@@ -39,7 +30,7 @@ sys.path.insert(0, os.path.abspath('../pyspectral'))
 # |version| and |release|, also used in various other places throughout the
 # built documents.
 #
-release = get_distribution('satpy').version
+release = get_distribution('pyspectral').version
 # for example take major/minor
 version = '.'.join(release.split('.')[:2])
 


=====================================
doc/index.rst
=====================================
@@ -27,7 +27,7 @@ The source code can be found on the github_ page.
 With PySpectral and SatPy_ (or previously mpop_) it is possible to make RGB colour
 composites like the SEVIRI `day solar`_ or the `day microphysical`_ RGB
 composites according to the `MSG Interpretation Guide`_ (EUMETSAT_). Also with
-SatPy_ (and mpop_) integration it is possible to make atmosphere corrected true
+SatPy_ integration it is possible to make atmosphere corrected true
 color imagery.
 
 .. _`EUMETSAT`: http://www.eumetsat.int/


=====================================
doc/rayleigh_correction.rst
=====================================
@@ -35,7 +35,7 @@ in the figure below:
    :scale: 70%
    :align: center
 
-The method is descriped in detail in a scientific paper_.
+The method is descriped in detail in a `scientific paper`_.
 
 To apply the atmospheric correction for a given satellite sensor band, the
 procedure involves the following three steps:
@@ -113,6 +113,6 @@ if you want another setup, e.g.:
 
 .. _Satpy: http://www.github.com/pytroll/satpy
 .. _zenodo: https://doi.org/10.5281/zenodo.1288441
-.. _paper: https://doi.org/10.3390/rs10040560
+.. _`scientific paper`: https://doi.org/10.3390/rs10040560
 
 


=====================================
pyspectral/near_infrared_reflectance.py
=====================================
@@ -32,9 +32,9 @@ window channel (usually around 11-12 microns).
 import os
 import numpy as np
 try:
-    from dask.array import where, logical_or
+    from dask.array import where, logical_or, asanyarray, array
 except ImportError:
-    from numpy import where, logical_or
+    from numpy import where, logical_or, asanyarray, array
 
 from pyspectral.solar import (SolarIrradianceSpectrum,
                               TOTAL_IRRADIANCE_SPECTRUM_2000ASTM)
@@ -216,14 +216,14 @@ class Calculator(RadTbConverter):
             is_masked = False
 
         if np.isscalar(tb_near_ir):
-            tb_nir = np.array([tb_near_ir, ])
+            tb_nir = array([tb_near_ir, ])
         else:
-            tb_nir = np.asanyarray(tb_near_ir)
+            tb_nir = asanyarray(tb_near_ir)
 
         if np.isscalar(tb_thermal):
-            tb_therm = np.array([tb_thermal, ])
+            tb_therm = array([tb_thermal, ])
         else:
-            tb_therm = np.asanyarray(tb_thermal)
+            tb_therm = asanyarray(tb_thermal)
 
         if tb_therm.shape != tb_nir.shape:
             errmsg = 'Dimensions do not match! {0} and {1}'.format(
@@ -239,9 +239,9 @@ class Calculator(RadTbConverter):
         else:
             co2corr = True
             if np.isscalar(tb_ir_co2):
-                tbco2 = np.array([tb_ir_co2, ])
+                tbco2 = array([tb_ir_co2, ])
             else:
-                tbco2 = np.asanyarray(tb_ir_co2)
+                tbco2 = asanyarray(tb_ir_co2)
 
         if not self.rsr:
             raise NotImplementedError("Reflectance calculations without "
@@ -260,7 +260,7 @@ class Calculator(RadTbConverter):
             LOG.info('l_nir = %s', str(l_nir))
 
         sunzmask = (sun_zenith < 0.0) | (sun_zenith > 88.0)
-        sunz = where(sunzmask, 88.0, sun_zenith)
+        sunz = sun_zenith.clip(0, 88.0)
 
         mu0 = np.cos(np.deg2rad(sunz))
         # mu0 = np.where(np.less(mu0, 0.1), 0.1, mu0)
@@ -275,11 +275,11 @@ class Calculator(RadTbConverter):
         else:
             self._rad3x_correction = 1.0
 
-        nomin = l_nir - thermal_emiss_one * self._rad3x_correction
-        denom = self._solar_radiance - thermal_emiss_one * self._rad3x_correction
+        corrected_thermal_emiss_one = thermal_emiss_one * self._rad3x_correction
+        nomin = l_nir - corrected_thermal_emiss_one
+        denom = self._solar_radiance - corrected_thermal_emiss_one
         data = nomin / denom
-        mask = (self._solar_radiance - thermal_emiss_one *
-                self._rad3x_correction) < EPSILON
+        mask = denom < EPSILON
 
         logical_or(sunzmask, mask, out=mask)
         logical_or(mask, np.isnan(tb_nir), out=mask)
@@ -294,5 +294,5 @@ class Calculator(RadTbConverter):
         else:
             res = self._r3x
         if is_masked:
-            res = np.ma.masked_array(res, mask=np.isnan(res))
+            res = np.ma.masked_invalid(res)
         return res


=====================================
pyspectral/radiance_tb_conversion.py
=====================================
@@ -172,6 +172,11 @@ class RadTbConverter(object):
             raise NotImplementedError(
                 'Platform {0} not yet supported...'.format(self.platform_name))
 
+    @staticmethod
+    def _getitem(block, lut):
+        """Index the lut, numpy style."""
+        return lut[block]
+
     def tb2radiance(self, tb_, **kwargs):
         """Get the radiance from the brightness temperature (Tb) given the band name.
 
@@ -207,10 +212,15 @@ class RadTbConverter(object):
             start = int(lut['tb'][0] * self.tb_scale)
             retv = {}
             bounds = 0, lut['radiance'].shape[0] - 1
-            index = np.clip(ntb - start, bounds[0], bounds[1])
-            retv['radiance'] = lut['radiance'][index]
-            if retv['radiance'].ravel().shape[0] == 1:
-                retv['radiance'] = retv['radiance'][0]
+            index = (ntb - start).clip(bounds[0], bounds[1])
+            try:
+                retv['radiance'] = index.map_blocks(self._getitem, lut['radiance'], dtype=lut['radiance'].dtype)
+            except AttributeError:
+                retv['radiance'] = lut['radiance'][index]
+            try:
+                retv['radiance'] = retv['radiance'].item()
+            except (ValueError, AttributeError):
+                pass
             retv['unit'] = unit
             retv['scale'] = scale
             return retv



View it on GitLab: https://salsa.debian.org/debian-gis-team/pyspectral/compare/25ae31449fa7c8aaddbe54e8376b951435217ebd...ecf92611ee5ddd83d72f163b701b91e527cfa423

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/pyspectral/compare/25ae31449fa7c8aaddbe54e8376b951435217ebd...ecf92611ee5ddd83d72f163b701b91e527cfa423
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/20191231/a02a1a85/attachment-0001.html>


More information about the Pkg-grass-devel mailing list