Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ jobs:
name: pypi
steps:
- uses: actions/checkout@v4
- name: Setup Python 3.10
- name: Setup Python 3.12
uses: actions/setup-python@v3
with:
python-version: "3.10"
python-version: "3.12"

- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: '3.10'
python-version: '3.12'
auto-activate-base: false

- name: Build package
shell: bash -l {0}
run: |
conda create -n deploy_env python=3.10 libgdal=3.5.2 build -c conda-forge -y
conda create -n deploy_env python=3.12 build -c conda-forge -y
conda activate deploy_env
python -m build -C--global-option=bdist_wheel -C--global-option=--build-number=0 --wheel

Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python 3.10
- name: Setup Python 3.12
uses: actions/setup-python@v3
with:
python-version: "3.10"
python-version: "3.12"
- name: Create test env
shell: bash -l {0}
run: |
Expand All @@ -30,19 +30,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python 3.10
- name: Setup Python 3.12
uses: actions/setup-python@v3
with:
python-version: "3.10"
python-version: "3.12"
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: '3.10'
python-version: '3.12'
auto-activate-base: false
- name: Create test env
shell: bash -l {0}
run: |
conda create -n test_env python=3.12 libgdal=3.5.2 -c conda-forge -c defaults -y
conda create -n test_env python=3.12 libgdal=3.9 -c conda-forge -c defaults -y
conda activate test_env
PIP_NO_BINARY=rasterio pip install .
pip install pylint mccabe
Expand Down
12 changes: 10 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Python #
*.py[cod]
*$py.class
*$py.class

# Distribution / packaging
.Python build/
Expand All @@ -20,5 +20,13 @@ dist/
*.egg
*.whl
*.manifest
*.spec
*.spec

# Tests
.coverage
listing.lst

# IDE
.idea/
.ipynb_checkpoints/

23 changes: 13 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
FROM continuumio/miniconda3
FROM ghcr.io/osgeo/gdal:ubuntu-small-3.9.2

ADD environment.yml /env/environment.yml
ADD env_update.yml /env/env_update.yml
ADD . /georastertools_src/

RUN conda env update -f /env/environment.yml -n base
RUN conda env update -f /env/env_update.yml -n base
RUN apt-get update -y --quiet && \
DEBIAN_FRONTED=noninteractive apt-get install --quiet --yes --no-install-recommends \
python3-pip \
build-essential \
python3-dev \
&& \
PIP_NO_BINARY=rasterio pip install --no-cache-dir --break-system-packages /georastertools_src && \
rm -r /georastertools_src/ && \
DEBIAN_FRONTED=noninteractive apt-get purge --quiet --yes build-essential python3-dev &&\
DEBIAN_FRONTED=noninteractive apt-get autoremove --quiet --yes

ADD . .

RUN pip install -e .

CMD ["rastertools", "--help"]
CMD ["rio", "georastertools", "--help"]
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Create a conda environment by typing the following:

conda env create -n georastertools
conda activate
conda install python=3.12 libgdal=3.5.2
conda install python=3.12 libgdal=3.9
pip install georastertools --no-binary rasterio

For more details, including installation as a Docker or Singularity image, please refer to the documentation. : docs/install.rst
Expand Down
2 changes: 1 addition & 1 deletion docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Secondly, run commands:

.. code-block:: console

$ conda install python=3.12 libgdal=3.5.2
$ conda install python=3.12 libgdal=3.9
$ pip install georastertools --no-binary rasterio

``georastertools`` will be installed in the conda environment. Then, the CLI ``georastertools`` can be used and the API :obj:`eolab.georastertools`
Expand Down
27 changes: 14 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,27 @@
author_email="",
url="https://github.com/CNES/rastertools",
packages=find_packages(exclude=['tests']),
package_data={"eolab.georastertools": ["**/*.json"]},
include_package_data=True,
zip_safe=False,
setup_requires = ["setuptools_scm"],
setup_requires=["setuptools_scm"],
install_requires=[
'click==8.1.8',
'click>=8.2',
'rasterio',
'pytest>=3.6',
'pytest-cov',
'geopandas==0.13',
'kiwisolver==1.4.5',
'matplotlib==3.7.3',
'packaging==24.1',
'fiona==1.9.6',
'sphinx_rtd_theme==3.0.1',
'pip==24.2',
'sphinx==7.1.2',
'scipy==1.16',
'geopandas>=0.13',
'kiwisolver>=1.4.5',
'matplotlib>=3.7.3',
'packaging>=24.1',
'fiona>=1.9.6',
'sphinx_rtd_theme>=3.0.1',
'sphinx>=7.1.2',
'scipy',
'pyscaffold',
'gdal==3.5.0',
'tqdm==4.66'
'gdal>=3.5.0,<3.10',
'tqdm>=4.66',
'numpy<2'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, this could be a major problem at some point...

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. With numpy >= 2, there are differences in statistical calculations, especially the mean. I haven't checked further. I think it would be better to deal with this in another issue, as it may require changes in the code.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I concur totally, let's merge this one and open another issue for the future.

],
entry_points="""
[rasterio.rio_plugins]
Expand Down
Binary file removed tests/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file removed tests/__pycache__/cmptools.cpython-38.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed tests/__pycache__/utils4test.cpython-38.pyc
Binary file not shown.
8 changes: 7 additions & 1 deletion tests/test_rasterproduct.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@

from .utils4test import RastertoolsTestsData

__refdir = RastertoolsTestsData.tests_ref_data_dir.replace(os.getcwd() + "/", "") + "/test_rasterproduct/"
from packaging.version import Version
from osgeo import gdal

if Version(gdal.__version__) < Version("3.8.0"):
__refdir = RastertoolsTestsData.tests_ref_data_dir.replace(os.getcwd() + "/", "") + "/test_rasterproduct/gdal-3.8/"
else:
__refdir = RastertoolsTestsData.tests_ref_data_dir.replace(os.getcwd() + "/", "") + "/test_rasterproduct/gdal+3.8/"


def test_rasterproduct_valid_parameters():
Expand Down
6 changes: 3 additions & 3 deletions tests/test_rastertools.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
class TestCase:
__test__ = False

def __init__(self, args):
def __init__(self, args, sys_code=0):
self._args = args.split()
self._outputs = list()
self._logs = list()
self._sys_exit = 0
self._sys_exit = sys_code

def __repr__(self):
return (f"georastertools {' '.join(self._args)}"
Expand Down Expand Up @@ -144,7 +144,7 @@ def test_rastertools_command_line_info():
TestCase("--help"),
TestCase("-h"),
TestCase("--version"),
TestCase(""),
TestCase("", 2),
TestCase("radioindice --help"),
TestCase("ri -h"),
TestCase("zonalstats --help"),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<VRTDataset rasterXSize="1203" rasterYSize="1175">
<SRS dataAxisToSRSAxisMapping="1,2">PROJCS["WGS 84 / UTM zone 30N",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-3],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","32630"]]</SRS>
<GeoTransform> 7.4286000000000000e+05, 1.0000000000000000e+01, 0.0000000000000000e+00, 4.8486600000000000e+06, 0.0000000000000000e+00, -1.0000000000000000e+01</GeoTransform>
<VRTRasterBand dataType="UInt16" band="1">
<Description>Band 2 (490nm)</Description>
<NoDataValue>0</NoDataValue>
<SimpleSource>
<SourceFilename relativeToVRT="0">/vsizip/tests/tests_data/S2A_MSIL2A_20190116T105401_N0211_R051_T30TYP_20190116T120806.zip/S2A_MSIL2A_20190116T105401_N0211_R051_T30TYP_20190116T120806.SAFE/GRANULE/L2A_T30TYP_A018638_20190116T105431/IMG_DATA/R10m/T30TYP_20190116T105401_B02_10m.jp2</SourceFilename>
<SourceBand>1</SourceBand>
<SrcRect xOff="0" yOff="0" xSize="1198" ySize="1170" />
<DstRect xOff="5" yOff="5" xSize="1198" ySize="1170" />
</SimpleSource>
</VRTRasterBand>
<VRTRasterBand dataType="UInt16" band="2">
<Description>Band 3 (560nm)</Description>
<NoDataValue>0</NoDataValue>
<SimpleSource>
<SourceFilename relativeToVRT="0">/vsizip/tests/tests_data/S2A_MSIL2A_20190116T105401_N0211_R051_T30TYP_20190116T120806.zip/S2A_MSIL2A_20190116T105401_N0211_R051_T30TYP_20190116T120806.SAFE/GRANULE/L2A_T30TYP_A018638_20190116T105431/IMG_DATA/R10m/T30TYP_20190116T105401_B03_10m.jp2</SourceFilename>
<SourceBand>1</SourceBand>
<SrcRect xOff="0" yOff="0" xSize="1198" ySize="1170" />
<DstRect xOff="5" yOff="5" xSize="1198" ySize="1170" />
</SimpleSource>
</VRTRasterBand>
<VRTRasterBand dataType="UInt16" band="3">
<Description>Band 4 (665nm)</Description>
<NoDataValue>0</NoDataValue>
<SimpleSource>
<SourceFilename relativeToVRT="0">/vsizip/tests/tests_data/S2A_MSIL2A_20190116T105401_N0211_R051_T30TYP_20190116T120806.zip/S2A_MSIL2A_20190116T105401_N0211_R051_T30TYP_20190116T120806.SAFE/GRANULE/L2A_T30TYP_A018638_20190116T105431/IMG_DATA/R10m/T30TYP_20190116T105401_B04_10m.jp2</SourceFilename>
<SourceBand>1</SourceBand>
<SrcRect xOff="0" yOff="0" xSize="1198" ySize="1170" />
<DstRect xOff="5" yOff="5" xSize="1198" ySize="1170" />
</SimpleSource>
</VRTRasterBand>
<VRTRasterBand dataType="UInt16" band="4">
<Description>Band 8 (842nm)</Description>
<NoDataValue>0</NoDataValue>
<SimpleSource>
<SourceFilename relativeToVRT="0">/vsizip/tests/tests_data/S2A_MSIL2A_20190116T105401_N0211_R051_T30TYP_20190116T120806.zip/S2A_MSIL2A_20190116T105401_N0211_R051_T30TYP_20190116T120806.SAFE/GRANULE/L2A_T30TYP_A018638_20190116T105431/IMG_DATA/R10m/T30TYP_20190116T105401_B08_10m.jp2</SourceFilename>
<SourceBand>1</SourceBand>
<SrcRect xOff="0" yOff="0" xSize="1198" ySize="1170" />
<DstRect xOff="5" yOff="5" xSize="1198" ySize="1170" />
</SimpleSource>
</VRTRasterBand>
<VRTRasterBand dataType="UInt16" band="5">
<Description>Band 11 (1610nm)</Description>
<NoDataValue>0</NoDataValue>
<SimpleSource>
<SourceFilename relativeToVRT="0">/vsizip/tests/tests_data/S2A_MSIL2A_20190116T105401_N0211_R051_T30TYP_20190116T120806.zip/S2A_MSIL2A_20190116T105401_N0211_R051_T30TYP_20190116T120806.SAFE/GRANULE/L2A_T30TYP_A018638_20190116T105431/IMG_DATA/R20m/T30TYP_20190116T105401_B11_20m.jp2</SourceFilename>
<SourceBand>1</SourceBand>
<SrcRect xOff="0" yOff="0" xSize="599" ySize="585" />
<DstRect xOff="4" yOff="4" xSize="1198" ySize="1170" />
</SimpleSource>
</VRTRasterBand>
<VRTRasterBand dataType="UInt16" band="6">
<Description>Band 12 (2190nm)</Description>
<NoDataValue>0</NoDataValue>
<SimpleSource>
<SourceFilename relativeToVRT="0">/vsizip/tests/tests_data/S2A_MSIL2A_20190116T105401_N0211_R051_T30TYP_20190116T120806.zip/S2A_MSIL2A_20190116T105401_N0211_R051_T30TYP_20190116T120806.SAFE/GRANULE/L2A_T30TYP_A018638_20190116T105431/IMG_DATA/R20m/T30TYP_20190116T105401_B12_20m.jp2</SourceFilename>
<SourceBand>1</SourceBand>
<SrcRect xOff="0" yOff="0" xSize="599" ySize="585" />
<DstRect xOff="4" yOff="4" xSize="1198" ySize="1170" />
</SimpleSource>
</VRTRasterBand>
<VRTRasterBand dataType="UInt16" band="7">
<Description>Band 5 (705nm)</Description>
<NoDataValue>0</NoDataValue>
<SimpleSource>
<SourceFilename relativeToVRT="0">/vsizip/tests/tests_data/S2A_MSIL2A_20190116T105401_N0211_R051_T30TYP_20190116T120806.zip/S2A_MSIL2A_20190116T105401_N0211_R051_T30TYP_20190116T120806.SAFE/GRANULE/L2A_T30TYP_A018638_20190116T105431/IMG_DATA/R20m/T30TYP_20190116T105401_B05_20m.jp2</SourceFilename>
<SourceBand>1</SourceBand>
<SrcRect xOff="0" yOff="0" xSize="599" ySize="585" />
<DstRect xOff="4" yOff="4" xSize="1198" ySize="1170" />
</SimpleSource>
</VRTRasterBand>
<VRTRasterBand dataType="UInt16" band="8">
<Description>Band 6 (740nm)</Description>
<NoDataValue>0</NoDataValue>
<SimpleSource>
<SourceFilename relativeToVRT="0">/vsizip/tests/tests_data/S2A_MSIL2A_20190116T105401_N0211_R051_T30TYP_20190116T120806.zip/S2A_MSIL2A_20190116T105401_N0211_R051_T30TYP_20190116T120806.SAFE/GRANULE/L2A_T30TYP_A018638_20190116T105431/IMG_DATA/R20m/T30TYP_20190116T105401_B06_20m.jp2</SourceFilename>
<SourceBand>1</SourceBand>
<SrcRect xOff="0" yOff="0" xSize="599" ySize="585" />
<DstRect xOff="4" yOff="4" xSize="1198" ySize="1170" />
</SimpleSource>
</VRTRasterBand>
<VRTRasterBand dataType="UInt16" band="9">
<Description>Band 7 (783nm)</Description>
<NoDataValue>0</NoDataValue>
<SimpleSource>
<SourceFilename relativeToVRT="0">/vsizip/tests/tests_data/S2A_MSIL2A_20190116T105401_N0211_R051_T30TYP_20190116T120806.zip/S2A_MSIL2A_20190116T105401_N0211_R051_T30TYP_20190116T120806.SAFE/GRANULE/L2A_T30TYP_A018638_20190116T105431/IMG_DATA/R20m/T30TYP_20190116T105401_B07_20m.jp2</SourceFilename>
<SourceBand>1</SourceBand>
<SrcRect xOff="0" yOff="0" xSize="599" ySize="585" />
<DstRect xOff="4" yOff="4" xSize="1198" ySize="1170" />
</SimpleSource>
</VRTRasterBand>
<VRTRasterBand dataType="UInt16" band="10">
<Description>Band 8a (865nm)</Description>
<NoDataValue>0</NoDataValue>
<SimpleSource>
<SourceFilename relativeToVRT="0">/vsizip/tests/tests_data/S2A_MSIL2A_20190116T105401_N0211_R051_T30TYP_20190116T120806.zip/S2A_MSIL2A_20190116T105401_N0211_R051_T30TYP_20190116T120806.SAFE/GRANULE/L2A_T30TYP_A018638_20190116T105431/IMG_DATA/R20m/T30TYP_20190116T105401_B8A_20m.jp2</SourceFilename>
<SourceBand>1</SourceBand>
<SrcRect xOff="0" yOff="0" xSize="599" ySize="585" />
<DstRect xOff="4" yOff="4" xSize="1198" ySize="1170" />
</SimpleSource>
</VRTRasterBand>
<VRTRasterBand dataType="UInt16" band="11">
<Description>Band 1 (443nm)</Description>
<NoDataValue>0</NoDataValue>
<SimpleSource>
<SourceFilename relativeToVRT="0">/vsizip/tests/tests_data/S2A_MSIL2A_20190116T105401_N0211_R051_T30TYP_20190116T120806.zip/S2A_MSIL2A_20190116T105401_N0211_R051_T30TYP_20190116T120806.SAFE/GRANULE/L2A_T30TYP_A018638_20190116T105431/IMG_DATA/R60m/T30TYP_20190116T105401_B01_60m.jp2</SourceFilename>
<SourceBand>1</SourceBand>
<SrcRect xOff="0" yOff="0" xSize="200" ySize="195" />
<DstRect xOff="0" yOff="0" xSize="1200" ySize="1170" />
</SimpleSource>
</VRTRasterBand>
<VRTRasterBand dataType="UInt16" band="12">
<Description>Band 9 (940nm)</Description>
<NoDataValue>0</NoDataValue>
<SimpleSource>
<SourceFilename relativeToVRT="0">/vsizip/tests/tests_data/S2A_MSIL2A_20190116T105401_N0211_R051_T30TYP_20190116T120806.zip/S2A_MSIL2A_20190116T105401_N0211_R051_T30TYP_20190116T120806.SAFE/GRANULE/L2A_T30TYP_A018638_20190116T105431/IMG_DATA/R60m/T30TYP_20190116T105401_B09_60m.jp2</SourceFilename>
<SourceBand>1</SourceBand>
<SrcRect xOff="0" yOff="0" xSize="200" ySize="195" />
<DstRect xOff="0" yOff="0" xSize="1200" ySize="1170" />
</SimpleSource>
</VRTRasterBand>
</VRTDataset>
Loading
Loading