"""
if __name__ == "__main__":
    from pydem.test_pydem import get_test_data
    from pydem.dem_processing import DEMProcessor
    from pydem.test_pydem import make_file_names


    import sys
    if len(sys.argv) <= 1:
        testnum = 30  # Default test number

    NN = 64  # Resolution of tile
    
    # Get test data and create DEMProcessor
    elev, ang, test_data = get_test_data(testnum, NN)
    filename = make_file_names(testnum, NN)['fel']
    dem_proc = DEMProcessor(filename, dx_dy_from_file=False)
    
    # Calculate magnitude and direction of slopes
    mag, direction = dem_proc.calc_slopes_directions()

    # Calculate UCA/TWI on entire tile
    area1 = dem_proc.calc_uca(0)
    twi1 = dem_proc.calc_twi()

    # Calculate UCA/TWI on chunks
    dem_proc.resolve_edges = True  # If false, won't do edge resolution
    dem_proc.chunk_size_uca = 9  # Chunk size
    dem_proc.chunk_overlap_uca = 3  #Overlap between chunks
    area2 = dem_proc.calc_uca(0)  
    twi2 = dem_proc.calc_twi()
Exemple #2
0
    )
    parser.add_argument(
        "--variable-coords",
        "--vc",
        help="if set, will create a non-" "uniform grid on the elevation",
        action="store_true",
    )
    args = parser.parse_args()
    testnum = args.testnum
    dx_dy_from_file = args.variable_coords
    testnum += dx_dy_from_file

    NN = 511  # The resolution of the grid (N x N)

    if testnum >= 28:
        filename = make_file_names(testnum, NN)["elev"]
    else:
        filename = make_file_names(testnum, NN)["fel"]

    elev, ang, test_data = get_test_data(testnum, NN)

    # Make the filenames of the results
    filename2 = make_file_names(testnum, NN)["uca"]
    if os.path.exists(filename2):
        uca_file = GdalReader(file_name=filename2)
        uca, = uca_file.raster_layers

    # Make the pydem Processor object and process the elevation
    dem_proc = DEMProcessor(filename, dx_dy_from_file=dx_dy_from_file)
    mag, direction = dem_proc.calc_slopes_directions()
    area = dem_proc.calc_uca(0)
Exemple #3
0
                        default=30,
                        nargs='?')
    parser.add_argument('--variable-coords',
                        '--vc',
                        help='if set, will create a non-'
                        'uniform grid on the elevation',
                        action="store_true")
    args = parser.parse_args()
    testnum = args.testnum
    dx_dy_from_file = args.variable_coords
    testnum += dx_dy_from_file

    NN = 64  # The resolution of the grid (N x N)

    if testnum >= 28:
        filename = make_file_names(testnum, NN)['elev']
    else:
        filename = make_file_names(testnum, NN)['fel']

    elev, ang, test_data = get_test_data(testnum, NN)

    # Make the filenames of the results
    filename2 = make_file_names(testnum, NN)['uca']
    if os.path.exists(filename2):
        uca_file = GdalReader(file_name=filename2)
        uca, = uca_file.raster_layers

    # Make the pydem Processor object and process the elevation
    dem_proc = DEMProcessor(filename, dx_dy_from_file=dx_dy_from_file)
    mag, direction = dem_proc.calc_slopes_directions()
    area = dem_proc.calc_uca(0)
Exemple #4
0
   limitations under the License.
"""
if __name__ == "__main__":
    from pydem.test_pydem import get_test_data
    from pydem.dem_processing import DEMProcessor
    from pydem.test_pydem import make_file_names

    import sys
    if len(sys.argv) <= 1:
        testnum = 30  # Default test number

    NN = 64  # Resolution of tile

    # Get test data and create DEMProcessor
    elev, ang, test_data = get_test_data(testnum, NN)
    filename = make_file_names(testnum, NN)['fel']
    dem_proc = DEMProcessor(filename, dx_dy_from_file=False)

    # Calculate magnitude and direction of slopes
    mag, direction = dem_proc.calc_slopes_directions()

    # Calculate UCA/TWI on entire tile
    area1 = dem_proc.calc_uca(0)
    twi1 = dem_proc.calc_twi()

    # Calculate UCA/TWI on chunks
    dem_proc.resolve_edges = True  # If false, won't do edge resolution
    dem_proc.chunk_size_uca = 9  # Chunk size
    dem_proc.chunk_overlap_uca = 3  #Overlap between chunks
    area2 = dem_proc.calc_uca(0)
    twi2 = dem_proc.calc_twi()
        description='Compare pydem output to taudem output')
    parser.add_argument('testnum', help='the number of the test elevation to '
                        'process', type=int, default=30, nargs='?')
    parser.add_argument('--variable-coords', '--vc',
                        help='if set, will create a non-'
                        'uniform grid on the elevation', action="store_true")
    args = parser.parse_args()
    testnum = args.testnum
    dx_dy_from_file = args.variable_coords
    testnum += dx_dy_from_file


    NN = 64  # The resolution of the grid (N x N)

    if testnum >= 28:
        filename = make_file_names(testnum, NN)['elev']
    else:
        filename = make_file_names(testnum, NN)['fel']

    elev, ang, test_data = get_test_data(testnum, NN)

    # Make the filenames of the results
    filename2 = make_file_names(testnum, NN)['uca']
    if os.path.exists(filename2):
        uca_file = GdalReader(file_name=filename2)
        uca, = uca_file.raster_layers

    # Make the pydem Processor object and process the elevation
    dem_proc = DEMProcessor(filename, dx_dy_from_file=dx_dy_from_file)
    mag, direction = dem_proc.calc_slopes_directions()
    area = dem_proc.calc_uca(0)