-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
324e751
commit 8114306
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
Unit-Tests with Fauxgeo | ||
======================= | ||
|
||
.. code:: | ||
import unittest | ||
from fauxgeo import RasterFactory, Raster | ||
import pygeoprocessing as pygeo | ||
class TestIO(unittest.TestCase): | ||
def setUp(self): | ||
# arguments for raster factory | ||
pixel_size = 0.083333 | ||
size = 180/pixel_size | ||
shape = (size, size*2) | ||
affine = Affine(pixel_size, 0, -180, 0, -pixel_size, 90) | ||
proj = 4326 | ||
datatype = gdal.GDT_Int32 | ||
nodata_val = NODATA_INT | ||
# create raster factory | ||
self.global_int_factory = RasterFactory( | ||
proj, datatype, nodata_val, shape[0], shape[1], affine=affine) | ||
def test(self): | ||
# create test data | ||
global_raster = global_int_factory.uniform(5) | ||
# arguments for vectorize_datasets | ||
dataset_uri_list = [global_raster.uri] | ||
dataset_out_uri = pygeo.geoprocessing.temporary_filename() | ||
# ... other inputs ... | ||
pygeo.geoprocessing.vectorize_datasets(...) | ||
# validate that output matches expected value | ||
r = Raster.from_file(dataset_out_uri) | ||
assert(r[0, 0] == 5) |