Esempio n. 1
0
def main(argv):
    yaml_parser = YamlArgparse()
    args = yaml_parser.parse()
    configure_logging()
    cfg = validate_config(load_config(args.run_config_path))
    echofile = cfg.runconfig.groups.product_path_group.sas_config_file
    if echofile:
        log.info(f"Logging configuration to file {echofile}.")
        dump_config(cfg, echofile)
    focus(cfg)
Esempio n. 2
0
            raster = isce3.io.Raster(raster_path)

            # Create output raster
            resamp_slc = isce3.io.Raster(str(out_path), rg_off.width,
                                         rg_off.length, rg_off.num_bands,
                                         gdal.GDT_CFloat32, 'ENVI')
            resamp_obj.resamp(raster, resamp_slc, rg_off, az_off)

    t_all_elapsed = time.time() - t_all
    info_channel.log(
        f"successfully ran resample in {t_all_elapsed:.3f} seconds")


if __name__ == "__main__":
    '''
    run resample_slc from command line
    '''

    # load command line args
    resample_slc_parser = YamlArgparse(resample_type=True)
    args = resample_slc_parser.parse()

    # Extract resample_type
    resample_type = args.resample_type

    # Get a runconfig dictionary from command line args
    resample_slc_runconfig = ResampleSlcRunConfig(args, resample_type)

    # Run resample_slc
    run(resample_slc_runconfig.cfg, resample_type)
Esempio n. 3
0
                spacing_x=radar_grid_cubes_geogrid.spacing_x,
                spacing_y=radar_grid_cubes_geogrid.spacing_y,
                width=int(radar_grid_cubes_geogrid.width),
                length=int(radar_grid_cubes_geogrid.length),
                epsg=radar_grid_cubes_geogrid.epsg)

            cube_group_name = '/science/LSAR/GSLC/metadata/radarGrid'

            native_doppler.bounds_error = False
            '''
            The native-Doppler LUT bounds error is turned off to
            computer cubes values outside radar-grid boundaries
            '''
            add_radar_grid_cubes_to_hdf5(dst_h5, cube_group_name, cube_geogrid,
                                         radar_grid_cubes_heights, radar_grid,
                                         orbit, native_doppler,
                                         image_grid_doppler, threshold_geo2rdr,
                                         iteration_geo2rdr)

    t_all_elapsed = time.time() - t_all
    info_channel.log(
        f"successfully ran geocode SLC in {t_all_elapsed:.3f} seconds")


if __name__ == "__main__":
    yaml_parser = YamlArgparse()
    args = yaml_parser.parse()
    gslc_runcfg = GSLCRunConfig(args)
    h5_prep.run(gslc_runcfg.cfg)
    run(gslc_runcfg.cfg)
Esempio n. 4
0
            unwrap.min_pixels_region = phass_cfg['min_unwrap_area']
    else:
        err_str = "Not a valid unwrapping algorithm"
        error_channel.log(err_str)
        raise ValueError(err_str)

    return unwrap


if __name__ == "__main__":
    '''
    Run phase unwrapping from command line
    '''

    # Load command line args
    unwrap_parser = YamlArgparse()
    args = unwrap_parser.parse()

    # Get a runconfig dictionary from command line args
    unwrap_runconfig = UnwrapRunConfig(args)

    # Prepare RUNW HDF5
    unwrap_runconfig.cfg['primary_executable'][
        'product_type'] = 'RUNW_STANDALONE'
    out_paths = h5_prep.run(unwrap_runconfig.cfg)

    # Use RIFG from crossmul_path
    rifg_h5 = unwrap_runconfig.cfg['processing']['phase_unwrap'][
        'crossmul_path']

    # Run phase unwrapping
Esempio n. 5
0
            if freq.upper() == 'B':
                continue

            add_radar_grid_cube(cfg, freq, radar_grid, slc.getOrbit(), dst_h5)

    t_all_elapsed = time.time() - t_all
    info_channel.log(f"Successfully ran geocode in {t_all_elapsed:.3f} seconds")


if __name__ == "__main__":
    """
    run geocode from command line
    """

    # load command line args
    geocode_insar_parser = YamlArgparse()
    args = geocode_insar_parser.parse()

    # Get a runconfig dictionary from command line args
    geocode_insar_runconfig = GeocodeInsarRunConfig(args)

    # prepare RIFG HDF5
    geocode_insar_runconfig.cfg['primary_executable']['product_type'] = 'GUNW_STANDALONE'
    out_paths = h5_prep.run(geocode_insar_runconfig.cfg)
    runw_path = geocode_insar_runconfig.cfg['processing']['geocode'][
        'runw_path']
    if runw_path is not None:
        out_paths['RUNW'] = runw_path

    # Run geocode
    run(geocode_insar_runconfig.cfg, out_paths["RUNW"], out_paths["GUNW"])
Esempio n. 6
0
                dst_h5[dest_pol_path].attrs['units'] = f""

            # update meta information for bandpass SLC
            data = dst_h5[f"{dest_freq_path}/processedCenterFrequency"]
            data[...] = bandpass_meta['center_frequency']
            data = dst_h5[f"{dest_freq_path}/slantRangeSpacing"]
            data[...] = bandpass_meta['range_spacing']
            data = dst_h5[f"{dest_freq_path}/processedRangeBandwidth"]
            data[...] = base_meta_data.rg_bandwidth
            del dst_h5[f"{dest_freq_path}/slantRange"]
            dst_h5.create_dataset(f"{dest_freq_path}/slantRange",
                                  data=bandpass_meta['slant_range'])

    t_all_elapsed = time.time() - t_all
    print('total processing time: ', t_all_elapsed, ' sec')
    info_channel.log(
        f"successfully ran bandpass_insar in {t_all_elapsed:.3f} seconds")


if __name__ == "__main__":
    '''
    run bandpass from command line
    '''
    # load command line args
    bandpass_parser = YamlArgparse()
    args = bandpass_parser.parse()
    # get a runconfig dict from command line args
    bandpass_runconfig = BandpassRunConfig(args)
    # run bandpass
    run(bandpass_runconfig.cfg)
Esempio n. 7
0
       Frequency to process (A or B)
    pol: str
       Polarization to process (HH, HV, VH, VV)
    """
    path = f'science/LSAR/RIFG/swaths/frequency{freq}/pixelOffsets/{pol}/'
    offset_layer = ['slantRangeOffset', 'alongTrackOffset']

    for layer in offset_layer:
        offset_path = f'{path}/{layer}'
        offset_dataset = h5_ds[offset_path]
        offset_raster = isce3.io.Raster(
            f"IH5:::ID={offset_dataset.id.id}".encode("utf-8"))
        compute_stats_real_data(offset_raster, offset_dataset)


if __name__ == "__main__":
    '''
    run crossmul from command line
    '''
    # load command line args
    crossmul_parser = YamlArgparse(resample_type=True)
    args = crossmul_parser.parse()
    # extract resample type
    resample_type = args.resample_type
    # get a runconfig dict from command line args
    crossmul_runconfig = CrossmulRunConfig(args, resample_type)
    # prepare RIFG HDF5
    out_paths = h5_prep.run(crossmul_runconfig.cfg)
    # run crossmul
    run(crossmul_runconfig.cfg, out_paths['RIFG'], resample_type)
Esempio n. 8
0
        # run topo
        rdr2geo_obj.topo(dem_raster, x_raster, y_raster, height_raster,
                         incidence_raster, heading_raster,
                         local_incidence_raster, local_psi_raster,
                         simulated_amplitude_raster, shadow_raster)

        # remove undesired/None rasters from raster list
        raster_list = [raster for raster in raster_list if raster is not None]

        # save non-None rasters to vrt
        output_vrt = isce3.io.Raster(f'{str(rdr2geo_scratch_path)}/topo.vrt',
                                     raster_list)
        output_vrt.set_epsg(rdr2geo_obj.epsg_out)

    t_all_elapsed = time.time() - t_all
    info_channel.log(
        f"successfully ran rdr2geo in {t_all_elapsed:.3f} seconds")


if __name__ == "__main__":
    '''
    run rdr2geo from command line
    '''
    # load command line args
    rdr2geo_parser = YamlArgparse()
    args = rdr2geo_parser.parse()
    # get a runconfig dict from command line args
    rdr2geo_runconfig = Rdr2geoRunConfig(args)
    # run rdr2geo
    run(rdr2geo_runconfig.cfg)
Esempio n. 9
0
        geo2rdr_obj = Geo2Rdr(radar_grid, orbit, ellipsoid, doppler_grid,
                              threshold, numiter, lines_per_block)

        # Opem Topo Raster
        topo_path = pathlib.Path(cfg['processing']['geo2rdr']['topo_path'])
        rdr2geo_topo_path = topo_path / 'rdr2geo' / f'freq{freq}' / 'topo.vrt'
        topo_raster = isce3.io.Raster(str(rdr2geo_topo_path))

        # Run geo2rdr
        geo2rdr_obj.geo2rdr(topo_raster, str(geo2rdr_scratch_path))

    t_all_elapsed = time.time() - t_all
    info_channel.log(
        f"Successfully ran geo2rdr in {t_all_elapsed:.3f} seconds")


if __name__ == "__main__":
    '''
    run geo2rdr from command line
    '''

    # load command line args
    geo2rdr_parser = YamlArgparse()
    args = geo2rdr_parser.parse()

    # Get a runconfig dictionary from command line args
    geo2rdr_runconfig = Geo2rdrRunConfig(args)

    # Run geo2rdr
    run(geo2rdr_runconfig.cfg)
Esempio n. 10
0
        <PixelFunctionType>{function_name}</PixelFunctionType>
        <SimpleSource>
          <SourceFilename>{file1}</SourceFilename>
        </SimpleSource>
        <SimpleSource>
          <SourceFilename>{file2}</SourceFilename>
        </SimpleSource>
      </VRTRasterBand>
    </VRTDataset>'''

    with open(out_vrt, 'w') as fid:
        fid.write(vrttmpl)


if __name__ == "__main__":
    '''
    Run rubbersheet to filter out outliers in the
    slant range and azimuth offset fields. Fill no
    data values left by outliers holes and resample
    culled offsets to reference RSLC shape.
    '''
    # Prepare rubbersheet parser & runconfig
    rubbersheet_parser = YamlArgparse()
    args = rubbersheet_parser.parse()
    rubbersheet_runconfig = RubbersheetRunConfig(args)

    # Prepare RIFG. Culled offsets will be
    # allocated in RIFG product
    out_paths = h5_prep.run(rubbersheet_runconfig.cfg)
    run(rubbersheet_runconfig.cfg, out_paths['RIFG'])
Esempio n. 11
0
        mask = mask_args['general']
    return mask


def create_gaussian_kernel(size, sigma):
    '''
    Create 1D gaussian kernel given kernel size
    and standard deviation
    '''
    array = np.arange(-int(size / 2), int(size / 2) + 1)
    return np.asarray([
        1 / (sigma * np.sqrt(2 * np.pi)) *
        np.exp(-float(x)**2 / (2 * sigma**2)) for x in array
    ])


if __name__ == "__main__":
    '''
    Run interferogram filtering from command line
    '''
    # Load command line args
    filter_parser = YamlArgparse()
    args = filter_parser.parse()
    # Get a runconfig dict from command line args
    filter_runconfig = FilterInterferogramRunConfig(args)
    # Use RIFG from interferogram path
    rifg_h5 = filter_runconfig.cfg['processing']['filter_interferogram'][
        'interferogram_path']
    # run insar filtering
    run(filter_runconfig.cfg, rifg_h5)