3636 },
3737 {
3838 "cell_type": "code",
39- "execution_count": 1 ,
39+ "execution_count": null ,
4040 "metadata": {},
4141 "outputs": [],
42- "source": [
43- "import datashader as ds\n",
44- "from datashader.colors import Elevation\n",
45- "import datashader.transfer_functions as tf\n",
46- "from datashader.transfer_functions import shade\n",
47- "from datashader.transfer_functions import stack\n",
48- "from datashader.transfer_functions import dynspread\n",
49- "from datashader.transfer_functions import set_background\n",
50- "from datashader.transfer_functions import Images, Image\n",
51- "from datashader.utils import orient_array\n",
52- "import numpy as np\n",
53- "import xarray as xr"
54- ]
42+ "source": "import datashader as ds\nfrom datashader.colors import Elevation\nimport datashader.transfer_functions as tf\nfrom datashader.transfer_functions import shade\nfrom datashader.transfer_functions import stack\nfrom datashader.transfer_functions import dynspread\nfrom datashader.transfer_functions import set_background\nfrom datashader.transfer_functions import Images, Image\nfrom datashader.utils import orient_array\nimport numpy as np\nimport xarray as xr\nimport rioxarray"
5543 },
5644 {
5745 "cell_type": "markdown",
6452 },
6553 {
6654 "cell_type": "code",
67- "execution_count": 2 ,
55+ "execution_count": null ,
6856 "metadata": {},
69- "outputs": [
70- {
71- "name": "stderr",
72- "output_type": "stream",
73- "text": [
74- "/home/giancastro/miniconda3/envs/xrspatial/lib/python3.8/site-packages/numba/np/ufunc/parallel.py:365: NumbaWarning: The TBB threading layer requires TBB version 2019.5 or later i.e., TBB_INTERFACE_VERSION >= 11005. Found TBB_INTERFACE_VERSION = 9107. The TBB threading layer is disabled.\n",
75- " warnings.warn(problem)\n"
76- ]
77- },
78- {
79- "data": {
80- "text/plain": [
81- "{'blue': <xarray.DataArray (y: 1024, x: 1024)>\n",
82- " array([[7595, 7136, 7328, ..., 7543, 7628, 7602],\n",
83- " [7320, 7404, 7834, ..., 7529, 7536, 7548],\n",
84- " [7185, 7255, 7760, ..., 7931, 7656, 7536],\n",
85- " ...,\n",
86- " [7312, 7293, 7285, ..., 7510, 7519, 7542],\n",
87- " [7287, 7273, 7280, ..., 7523, 7535, 7541],\n",
88- " [7281, 7280, 7288, ..., 7546, 7563, 7566]], dtype=uint16)\n",
89- " Coordinates:\n",
90- " * x (x) float64 6.128e+05 6.129e+05 6.129e+05 ... 6.521e+05 6.521e+05\n",
91- " * y (y) float64 6.853e+06 6.853e+06 6.853e+06 ... 6.82e+06 6.82e+06\n",
92- " Attributes:\n",
93- " res: 30.0\n",
94- " nodata: nan,\n",
95- " 'green': <xarray.DataArray (y: 1024, x: 1024)>\n",
96- " array([[6943, 6270, 6521, ..., 6628, 6695, 6674],\n",
97- " [6474, 6460, 7015, ..., 6592, 6581, 6600],\n",
98- " [6255, 6531, 7203, ..., 7119, 6726, 6566],\n",
99- " ...,\n",
100- " [6280, 6270, 6269, ..., 6479, 6478, 6493],\n",
101- " [6265, 6254, 6261, ..., 6478, 6497, 6498],\n",
102- " [6247, 6257, 6271, ..., 6496, 6524, 6535]], dtype=uint16)\n",
103- " Coordinates:\n",
104- " * x (x) float64 6.128e+05 6.129e+05 6.129e+05 ... 6.521e+05 6.521e+05\n",
105- " * y (y) float64 6.853e+06 6.853e+06 6.853e+06 ... 6.82e+06 6.82e+06\n",
106- " Attributes:\n",
107- " res: 30.0\n",
108- " nodata: nan,\n",
109- " 'red': <xarray.DataArray (y: 1024, x: 1024)>\n",
110- " array([[7411, 6202, 6725, ..., 6769, 6880, 6848],\n",
111- " [6552, 6618, 7775, ..., 6704, 6687, 6743],\n",
112- " [6165, 6773, 7959, ..., 7638, 6921, 6644],\n",
113- " ...,\n",
114- " [6128, 6121, 6132, ..., 6461, 6452, 6472],\n",
115- " [6109, 6103, 6115, ..., 6457, 6472, 6479],\n",
116- " [6098, 6112, 6122, ..., 6480, 6520, 6527]], dtype=uint16)\n",
117- " Coordinates:\n",
118- " * x (x) float64 6.128e+05 6.129e+05 6.129e+05 ... 6.521e+05 6.521e+05\n",
119- " * y (y) float64 6.853e+06 6.853e+06 6.853e+06 ... 6.82e+06 6.82e+06\n",
120- " Attributes:\n",
121- " res: 30.0\n",
122- " nodata: nan,\n",
123- " 'nir': <xarray.DataArray (y: 1024, x: 1024)>\n",
124- " array([[7952, 6157, 7107, ..., 7031, 7165, 7318],\n",
125- " [6720, 6876, 8937, ..., 6891, 6838, 6922],\n",
126- " [5965, 7029, 9140, ..., 8479, 7247, 6733],\n",
127- " ...,\n",
128- " [5803, 5792, 5801, ..., 6356, 6331, 6349],\n",
129- " [5787, 5780, 5784, ..., 6326, 6344, 6379],\n",
130- " [5769, 5781, 5793, ..., 6384, 6454, 6454]], dtype=uint16)\n",
131- " Coordinates:\n",
132- " * x (x) float64 6.128e+05 6.129e+05 6.129e+05 ... 6.521e+05 6.521e+05\n",
133- " * y (y) float64 6.853e+06 6.853e+06 6.853e+06 ... 6.82e+06 6.82e+06\n",
134- " Attributes:\n",
135- " res: 30.0\n",
136- " nodata: nan}"
137- ]
138- },
139- "execution_count": 2,
140- "metadata": {},
141- "output_type": "execute_result"
142- }
143- ],
144- "source": [
145- "SCENE_ID = \"LC80030172015001LGN00\"\n",
146- "EXTS = {\n",
147- " \"blue\": \"B2\",\n",
148- " \"green\": \"B3\",\n",
149- " \"red\": \"B4\",\n",
150- " \"nir\": \"B5\",\n",
151- "}\n",
152- "\n",
153- "cvs = ds.Canvas(plot_width=1024, plot_height=1024)\n",
154- "layers = {}\n",
155- "for name, ext in EXTS.items():\n",
156- " layer = xr.open_rasterio(f\"data/{SCENE_ID}_{ext}.tiff\").load()[0]\n",
157- " layer.name = name\n",
158- " layer = cvs.raster(layer, agg=\"mean\")\n",
159- " layer.data = orient_array(layer)\n",
160- " layers[name] = layer\n",
161- "layers"
162- ]
57+ "outputs": [],
58+ "source": "SCENE_ID = \"LC80030172015001LGN00\"\nEXTS = {\n \"blue\": \"B2\",\n \"green\": \"B3\",\n \"red\": \"B4\",\n \"nir\": \"B5\",\n}\n\ncvs = ds.Canvas(plot_width=1024, plot_height=1024)\nlayers = {}\nfor name, ext in EXTS.items():\n layer = rioxarray.open_rasterio(f\"../../../xrspatial-examples/data/{SCENE_ID}_{ext}.tiff\").load()[0]\n layer.name = name\n layer = cvs.raster(layer, agg=\"mean\")\n layer.data = orient_array(layer)\n layers[name] = layer\nlayers"
16359 },
16460 {
16561 "cell_type": "markdown",
12111107 },
12121108 "nbformat": 4,
12131109 "nbformat_minor": 2
1214- }
1110+ }
0 commit comments