Skip to content

Commit 04fe553

Browse files
committed
Merge branch 'master' of github.com:makepath/xarray-spatial
2 parents 1da6ebc + 75aac0b commit 04fe553

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+4744
-1422
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,4 @@ dmypy.json
130130
.pyre/
131131
.DS_Store
132132
/test_tiles_output
133+
*.TIF*

MANIFEST.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ prune examples
1212
prune img
1313

1414
exclude xrspatial/_version.py
15+
exclude xrspatial/__pycache__/*
16+
exclude xrspatial/examples/*
17+
exclude xrspatial/examples/user_guide/*
18+
exclude xrspatial/examples/user_guide_idea/*
1519
exclude tile_idea.py
1620
exclude *.yml
1721
exclude *.enc
@@ -21,3 +25,4 @@ exclude *.dot
2125
exclude *.gif
2226
exclude *.svg
2327
exclude tox.ini
28+
exclude test_examples_cli.py

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,3 +204,5 @@ With the introduction of projects like Numba, Python gained new ways to provide
204204
- @jthetzel
205205
- @chase-dwelle
206206
- @SAN154
207+
- @SapirLastimoza-Dooley
208+
- @lex-c

conda.recipe/build.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
set -e
44
set -x
55

6-
BLD_DIR=`pwd`
7-
6+
BLD_DIR='pwd'
87
SRC_DIR=$RECIPE_DIR/..
98
pushd $SRC_DIR
109

conda.recipe/meta.yaml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
1+
{% set sdata = load_setup_py_data() %}
12

23
package:
34
name: xarray-spatial
45
version: 0.1.2
56

7+
source:
8+
path: ..
9+
610
requirements:
7-
build:
11+
host:
812
- python
913
- setuptools
10-
14+
- pyct
1115
run:
1216
- python
13-
- datashader
17+
{% for dep in sdata.get('install_requires', {}) %}
18+
- {{ dep }}
19+
{% endfor %}
1420

21+
# will need the extras_require['tests'] deps below once those are added in setup.py
1522
test:
1623
requires:
1724
- pytest >=2.8.5
25+
# {% for dep in sdata['extras_require']['tests'] %}
26+
# - {{ dep }}
27+
# {% endfor %}
1828
imports:
1929
- xrspatial
2030

conda.recipe/run_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
import xrspatial; xrspatial.test()
1+
import xrspatial
2+
xrspatial.test()

docs/source/conf.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#
1515
import os
1616
import sys
17+
import xrspatial
18+
1719
sys.path.insert(0, os.path.abspath('../..'))
1820

1921
# -- Project information -----------------------------------------------------
@@ -22,7 +24,6 @@
2224
copyright = u'2020, Brendan Collins'
2325
author = u'Brendan Collins'
2426

25-
import xrspatial
2627
version = release = xrspatial.__version__
2728

2829
# -- General configuration ---------------------------------------------------
@@ -34,8 +35,8 @@
3435
# Add any Sphinx extension module names here, as strings. They can be
3536
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3637
# ones.
37-
extensions = [
38-
# 'recommonmark'
38+
extensions = [
39+
# 'recommonmark'
3940
'sphinx.ext.autodoc',
4041
'sphinx.ext.napoleon',
4142
'sphinx.ext.viewcode',

examples/animated_hillshade.py

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
import datashader as ds
33
from datashader.transfer_functions import shade
44
from datashader.transfer_functions import stack
5-
from datashader.transfer_functions import dynspread
6-
from datashader.transfer_functions import set_background
75
from datashader.colors import Elevation
86

97

@@ -23,6 +21,7 @@
2321

2422
terrain = generate_terrain(canvas=cvs)
2523

24+
2625
def heights(locations, src, src_range, height=20):
2726
num_bumps = locations.shape[0]
2827
out = np.zeros(num_bumps, dtype=np.uint16)
@@ -35,11 +34,15 @@ def heights(locations, src, src_range, height=20):
3534
out[r] = height
3635
return out
3736

37+
3838
T = 300000 # Number of trees to add per call
3939
src = terrain.data
40-
trees = bump(W, H, count=T, height_func=partial(heights, src=src, src_range=(1000, 1300), height=5))
41-
trees += bump(W, H, count=T//2, height_func=partial(heights, src=src, src_range=(1300, 1700), height=20))
42-
trees += bump(W, H, count=T//3, height_func=partial(heights, src=src, src_range=(1700, 2000), height=5))
40+
trees = bump(W, H, count=T, height_func=partial(heights, src=src,
41+
src_range=(1000, 1300), height=5))
42+
trees += bump(W, H, count=T//2, height_func=partial(
43+
heights, src=src, src_range=(1300, 1700), height=20))
44+
trees += bump(W, H, count=T//3, height_func=partial(
45+
heights, src=src, src_range=(1700, 2000), height=5))
4346

4447
tree_colorize = trees.copy()
4548
tree_colorize.data[tree_colorize.data == 0] = np.nan
@@ -51,6 +54,7 @@ def heights(locations, src, src_range, height=20):
5154
water = mean(water, passes=50, excludes=[LAND_CONSTANT])
5255
water.data[water.data == LAND_CONSTANT] = np.nan
5356

57+
5458
def create_map(azimuth):
5559

5660
global cvs
@@ -59,10 +63,11 @@ def create_map(azimuth):
5963
global trees
6064

6165
img = stack(shade(terrain, cmap=Elevation, how='linear'),
62-
shade(water, cmap=['aqua', 'white']),
63-
shade(hillshade(terrain + trees, azimuth=azimuth), cmap=['black', 'white'], how='linear', alpha=128),
64-
shade(tree_colorize, cmap='limegreen', how='linear')
65-
)
66+
shade(water, cmap=['aqua', 'white']),
67+
shade(hillshade(terrain + trees, azimuth=azimuth),
68+
cmap=['black', 'white'], how='linear', alpha=128),
69+
shade(tree_colorize, cmap='limegreen', how='linear')
70+
)
6671

6772
print('image created')
6873

@@ -85,29 +90,33 @@ def create_map2():
8590
yield img.to_pil()
8691

8792
img = stack(shade(terrain, cmap=Elevation, how='linear'),
88-
shade(hillshade(terrain, azimuth=210), cmap=['black', 'white'], how='linear', alpha=128),
89-
)
93+
shade(hillshade(terrain, azimuth=210),
94+
cmap=['black', 'white'], how='linear', alpha=128),
95+
)
9096

9197
yield img.to_pil()
9298

9399
img = stack(shade(terrain, cmap=Elevation, how='linear'),
94-
shade(water, cmap=['aqua', 'white']),
95-
shade(hillshade(terrain, azimuth=210), cmap=['black', 'white'], how='linear', alpha=128),
96-
)
100+
shade(water, cmap=['aqua', 'white']),
101+
shade(hillshade(terrain, azimuth=210),
102+
cmap=['black', 'white'], how='linear', alpha=128),
103+
)
97104

98105
yield img.to_pil()
99106

100107
img = stack(shade(terrain, cmap=Elevation, how='linear'),
101-
shade(water, cmap=['aqua', 'white']),
102-
shade(hillshade(terrain + trees, azimuth=210), cmap=['black', 'white'], how='linear', alpha=128),
103-
shade(tree_colorize, cmap='limegreen', how='linear')
104-
)
108+
shade(water, cmap=['aqua', 'white']),
109+
shade(hillshade(terrain + trees, azimuth=210),
110+
cmap=['black', 'white'], how='linear', alpha=128),
111+
shade(tree_colorize, cmap='limegreen', how='linear')
112+
)
105113

106114
yield img.to_pil()
107115
yield img.to_pil()
108116
yield img.to_pil()
109117
yield img.to_pil()
110118

119+
111120
def gif1():
112121

113122
images = []
@@ -119,6 +128,7 @@ def gif1():
119128
save_all=True, append_images=images[1:],
120129
optimize=False, duration=5000, loop=0)
121130

131+
122132
def gif2():
123133

124134
images = list(create_map2())
@@ -127,4 +137,5 @@ def gif2():
127137
save_all=True, append_images=images[1:],
128138
optimize=False, duration=1000, loop=0)
129139

140+
130141
gif2()

examples/datasets.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
3+
data:
4+
- url: https://xarrayspatial.blob.core.windows.net/examples-data/facilities.csv
5+
title: 'Pharmacy Facilities Data'
6+
files:
7+
- facilities.csv
8+
- url: https://xarrayspatial.blob.core.windows.net/examples-data/USA_Block_Groups-shp.zip/USA_Block_Groups.shp
9+
title: 'USA Block Groups Shapefile'
10+
files:
11+
- USA_Block_Groups.shp
12+
- url: https://xarrayspatial.blob.core.windows.net/examples-data/USA_Counties-shp.zip/USA_Counties.shp
13+
title: 'USA Counties Shapefile'
14+
files:
15+
- USA_Counties.shp

0 commit comments

Comments
 (0)