def test_with_arrays(self): fname = 'array_point.shp' outfile = os.path.join(self.outputdir, fname) basefile = os.path.join(self.baselinedir, fname) iotools.savePointShapefile(self.x, self.y, self.template, outfile, 'w', river=self.river) testing.compareShapefiles(outfile, basefile)
def test_to_shapefile_mask_cells_points(self): outfile = 'pygridtools/tests/result_files/mgshp_mask_cells_points.shp' basefile = 'pygridtools/tests/baseline_files/mgshp_mask_cells_points.shp' self.g1.cell_mask = self.known_mask self.g1.to_shapefile(outfile, usemask=True, which='cells', geom='point') testing.compareShapefiles(outfile, basefile)
def test_with_arrays(self): fname = 'array_grid.shp' outfile = os.path.join(self.outputdir, fname) basefile = os.path.join(self.baselinedir, fname) iotools.saveGridShapefile(self.grid.x, self.grid.y, self.mask, self.template, outfile, 'w', river=self.river, elev=None) testing.compareShapefiles(basefile, outfile, atol=0.001)
def test_with_masks(self): fname = 'mask_point.shp' outfile = os.path.join(self.outputdir, fname) basefile = os.path.join(self.baselinedir, fname) iotools.savePointShapefile(np.ma.MaskedArray(self.x, self.mask), np.ma.MaskedArray(self.y, self.mask), self.template, outfile, 'w', river=self.river) testing.compareShapefiles(outfile, basefile)
def test_to_shapefile_nomask_cells_polys(self): outfile = 'pygridtools/tests/result_files/mgshp_nomask_cells_polys.shp' basefile = 'pygridtools/tests/baseline_files/mgshp_nomask_cells_polys.shp' with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always") self.g1.to_shapefile(outfile, usemask=False, which='cells', geom='polygon') nt.assert_equal(len(w), 1) testing.compareShapefiles(outfile, basefile)
def test_basic(self): iotools.gridextToShapefile(self.gridextfile, self.outputfile, self.template, river=self.river) testing.compareShapefiles(self.outputfile, self.baselinefile)
def test_to_shapefile_nomask_nodes_polys(self): outfile = 'pygridtools/tests/result_files/mgshp_nomask_nodes_polys.shp' basefile = 'pygridtools/tests/baseline_files/mgshp_nomask_cells_polys.shp' self.g1.to_shapefile(outfile, usemask=False, which='nodes', geom='polygon') testing.compareShapefiles(outfile, basefile)