Skip to content

Commit

Permalink
Merge pull request #43 from KipCrossing/add_dev_recipe
Browse files Browse the repository at this point in the history
Add dev recipe and update requirements
  • Loading branch information
KipCrossing committed Jun 30, 2022
2 parents ab5d7c7 + d76f80e commit 257e90b
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 25 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ There is also an Anaconda-based package available, published on [conda-forge](ht
conda install -c conda-forge python-geotiff
```

For local development from sources, you can install geotiff with its development requirements using:

```
git clone git@github.com:KipCrossing/geotiff.git
cd geotiff
pip install -e .[dev]
```

### Usage

#### Making the GeoTiff object
Expand Down
4 changes: 2 additions & 2 deletions docs/ CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ If you would like to contribute to this project, please fork this repo and make

You can join the conversation by saying hi in the [project discussion board](https://github.com/KipCrossing/geotiff/discussions).

To help users and and other contributes, be sure to:
To help users and other contributes, be sure to:
- make doc blocs if appropriate
- use typing wherever possible.
- format with black

*Note:* The continuous integration has lint checking with **mypy**, so be sure to check it yourself before making a PR.
*Note:* The continuous integration has lint checking with **mypy**, so be sure to check it yourself before making a PR.
2 changes: 1 addition & 1 deletion geotiff/utils/crs_code_guess.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ def crs_code_gusser(GTCitationGeo: str) -> Tuple[int, float]:
crs_key = crs
crs_code = all_crs[crs_key]

return (crs_code, best_score)
return crs_code, best_score
5 changes: 2 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
pytest
tifffile==2021.7.2
tifffile>=2021.7.2
numpy
pyproj
zarr==2.10.*
zarr>=2.10.*
27 changes: 17 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import os
import sys
from setuptools.command.install import install # type: ignore
from setuptools import setup, find_packages # type: ignore
from setuptools.command.egg_info import egg_info # type: ignore


VERSION = "0.2.5"
VERSION = "0.2.6"

# Send to pypi
# python3 setup.py sdist bdist_wheel
Expand All @@ -14,6 +12,12 @@
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()

requirements = []
with open("requirements.txt", "r", encoding="utf-8") as fh:
for dep in fh.readlines():
requirements.append(dep)

dev_requirements = ["pytest"]

setup(
name="geotiff",
Expand All @@ -26,17 +30,20 @@
url="https://github.com/Open-Source-Agriculture/geotiff",
packages=find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
],
python_requires=">=3.7",
install_requires=[
"tifffile==2021.7.2",
"numpy",
"pyproj",
"zarr==2.10.*",
],
install_requires=requirements,
extras_require={"dev": dev_requirements},
license_files=("LICENSE",),
zip_safe=False
# cmdclass={"egg_info": egg_info_ex},
)
18 changes: 9 additions & 9 deletions tests/test_geotiff.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
from typing import Callable
import numpy as np # type: ignore
import pytest
import os
from geotiff import GeoTiff
import zarr # type: ignore

@pytest.fixture(params=["dem.tif", "gda_94_sand.tif", "sand_test.tif", "red.tif"])

@pytest.fixture(params=["dem.tif", "gda_94_sand.tif", "sand_test.tif", "red.tif"])
def geo_tiff(request):
filename = request.param
filename = request.param
dir = dir = "./tests/inputs/"
# TODO: test bands, and crs params
return GeoTiff(os.path.join(dir, filename))
return GeoTiff(os.path.join(dir, filename))


@pytest.fixture
Expand All @@ -24,6 +24,7 @@ def test_read(geo_tiff: GeoTiff):
assert isinstance(zarr_array, zarr.Array)
print(zarr_array.chunks)


def test_read_box(area_box, geo_tiff: GeoTiff):
print("testing read tiff")
print(f"reading: {geo_tiff}")
Expand Down Expand Up @@ -56,11 +57,10 @@ def test_int_box(area_box, geo_tiff: GeoTiff):
assert isinstance(intBox[0], tuple)
assert isinstance(intBox[1], tuple)
intBox_outer = geo_tiff.get_int_box(area_box, outer_points=True)
assert intBox[0][0] == intBox_outer[0][0]+1
assert intBox[0][1] == intBox_outer[0][1]+1
assert intBox[1][0] == intBox_outer[1][0]-1
assert intBox[1][1] == intBox_outer[1][1]-1

assert intBox[0][0] == intBox_outer[0][0] + 1
assert intBox[0][1] == intBox_outer[0][1] + 1
assert intBox[1][0] == intBox_outer[1][0] - 1
assert intBox[1][1] == intBox_outer[1][1] - 1


def test_conversions(area_box, geo_tiff: GeoTiff):
Expand Down

0 comments on commit 257e90b

Please sign in to comment.