Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewhanson committed Jul 15, 2016
0 parents commit 783376b
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
*.pyc
*~
24 changes: 24 additions & 0 deletions .travis.yml
@@ -0,0 +1,24 @@
language: python

python:
- '2.7'
- '3.5'

addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- libgdal1h
- gdal-bin
- libgdal-dev

before_install:
- pip install -r requirements.txt
- pip install -r requirements-dev.txt

install:
- pip install -e .

script:
- nosetests -v -s
8 changes: 8 additions & 0 deletions README.md
@@ -0,0 +1,8 @@
# sat-stats

This utility library calculates zonal statistics on images being stored remotely on S3. Currently it uses the rasterstats package.

This requires GDAL2, which allows direct GDAL reading in S3 buckets.

For now, this is just calculating stats given an S3 key. However, the intention is that this could be a higher level library that uses sat-api and sat-search for calculating zonal stats on imagery stored on S3 file without downloading any data.

1 change: 1 addition & 0 deletions requirements.txt
@@ -0,0 +1 @@
rasterstats==0.10.3
Empty file added satstats/__init__.py
Empty file.
5 changes: 5 additions & 0 deletions satstats/utils.py
@@ -0,0 +1,5 @@
import rasterstats

def get_stats(s3key, vectors):
""" Retrieve stats from image for vectors """
pass
1 change: 1 addition & 0 deletions satstats/version.py
@@ -0,0 +1 @@
__version__ = '0.0.1'
41 changes: 41 additions & 0 deletions setup.py
@@ -0,0 +1,41 @@
#!/usr/bin/env python
import os
from codecs import open
from setuptools import setup, find_packages
import imp

here = os.path.abspath(os.path.dirname(__file__))
__version__ = imp.load_source('satstats.version', 'satstats/version.py').__version__

# get the dependencies and installs
with open(os.path.join(here, 'requirements.txt'), encoding='utf-8') as f:
all_reqs = f.read().split('\n')

install_requires = [x.strip() for x in all_reqs if 'git+' not in x]
dependency_links = [x.strip().replace('git+', '') for x in all_reqs if 'git+' not in x]

setup(
name='sat-stats',
version=__version__,
author='Matthew Hanson (matthewhanson)',
description='Get zonal summary stats from images that are stored remotely, without downloading entire image'
url='https://github.com/sat-utils/sat-stats',
license='MIT',
classifiers=[
'Framework :: Pytest',
'Topic :: Scientific/Engineering :: GIS',
'Topic :: Scientific/Engineering',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: Freeware',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
],
packages=find_packages(exclude=['docs', 'tests*']),
include_package_data=True,
install_requires=install_requires,
dependency_links=dependency_links,
tests_require=['nose'],
)
12 changes: 12 additions & 0 deletions test/test_utils.py
@@ -0,0 +1,12 @@
import unittest
from satstats import utils

def TestUtils(unittest.TestCase):

s3key = ''
vectors = None

def test_get_stats(self):
""" Get statistics for vector """
stats = utils.get_stats(self.s3key, vectors)
self.assertTrue(stats is not None)

0 comments on commit 783376b

Please sign in to comment.