def test_generate_terrain(): csv = ds.Canvas(x_range=X_RANGE, y_range=Y_RANGE, plot_width=W, plot_height=H) terrain = geo.generate_terrain(csv) assert terrain is not None
from __future__ import absolute_import import datashader as ds import xarray as xr import numpy as np import pytest from datashader import geo W = 25 H = 30 X_RANGE = (0, 500) Y_RANGE = (0, 500) csv = ds.Canvas(x_range=X_RANGE, y_range=Y_RANGE, plot_width=W, plot_height=H) terrain = geo.generate_terrain(csv) def _raster_aggregate_default(): return terrain # def _do_sparse_array(data_array): import random indx = list(zip(*np.where(data_array))) pos = random.sample(range(data_array.size), data_array.size // 2) indx = np.asarray(indx)[pos] r = indx[:, 0] c = indx[:, 1] data_half = data_array.copy()
def test_generate_terrain(): terrain = geo.generate_terrain(20, 20) assert terrain is not None
import datashader as ds import xarray as xr import numpy as np import pytest from datashader import geo W = 25 H = 30 csv = ds.Canvas(plot_width=W, plot_height=H) terrain = geo.generate_terrain(W, H) def _raster_aggregate_default(): return terrain # def _do_sparse_array(data_array): import random indx = list(zip(*np.where(data_array))) pos = random.sample(range(data_array.size), data_array.size//2) indx = np.asarray(indx)[pos] r = indx[:,0] c = indx[:,1] data_half = data_array.copy() data_half[r,c] = 0 return data_half def _do_gaussian_array(): _x = np.linspace(0, 50, 101) _y = _x.copy() _mean = 25
import datashader as ds import xarray as xr import numpy as np import pytest from datashader import geo W = 25 H = 30 X_RANGE = (0, 500) Y_RANGE = (0, 500) csv = ds.Canvas(x_range=X_RANGE, y_range=Y_RANGE, plot_width=W, plot_height=H) terrain = geo.generate_terrain(csv) def _raster_aggregate_default(): return terrain # def _do_sparse_array(data_array): import random indx = list(zip(*np.where(data_array))) pos = random.sample(range(data_array.size), data_array.size//2) indx = np.asarray(indx)[pos] r = indx[:,0] c = indx[:,1] data_half = data_array.copy() data_half[r,c] = 0 return data_half