Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunato committed Jun 18, 2021
2 parents 39e0f96 + 7581cf6 commit 32c8d91
Show file tree
Hide file tree
Showing 21 changed files with 308 additions and 120 deletions.
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**Code To Reproduce**
CLI commands or Python code snippet to reproduce the bug. Please use maximum verbosity using:
```sh
eodag -vvv [OPTIONS] COMMAND [ARGS]...
```
or
```py
from eodag.utils.logging import setup_logging
setup_logging(verbose=3)
```

**Output**
Compete output obtained with maximal verbosity.

**Environment:**
- Python version: `python --version`
- EODAG version: `eodag version`
- eodag-cube version

**Additional context**
Add any other context about the bug here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context about the feature request here.
14 changes: 14 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
### Your checklist for this pull request
Please review the [guidelines for contributing](../README.rst) to this repository.

- [ ] Make sure you are making a pull request against the **develop branch** (left side). Also you should start *your branch* off *our develop*.
- [ ] Check the commit's or even all commits' message styles matches our requested structure.
- [ ] Check your code additions will fail neither code linting checks nor unit test.

### Description
Please describe your pull request.

### Further comments
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

Thank you!
47 changes: 47 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Publish to PyPI

on:
push:
tags:
- "v*"
workflow_dispatch:

jobs:
build-n-publish:
name: Build and publish to PyPI
runs-on: ubuntu-latest

steps:
- name: Checkout source
uses: actions/checkout@v2

- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: "3.7"

- name: Check that the current version isn't already on PyPi
run: |
if [ "$(./get_pypi_latest_version.sh)" != "$(python setup.py --version)" ]
then
echo "Current version is not on PyPI, proceed with bulding"
else
echo "Current version is the latest version uploaded to PyPI"
exit 1
fi
- name: Check long description is OK for PyPI with tox
run: |
python -m pip install --upgrade pip
python -m pip install tox sphinx
tox -e pypi
- name: Build a binary wheel and a source tarball
run: |
python -m pip install setuptools wheel
python setup.py sdist bdist_wheel
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
91 changes: 91 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Run Tests

on:
push:
branches: [master, develop]
pull_request:
branches: [master, develop]
schedule:
- cron: "0 7 * * 1"
workflow_dispatch:

jobs:
lint:
name: Linting (pre-commit)
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: "3.7"
- name: Run pre-commit action
uses: pre-commit/action@v2.0.0

tests:
name: Test it!
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.6, 3.9]
os: [ubuntu-latest]
steps:
- name: Checkout the repo
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Update pip
run: python -m pip install --upgrade pip
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Get current week number
id: get-week
shell: bash
run: echo "::set-output name=week::$(date +'%V')"
- name: Pip cache
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ steps.get-week.outputs.week }}-${{ hashFiles('setup.py') }}
- name: Install from eodag develop branch
run: pip install git+https://github.com/CS-SI/eodag.git@develop
- name: Install other deps
run: python -m pip install .[dev]
- name: Test with pytest
run: pytest --show-capture=no --cov --cov-fail-under=50

check-pypi:
name: Long description check for PyPI
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: "3.7"
- name: Update pip
run: python -m pip install --upgrade pip
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Get current week number
id: get-week
shell: bash
run: echo "::set-output name=week::$(date +'%V')"
- name: Pip cache
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ steps.get-week.outputs.week }}-${{ hashFiles('setup.py') }}
- name: Install tox and sphinx (to have rst2html.py utility available)
run: |
python -m pip install tox sphinx
- name: Testing with tox
run: python -m tox -e pypi
70 changes: 34 additions & 36 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,41 +1,39 @@
# See https://pre-commit.com/ for usage and config
exclude: '^$'
fail_fast: false
repos:
- repo: local
hooks:
- id: isort
name: isort
stages: [commit]
language: system
entry: isort
types: [python]

- id: black
name: black
stages: [commit]
language: system
entry: black
types: [python]
- repo: https://github.com/pre-commit/pre-commit-hooks.git
rev: v3.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-docstring-first
- id: check-json
- id: check-yaml
args: [--allow-multiple-documents, --unsafe]
- id: check-xml
- id: check-added-large-files
args: ['--maxkb=1600']
- id: debug-statements
- id: check-merge-conflict

- id: flake8
name: flake8
stages: [commit]
language: system
entry: flake8
types: [python]
exclude: setup.py
- repo: 'https://gitlab.com/pycqa/flake8'
rev: 3.9.0
hooks:
- id: flake8

- id: pytest
name: pytest
stages: [commit]
language: system
entry: pytest
types: [python]
pass_filenames: false
- repo: 'https://github.com/ambv/black'
rev: 20.8b1
hooks:
- id: black
args: ['--safe']

- id: pytest-cov
name: pytest
stages: [push]
language: system
entry: pytest --cov --cov-fail-under=50
types: [python]
pass_filenames: false
- repo: 'https://github.com/chewse/pre-commit-mirrors-pydocstyle'
rev: v2.1.1
hooks:
- id: pydocstyle

- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.7.0
hooks:
- id: isort
17 changes: 17 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Release history
---------------

0.1.2 (2021-06-18)
++++++++++++++++++

- DataArray shape flipped (#12, thanks @ClaudioCiociola)

0.1.1 (2021-01-15)
++++++++++++++++++

- get_data, drivers, and RPC server from eodag

0.1.0 (2021-01-15)
++++++++++++++++++

- First release
19 changes: 14 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Usage - Python API
Example usage for interacting with the api in your Python code:

.. code-block:: python
from eodag import EODataAccessGateway
from rasterio.crs import CRS
Expand All @@ -41,9 +41,9 @@ Example usage for interacting with the api in your Python code:
start, end = '2020-06-04', '2020-06-05'
search_results, _ = dag.search(productType=product_type, geom=footprint, start=start, end=end)
data = search_results[0].get_data(
crs=CRS.from_epsg(4326),
resolution=0.0006,
band="B01",
crs=CRS.from_epsg(4326),
resolution=0.0006,
band="B01",
extent=footprint
)
print(data)
Expand All @@ -57,6 +57,16 @@ Example usage for interacting with the api in your Python code:
[1732, 2219, 2630, ..., 1670, 1659, 1664],
[1548, 1832, 2134, ..., 1722, 1732, 1718]], dtype=uint16)
Contribute
==========

If you intend to contribute to eodag-sentinelsat source code::

git clone https://github.com/CS-SI/eodag-cube.git
cd eodag-cube
python -m pip install -e .[dev]
pre-commit install
tox

LICENSE
=======
Expand All @@ -69,4 +79,3 @@ AUTHORS
=======

EODAG is developed by `CS GROUP - France <https://www.c-s.fr>`_.

4 changes: 3 additions & 1 deletion eodag_cube/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""EODAG-cube: Data access for EODAG."""

__title__ = "eodag-cube"
__description__ = "Data access for EODAG"
__version__ = "0.1.1"
__version__ = "0.1.2"
__author__ = "CS GROUP - France (CSSI)"
__author_email__ = "admin@geostorm.eu"
__url__ = "https://github.com/CS-SI/eodag-cube"
Expand Down
4 changes: 2 additions & 2 deletions eodag_cube/api/product/_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def get_data(self, crs, resolution, band, extent):
min_x, min_y, max_x, max_y = extent
height = int((max_y - min_y) / resolution)
width = int((max_x - min_x) / resolution)
out_shape = (width, height)
out_shape = (height, width)
with rasterio.open(dataset_address) as src:
with WarpedVRT(src, crs=crs, resampling=Resampling.bilinear) as vrt:
array = vrt.read(
Expand All @@ -114,7 +114,7 @@ def get_data(self, crs, resolution, band, extent):
out_shape=out_shape,
resampling=Resampling.bilinear,
)
return xr.DataArray(array)
return xr.DataArray(dims=["y", "x"], data=array)

def encode(self, raster, encoding="protobuf"):
"""Encode the subset to a network-compatible format.
Expand Down
3 changes: 2 additions & 1 deletion eodag_cube/api/product/drivers/sentinel2_l1c.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import rasterio

from eodag.api.product.drivers.base import DatasetDriver
from eodag.utils import uri_to_path
from eodag.utils.exceptions import AddressNotFound, UnsupportedDatasetAddressScheme


Expand Down Expand Up @@ -58,7 +59,7 @@ def get_data_address(self, eo_product, band):
product_location_scheme = eo_product.location.split("://")[0]
if product_location_scheme == "file":
top_level_mtd = os.path.join(
re.sub(r"file://", "", eo_product.location), "MTD_MSIL1C.xml"
uri_to_path(eo_product.location), "MTD_MSIL1C.xml"
)
# Ignore the NotGeoreferencedWarning thrown by rasterio
with warnings.catch_warnings():
Expand Down
Loading

0 comments on commit 32c8d91

Please sign in to comment.