[python-mpop] 01/04: Imported Upstream version 1.3.1
Antonio Valentino
a_valentino-guest at moszumanska.debian.org
Wed Dec 14 20:43:05 UTC 2016
This is an automated email from the git hooks/post-receive script.
a_valentino-guest pushed a commit to branch master
in repository python-mpop.
commit 9937efd938ce83d3a4aa8c23b2f4d0a18f4f3f45
Author: Antonio Valentino <antonio.valentino at tiscali.it>
Date: Wed Dec 14 21:25:53 2016 +0100
Imported Upstream version 1.3.1
---
.bumpversion.cfg | 2 +-
changelog.rst | 25 +++++++++++++++++++++++++
mpop/channel.py | 7 +++++--
mpop/imageo/formats/ninjotiff.py | 20 +++++++++++++-------
mpop/satin/helper_functions.py | 26 +++++++++++++++++++-------
mpop/version.py | 2 +-
6 files changed, 64 insertions(+), 18 deletions(-)
diff --git a/.bumpversion.cfg b/.bumpversion.cfg
index b581344..8167558 100644
--- a/.bumpversion.cfg
+++ b/.bumpversion.cfg
@@ -1,5 +1,5 @@
[bumpversion]
-current_version = 1.3.0
+current_version = 1.3.1
commit = True
tag = True
diff --git a/changelog.rst b/changelog.rst
index b52a698..9e2670a 100644
--- a/changelog.rst
+++ b/changelog.rst
@@ -1,6 +1,31 @@
Changelog
=========
+v1.3.1 (2016-12-12)
+-------------------
+
+- Update changelog. [Martin Raspaud]
+
+- Bump version: 1.3.0 → 1.3.1. [Martin Raspaud]
+
+- Update maximum_extent instead of just returning the first "geos"
+ extent. [Panu Lahtinen]
+
+- Return the area extent from the area definition, if the projection is
+ "geos" [Panu Lahtinen]
+
+- Fix 'sun_zen_correction_applied' not being set to true. [Martin
+ Raspaud]
+
+- Merge pull request #39 from mraspaud/pre-master. [Martin Raspaud]
+
+ Turn RGB ninjotiff image into RGBA when fill_value is None
+
+- Turn RGB ninjotiff image into RGBA when fill_value is None. [Martin
+ Raspaud]
+
+ This patch allows to replicate the behaviour when saving pil images.
+
v1.3.0 (2016-10-27)
-------------------
diff --git a/mpop/channel.py b/mpop/channel.py
index 72a1837..7e0ceaa 100644
--- a/mpop/channel.py
+++ b/mpop/channel.py
@@ -429,8 +429,11 @@ class Channel(GenericChannel):
"is greater than %f deg", sunmask)
LOG.debug("cos_limit = %f", cos_limit)
# Mask out data where the sun elevation is below a threshold:
- new_ch.data = np.ma.masked_where(cos_zen < cos_limit, new_ch.data, copy=False)
- new_ch.info["sun_zen_correction_applied"] = True
+ new_ch.data = np.ma.masked_where(
+ cos_zen < cos_limit, new_ch.data, copy=False)
+
+ new_ch.info["sun_zen_correction_applied"] = True
+
return new_ch
def get_viewing_geometry(self, orbital, time_slot, altitude=None):
diff --git a/mpop/imageo/formats/ninjotiff.py b/mpop/imageo/formats/ninjotiff.py
index cbbfe75..be72489 100644
--- a/mpop/imageo/formats/ninjotiff.py
+++ b/mpop/imageo/formats/ninjotiff.py
@@ -43,8 +43,8 @@ from datetime import datetime
import numpy as np
-from mpop.imageo.formats import tifffile
import mpop.imageo.formats.writer_options as write_opts
+from mpop.imageo.formats import tifffile
log = logging.getLogger(__name__)
@@ -276,7 +276,7 @@ def _finalize(geo_image, dtype=np.uint8, value_range_measurement_unit=None, data
:Parameters:
geo_image : mpop.imageo.geo_image.GeoImage
See MPOP's documentation.
- dtype : bits per sample np.unit8 or np.unit16 (default: np.unit8)
+ dtype : bits per sample np.uint8 or np.uint16 (default: np.uint8)
value_range_measurement_unit: list or tuple
Defining minimum and maximum value range. Data will be clipped into
that range. Default is no clipping and auto scale.
@@ -380,10 +380,16 @@ def _finalize(geo_image, dtype=np.uint8, value_range_measurement_unit=None, data
elif geo_image.mode == 'RGB':
channels, fill_value = geo_image._finalize(dtype)
- fill_value = fill_value or (0, 0, 0)
- data = np.dstack((channels[0].filled(fill_value[0]),
- channels[1].filled(fill_value[1]),
- channels[2].filled(fill_value[2])))
+ if fill_value is None:
+ mask = (np.ma.getmaskarray(channels[0]) &
+ np.ma.getmaskarray(channels[1]) &
+ np.ma.getmaskarray(channels[2]))
+ channels.append((np.ma.logical_not(mask) *
+ np.iinfo(channels[0].dtype).max).astype(channels[0].dtype))
+ fill_value = (0, 0, 0, 0)
+
+ data = np.dstack([channel.filled(fill_v)
+ for channel, fill_v in zip(channels, fill_value)])
return data, 1.0, 0.0, fill_value[0]
elif geo_image.mode == 'RGBA':
@@ -423,7 +429,7 @@ def save(geo_image, filename, ninjo_product_name=None, writer_options=None,
ninjo_product_name : str
Optional index to Ninjo configuration file.
writer_options : dict
- options dictionary as defined in MPOP interface
+ options dictionary as defined in MPOP interface
See _write
kwargs : dict
See _write
diff --git a/mpop/satin/helper_functions.py b/mpop/satin/helper_functions.py
index c92da66..8f6c71d 100644
--- a/mpop/satin/helper_functions.py
+++ b/mpop/satin/helper_functions.py
@@ -54,7 +54,12 @@ def area_def_names_to_extent(area_def_names, proj4_str,
for name in area_def_names:
try:
- boundaries = get_area_def(name).get_boundary_lonlats()
+ adef = get_area_def(name)
+ if "proj=geos" in adef.proj4_string:
+ maximum_extent = update_max_extent(maximum_extent,
+ adef.area_extent)
+ continue
+ boundaries = adef.get_boundary_lonlats()
except pyresample.utils.AreaNotFound:
LOGGER.warning('Area definition not found ' + name)
continue
@@ -109,7 +114,7 @@ def boundaries_to_extent(proj4_str, maximum_extent, default_extent,
# replace invalid values with NaN
x_dir[np.abs(x_dir) > 1e20] = np.nan
y_dir[np.abs(y_dir) > 1e20] = np.nan
-
+
# return None when no default specified
if not default_extent:
if any(np.isnan(x_dir)) or any(np.isnan(x_dir)):
@@ -126,6 +131,18 @@ def boundaries_to_extent(proj4_str, maximum_extent, default_extent,
if extent[i] is np.nan:
extent[i] = default_extent[i]
+ maximum_extent = update_max_extent(maximum_extent, extent)
+
+ # Replace "infinity" values with default extent
+ for i in range(4):
+ if not np.isfinite(maximum_extent[i]):
+ maximum_extent[i] = default_extent[i]
+
+ return maximum_extent
+
+
+def update_max_extent(maximum_extent, extent):
+ """Update the *maximum_extent* to cover also *extent*"""
# update maximum extent
if maximum_extent is None:
maximum_extent = extent
@@ -139,9 +156,4 @@ def boundaries_to_extent(proj4_str, maximum_extent, default_extent,
if maximum_extent[3] < extent[3]:
maximum_extent[3] = extent[3]
- # Replace "infinity" values with default extent
- for i in range(4):
- if not np.isfinite(maximum_extent[i]):
- maximum_extent[i] = default_extent[i]
-
return maximum_extent
diff --git a/mpop/version.py b/mpop/version.py
index 6da6d0b..801da57 100644
--- a/mpop/version.py
+++ b/mpop/version.py
@@ -23,4 +23,4 @@
"""Version file.
"""
-__version__ = "v1.3.0"
+__version__ = "v1.3.1"
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/python-mpop.git
More information about the Pkg-grass-devel
mailing list