Commit 659351c0 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Merge branch 'bugfix/fix_zip_valueerror' into 'master'

Bugfix/fix zip valueerror

Closes #89

See merge request !66
parents 26adfd79 4cf5ca40
Pipeline #52945 passed with stages
in 13 minutes and 57 seconds
......@@ -2,6 +2,13 @@
History
=======
0.18.10 (2022-11-15)
--------------------
* Fixed #89: ValueError due to capital letters in EnMAP Zipfile extension (!66).
* Replaced deprecated URLs.
0.18.9 (2022-08-12)
-------------------
......
......@@ -161,7 +161,7 @@ requirement polymer_ as described above.
.. _pip: https://pip.pypa.io
.. _Python installation guide: http://docs.python-guide.org/en/latest/starting/installation/
.. _conda: https://conda.io/docs
.. _conda: https://docs.conda.io
.. _ACwater: https://gitlab.awi.de/phytooptics/acwater/
.. _`ACwater Polymer installation instructions`: https://gitlab.awi.de/phytooptics/acwater/-/blob/master/docs/installation.rst
.. _HYGEOS support forum: https://forum.hygeos.com
......
......@@ -5,7 +5,7 @@ From EnMAP Level-1B to Level-2A
*******************************
In this tutorial, we generate EnMAP_ Level-2A from Level-1B data using the EnMAP processing tool (EnPT_).
Please refer to the overview about EnMAP data products `here <https://www.enmap.org/mission/dataproducts/>`__ to learn
Please refer to the overview about EnMAP data products `here <https://www.enmap.org/data_access/>`__ to learn
more about the differences between EnMAP processing levels.
As described in the :ref:`usage` section of this documentation, the input parameters of EnPT_ can be set using the
......
......@@ -101,7 +101,7 @@ class EnPT_Controller(object):
if not self.cfg.is_dummy_dataformat:
return outdir
else:
return os.path.join(self.tempDir, os.path.basename(path_zipfile).split('.zip')[0])
return os.path.join(self.tempDir, os.path.splitext(os.path.basename(path_zipfile))[0])
def read_L1B_data(self) -> None:
"""Read the provider L1B data given in config and return an EnMAP image object."""
......@@ -110,16 +110,16 @@ class EnPT_Controller(object):
# input validation
if not os.path.isdir(path_enmap_image) and \
not (os.path.exists(path_enmap_image) and path_enmap_image.endswith('.zip')):
not (os.path.exists(path_enmap_image) and zipfile.is_zipfile(path_enmap_image)):
raise ValueError("The parameter 'path_enmap_image' must be a directory or the path to an existing zip "
"archive. Received %s." % path_enmap_image)
# extract L1B image archive if needed
if path_enmap_image.endswith('.zip'):
if zipfile.is_zipfile(path_enmap_image):
path_enmap_image = self.extract_zip_archive(path_enmap_image, subdir='image_main')
# extract L1B gap fill image archive if needed
if path_enmap_image_gapfill and path_enmap_image_gapfill.endswith('.zip'):
if path_enmap_image_gapfill and zipfile.is_zipfile(path_enmap_image_gapfill):
path_enmap_image_gapfill = self.extract_zip_archive(path_enmap_image_gapfill, subdir='image_gapfill')
# run the reader
......
......@@ -678,13 +678,14 @@ class EnMAPL1Product_SensorGeo(object):
# :return:
# """
# # input validation
# from zipfile import is_zipfile
# if not path.isdir(path_enmap_image) and \
# not (path.exists(path_enmap_image) and path_enmap_image.endswith('.zip')):
# not (path.exists(path_enmap_image) and is_zipfile(path_enmap_image)):
# raise ValueError("The parameter 'path_enmap_image' must be a directory or the path to an existing zip "
# "archive.")
#
# # extract L1B image archive if needed
# if path_enmap_image.endswith('.zip'):
# if is_zipfile(path_enmap_image):
# path_enmap_image = self.extract_zip_archive(path_enmap_image)
# if not path.isdir(path_enmap_image):
# raise NotADirectoryError(path_enmap_image)
......
......@@ -27,6 +27,6 @@
# You should have received a copy of the GNU Lesser General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
__version__ = '0.18.9'
__versionalias__ = '20220812.01'
__version__ = '0.18.10'
__versionalias__ = '20221115.01'
__author__ = 'Daniel Scheffler'
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment