path = r'testtiff\chunks' # Remove a couple of these files so that we only have 4 tiles, and we # know where they should drain to files = os.listdir(path) files.sort() for i, fil in enumerate(files): print i, fil delete_ids = [0, 1, 2, 3, 4, 5, 6, 9] for d_id in delete_ids: os.remove(os.path.join(path, files[d_id])) # Create the ProcessManager object savepath = r'testtiff\processed_data' pm = ProcessManager(path, savepath) pm._DEBUG = True # Save out the magnitude and slope pm.elev_source_files.sort() esfile = pm.elev_source_files[1] # Start with lower-left tile and go CCW # Start twi calculation for first tile fn, status = pm.calculate_twi(esfile, save_path=pm.save_path, do_edges=False) edge_init_data, edge_init_done, edge_init_todo = \ pm.tile_edge.get_edge_init_data(esfile) # THe only valuable information here is the edge_init_todo, which is self-set # In this case the right edge of the tile is the edge that needs, # information, so the right todo should be True np.testing.assert_(np.all(edge_init_todo['right'][1:-1])) #don't look at corners np.testing.assert_(np.all(~edge_init_todo['left'][1:-1])) #don't look at corners
path = r'testtiff\chunks' # Remove a couple of these files so that we only have 4 tiles, and we # know where they should drain to files = os.listdir(path) files.sort() for i, fil in enumerate(files): print i, fil delete_ids = [0, 1, 2, 3, 4, 5, 6, 9] for d_id in delete_ids: os.remove(os.path.join(path, files[d_id])) # Create the ProcessManager object savepath = r'testtiff\processed_data' pm = ProcessManager(path, savepath) pm._DEBUG = True # Save out the magnitude and slope pm.elev_source_files.sort() esfile = pm.elev_source_files[1] # Start with lower-left tile and go CCW # Start twi calculation for first tile fn, status = pm.calculate_twi(esfile, save_path=pm.save_path, do_edges=False) edge_init_data, edge_init_done, edge_init_todo = \ pm.tile_edge.get_edge_init_data(esfile) # THe only valuable information here is the edge_init_todo, which is self-set # In this case the right edge of the tile is the edge that needs, # information, so the right todo should be True np.testing.assert_(np.all(
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ if __name__ == "__main__": import os from pydem.processing_manager import ProcessManager path = r'testtiff' # Make at least one test file if len(os.listdir(path)) == 0: from pydem.test_pydem import get_test_data get_test_data(13, 64) from pydem.utils import rename_files elev_source_files = [os.path.join(path, fn) for fn in os.listdir(path) if os.path.splitext(fn)[-1] in ['.tif', '.tiff'] and '_elev' in fn] other_source_files = [os.path.join(path, fn) for fn in os.listdir(path) if os.path.splitext(fn)[-1] in ['.tif', '.tiff'] and '_elev' not in fn] rename_files(elev_source_files) for fil in other_source_files: os.remove(fil) savepath = os.path.join('testtiff', 'processed_data') pm = ProcessManager(path, savepath) #pm._DEBUG = False pm.process()
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ if __name__ == "__main__": import os from pydem.processing_manager import ProcessManager path = r'testtiff' # Make at least one test file if len(os.listdir(path)) == 0: from pydem.test_pydem import get_test_data get_test_data(13, 64) from pydem.utils import rename_files elev_source_files = [ os.path.join(path, fn) for fn in os.listdir(path) if os.path.splitext(fn)[-1] in ['.tif', '.tiff'] and '_elev' in fn ] other_source_files = [ os.path.join(path, fn) for fn in os.listdir(path) if os.path.splitext(fn)[-1] in ['.tif', '.tiff'] and '_elev' not in fn ] rename_files(elev_source_files) for fil in other_source_files: os.remove(fil) savepath = os.path.join('testtiff', 'processed_data') pm = ProcessManager(path, savepath) #pm._DEBUG = False pm.process()