Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SRTM Version 3 Support #39

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
*.tar
*.zip
*.hgt
*.pyc
*.swp
*.swo
Expand All @@ -10,3 +8,7 @@ tags
MANIFEST
build/
dist/
htmlcov/

SRTM.py.egg-info/
.coverage
30 changes: 24 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,32 @@ language: python
# Use container-based infrastructure
sudo: false

# Those without lxml wheels first because building lxml is slow

python:
- 3.5
- 2.7
- 2.6
- 3.4
- 3.3
- 3.4
- 3.5
- 3.6

script:
# Do not use these credentials in your project
# Get a free account at https://urs.earthdata.nasa.gov/users/new
env:
- SRTMEDUser=srtmpyuser SRTMEDPass=Srtm.py1

install:
- pip install requests
- python -m unittest test
- pip install coverage

script:
- coverage run --source=srtm ./test.py

after_success:
- pip install coveralls
- coveralls

after_script:
- coverage report
- pip install pyflakes pycodestyle
- pyflakes . | tee >(wc -l)
- pycodestyle --statistics --count .
74 changes: 74 additions & 0 deletions dev_tools/merger.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import json
import pickle


v1_1a = {}
v1_3a = {}
v2_1a = {}
v2_3a = {}
v3 = {}

combined = {}

keys = set()


# Read in each file
with open('v1_1a.txt') as f:
tiles = f.read()
for line in tiles.splitlines():
v1_1a[line] = True
keys.add(line)


with open('v1_3a.txt') as f:
tiles = f.read()
for line in tiles.splitlines():
key, _, value = line.partition(', ')
v1_3a[key] = value
keys.add(key)

with open('v2_1a.txt') as f:
tiles = f.read()
for line in tiles.splitlines():
key, _, value = line.partition(', ')
v2_1a[key] = value
keys.add(key)

with open('v2_3a.txt') as f:
tiles = f.read()
for line in tiles.splitlines():
key, _, value = line.partition(', ')
v2_3a[key] = value
keys.add(key)

with open('v3.txt') as f:
tiles = f.read()
for line in tiles.splitlines():
v3[line] = True
keys.add(line)


# Merge
for key in keys:
ver1_1arc = False
ver1_3arc = ''
ver2_1arc = ''
ver2_3arc = ''
ver3 = False
if key in v1_1a: ver1_1arc = True
if key in v1_3a: ver1_3arc = v1_3a[key]
if key in v2_1a: ver2_1arc = v2_1a[key]
if key in v2_3a: ver2_3arc = v2_3a[key]
if key in v3: ver3 = True
combined[key] = (ver1_1arc, ver1_3arc, ver2_1arc, ver2_3arc, ver3)


# Write out serialized file options
with open('srtm.json', 'w') as fp:
json.dump(combined, fp, sort_keys=True)
with open('srtm.pickle','wb') as fp:
pickle.dump(combined, fp)



Loading